摘要: /// <summary> /// 必需用XPATH表达式来获取相应节点 /// 关于xpath可以参见: /// </summary> public class XmlHelper { #region 变量 /// <summary> /// xml文件所在路径类型 /// </summary> /// <remarks>xml文件所在路径类型</remarks> public enum enumXmlPathType { /// <summa... 阅读全文
posted @ 2012-08-29 16:08 暗尘掩月 阅读(205) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// Web页面方法 /// </summary> public class WebHelper { /// <summary> /// 校验是否为内部提交数据 /// </summary> /// <param name="rq"></param> /// <returns>false=外部提交数据;</returns> public static bool VerifyPost(HttpContext rq) { ... 阅读全文
posted @ 2012-08-29 16:08 暗尘掩月 阅读(784) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 数据验证类 /// </summary> public class Validator { /// <summary> /// 验证是否为正整数 /// </summary> /// <param name="str"></param> /// <returns></returns> public static bool IsNumeric(string str) { if (!string.IsNullOrEmpt... 阅读全文
posted @ 2012-08-29 16:06 暗尘掩月 阅读(408) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 常用方法 /// </summary> public static class Utility { /// <summary> /// DataTable翻页 /// </summary> /// <param name="pageIndex">页序号</param> /// <param name="pageSize">每页显示数量</param> /// <param name="recordCount& 阅读全文
posted @ 2012-08-29 16:06 暗尘掩月 阅读(232) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 字符串操作方法 /// </summary> public class StringHelper { #region SQL 特殊字符过滤,防SQL注入 /// <summary> /// SQL 特殊字符过滤,防SQL注入 /// </summary> /// <param name="contents">检查的SQL语句</param> /// <returns></returns> public static string SqlF... 阅读全文
posted @ 2012-08-29 16:05 暗尘掩月 阅读(1468) 评论(0) 推荐(0) 编辑
摘要: public enum MailFormat { Text, HTML }; public enum MailPriority { Low = 1, Normal = 3, High = 5 }; #region Class mailAttachments public class MailAttachments { private const int MaxAttachmentNum = 10; private IList _Attachments; public MailAttachments() { ... 阅读全文
posted @ 2012-08-29 16:04 暗尘掩月 阅读(323) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// RSA加解密 /// </summary> public class RSA { /// <summary> /// RSA加密 /// </summary> /// <param name="xmlPublicKey">私钥</param> /// <param name="encryptString">需要加密的数据</param> /// <returns>RSA公钥加密后的数据</returns&g 阅读全文
posted @ 2012-08-29 16:03 暗尘掩月 阅读(403) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 远程上传从其他网站复制过来的图片 /// </summary> public class RemoteUpload { /// <summary> /// 上传的源文件名称 /// </summary> private string sOriginalFileName; /// <summary> /// 上传后的文件名称 /// </summary> private string sSaveFileName... 阅读全文
posted @ 2012-08-29 16:03 暗尘掩月 阅读(258) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 汉字转拼音类 /// </summary> public class PIN { private static int[] pyValue = new int[] { -20319,-20317,-20304,-20295,-20292,-20283,-20265,-20257,-20242,-20230,-20051,-20036, -20032,-20026,-20002,-19990,-19986,-19982,-19976,-19805,-19784,-19775,-19... 阅读全文
posted @ 2012-08-29 16:02 暗尘掩月 阅读(404) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 序列和反序列化 /// </summary> public class NVCSpecialized { /// <summary> /// 将字符串序列化<see cref="System.Collections.Specialized.NameValueCollection"/>类型,第一个为键,第二位与其相对应的值。 /// </summary> /// <param name="keys">NameValueCollection中的keys 阅读全文
posted @ 2012-08-29 16:01 暗尘掩月 阅读(161) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 日志类 /// </summary> /// <remarks> /// 当调用Write方法时不会造成线程阻塞,而是立即完成方法调用,因此调用线程不用等待日志写入文件之后才返回。 /// </remarks> public class Logger { /// <summary> /// 写日志 /// </summary> /// <param name="text">错误描述</param> public static void Writ 阅读全文
posted @ 2012-08-29 16:00 暗尘掩月 阅读(497) 评论(0) 推荐(0) 编辑
摘要: public class Js { /// <summary> /// 显示消息提示对话框,不输出页面内容,并返回上一页 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="msg">提示信息</param> /// <returns></returns> public static void ShowAndBack(System.Web.UI.Page page, str 阅读全文
posted @ 2012-08-29 16:00 暗尘掩月 阅读(472) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 利用纯真IP数据库(QQWry.dat)查询IP所在地 /// 优点:查询速度快、方便更新IP库 /// </summary> public static class IPScanner { private static string dataPath = HttpContext.Current.Server.MapPath("/Plugin/qqwry.dat"); private static string ip; private static string country; ... 阅读全文
posted @ 2012-08-29 15:59 暗尘掩月 阅读(394) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 图片操作:生成缩略图、添加水印、截取图片等 /// </summary> public class ImagesHelper { /// <summary> /// 根据文件流获得图片宽度 /// </summary> /// <param name="file"></param> /// <returns></returns> public static int getImgWidth(Stream stream) { ... 阅读全文
posted @ 2012-08-29 15:58 暗尘掩月 阅读(203) 评论(0) 推荐(0) 编辑
摘要: public class HttpClient { #region fields private bool keepContext; private string defaultLanguage = "zh-CN"; private Encoding defaultEncoding = Encoding.UTF8; private string accept = "*/*"; private string userAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Wi... 阅读全文
posted @ 2012-08-29 15:58 暗尘掩月 阅读(306) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 返回系统CPU占用百分比 /// </summary> public class GetCPU { public static int GetCpuUsage() { return CpuUsage.Create().Query(); } public abstract class CpuUsage { private static GetCPU.CpuUsage m_CpuUsage; protec... 阅读全文
posted @ 2012-08-29 15:57 暗尘掩月 阅读(221) 评论(0) 推荐(0) 编辑
摘要: public class FusionCharts { /// <summary> /// encodes the dataURL before it's served to FusionCharts /// If you have parameters in your dataURL, you'll necessarily need to encode it /// </summary> /// <param name="dataURL">dataURL to be fed to chart</param> 阅读全文
posted @ 2012-08-29 15:56 暗尘掩月 阅读(144) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 文本文件从磁盘读取、写入 /// </summary> public class FileHelper { /// <summary> /// 从文件中读取文本内容 /// </summary> /// <param name="filePath">文本路径</param> /// <returns>返回文件中的内容</returns> public static string Read(string filePath) ... 阅读全文
posted @ 2012-08-29 15:54 暗尘掩月 阅读(256) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// Excel操作 /// </summary> public class ExcelHelper { /// <summary> /// DataTable导出到Excel的MemoryStream /// </summary> /// <param name="dtSource">源DataTable</param> /// <param name="strHeaderText">表头文本</param> public st 阅读全文
posted @ 2012-08-29 15:38 暗尘掩月 阅读(385) 评论(0) 推荐(0) 编辑
摘要: /// <summary> /// 加解密密钥 /// </summary> public static string DesKey { get { try { return ConfigurationManager.AppSettings["DESKey"].ToString(); } catch { ... 阅读全文
posted @ 2012-08-29 15:35 暗尘掩月 阅读(239) 评论(0) 推荐(0) 编辑