随笔分类 - Tools
摘要:public static MemoryStream CreateMemoryStreamFromBytes(byte[] inputData) { if (inputData == null || inputData.Length == 0) { return null; ...
阅读全文
摘要:在当前Server上找某某object,注意只需修改"要找的object"就可以使用EXEC sp_MSforeachdb 'use ? ;IF EXISTS(SELECT top 1 1 FROM sys.syscomments WHERE text LIKE ''%要找的object%'')SE
阅读全文
摘要:public static string MakeSafeSql(this string s) { string t = s; t = t.Replace("'", "''"); t = t.Replace("[", "[[]"); t = t.Replace("%", "[%]");...
阅读全文
摘要:private const string m_NumberPattm = @"^[-+]?(0{1}|(([1-9]){1}[0-9]{0,6}))?$"; private const string m_NumberPattmTemplate = @"^[-+]?(0{1}|(([1-9]){1}[0-9]{0,digit}))?$"; private cons...
阅读全文
摘要:public static string CompressString(string unCompressedString) { byte[] bytData = System.Text.Encoding.UTF8.GetBytes(unCompressedString); MemoryStream ms = new Memory...
阅读全文
摘要:public static object locker = new object(); public static LogConfiguration LogConfig { set; get; } static Logger() { if (...
阅读全文
摘要:private static XmlWriterSettings GetSettings() { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.NewLineChars = "\...
阅读全文
摘要:public static T GetInstance(Assembly assembly, string fullNamespace) { return (T)assembly.CreateInstance(fullNamespace); } public static T GetInstance(string ass...
阅读全文
摘要:/// /// 将相对路径转换成程序所在的绝对路径 /// /// 要进行转换的路径,可以是绝对路径,相以路径和URL地址 /// 转换后的全路径 public static string ToLocalDirectory(this string path) { if (!...
阅读全文
摘要:最近遇到很头疼的问题,安装到服务器的Windows Service卸载的时候出错了,结果在服务列表中就一直驻留,并且系统进程一直在运行,怎么都杀不掉。 最后终于找到办法了: 1.常规做法,批处理命令卸载 Net Stop ServiceNamesc delete ServiceNamepause 2
阅读全文
摘要:配置文件格式: 配置文件路径:ConfigFiles/Ford/ErrorResource.xml
阅读全文
摘要:public void SaveDownLoadAsPNG(Image img, string filePath) { try { WebRequest request = WebRequest.Create(filePath); SaveFileDialog sfd ...
阅读全文
摘要:InstallService.bat @ECHO OFFecho 准备安装服务echo echo 安装服务...Sc create "KenTestService" binpath= "L:\Job\KenTestJob\JobService\KenTestService.exe" displayn
阅读全文
摘要:public class ConfigHelper { public static ScriptsHelper Scripts { get { return new ScriptsHelper(); } } public static ParametersHelper Parameters ...
阅读全文
摘要:/// /// 正则表达式相关方法集合 /// public static class RegularHelper { private const string m_NumberPattm = @"^[-+]?(0{1}|(([1-9]){1}[0-9]{0,6}))?$"; private const string m_Num...
阅读全文
摘要:internal class EncryptTransform { //private const int c_MaxLengthOf_IV_DES = 4; //private const int c_MaxLengthOf_IV_RC2 = 4; //private const int c_MaxLengthOf_IV_RIJNDAEL...
阅读全文
摘要:public static class EncryptionHelper { #region const /// /// 默认使用的适合于DES,RC2算法的Key /// private const string m_ShortDefaultKey = "Nesc"; /// ...
阅读全文
摘要:private static XmlWriterSettings GetSettings() { XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.NewLineChars = "\n...
阅读全文
摘要:public static class EnumHelper { #region get /// /// 获得枚举类型所包含的全部项的列表 /// /// 枚举的类型 /// public static List GetEnumItems(Type enumTyp...
阅读全文
摘要:public static T LoadFromXml(string fileName) { FileStream fs = null; try { XmlSerializer serializer = new XmlSerializer(typeof(T)); ...
阅读全文