This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int index = 0; | |
int last = this.array.Length - 1; | |
while (index <= last) | |
{ | |
int mid = index + (last - index) / 2; | |
IPAddressInfo info = this.array[mid]; | |
if (ip >= info.Start && ip <= info.End) | |
{ | |
return info.AreaCode; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// FREE code from CODECENTRIX | |
// http://www.codecentrix.com/ | |
// http://codecentrix.blogspot.com/ | |
using System; | |
using System.Runtime.InteropServices; | |
using mshtml; | |
namespace CodecentrixSample | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class XmlParser | |
{ | |
private static Regex regex = new Regex("<(\\w+?)[ >]", RegexOptions.Compiled); | |
public static T Parse<T>(string body,Encoding encoding) where T : class | |
{ | |
Type type = typeof(T); | |
string rootTagName = GetRootElement(body); | |
XmlAttributes rootAttrs = new XmlAttributes(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EasyWebRequest | |
{ | |
/// <summary> | |
/// HttpWebRequest方式 | |
/// </summary> | |
public enum HttpMethod { | |
GET, | |
POST | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class EnCryptographyHelper | |
{ | |
public static string MD5Encoding(byte[] content) | |
{ | |
MD5 md5 = MD5.Create(); | |
byte[] bytes = md5.ComputeHash(content); | |
return HexToString(bytes); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// | |
/// </summary> | |
public static class XmlUtils | |
{ | |
/// <summary> | |
/// MergeFiles to a single file | |
/// </summary> | |
/// <param name="files"></param> | |
/// <param name="fileContentMergeFail"></param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ClassLoader | |
{ | |
public static List<T> Load<T>(string fileFullPath) | |
{ | |
return Load<T>(new string[] { fileFullPath }); | |
} | |
public static List<T> Load<T>(string path, string parttern) | |
{ | |
string[] files = Directory.GetFiles(path, parttern); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// | |
/// </summary> | |
public static class Log | |
{ | |
private static ILog logger; | |
static Log() | |
{ | |
string log4NetConfigPath = AppDomain.CurrentDomain.BaseDirectory + "//Log4Net.config"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RetryableExcuteQueue<T> | |
where T : CommonContract | |
{ | |
private Queue<ExuteItem> queue; | |
public RetryableExcuteQueue() | |
{ | |
this.queue = new Queue<ExuteItem>(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// </summary> | |
/// <remarks> | |
/// 原图路径 | |
/// <add key="SourcePath" value="D:\Temp\Image\P800"/> | |
/// 压缩尺寸,多个尺寸“;”分隔 | |
/// <add key="Destination" value="340*255"/> | |
/// <add key="Destination" value="340*255;640*480"/> | |
/// 保存路径,多个路径“;”分隔 | |
/// <add key="NewSizePath" value="D:\Temp\Image\P340"/> |
OlderNewer