init commit all code
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Getf.Service.Transfer.Client.WinService.Helpers
|
||||
{
|
||||
public class LogHelper
|
||||
{
|
||||
log4net.ILog MLog;
|
||||
|
||||
public LogHelper()
|
||||
{
|
||||
|
||||
MLog = log4net.LogManager.GetLogger("Getf.Transfer.Client");
|
||||
}
|
||||
|
||||
public void Debug(string msg)
|
||||
{
|
||||
MLog.Debug(msg);
|
||||
}
|
||||
|
||||
public void Error(string msg)
|
||||
{
|
||||
MLog.Error(msg);
|
||||
}
|
||||
|
||||
public void Error(Exception exception)
|
||||
{
|
||||
MLog.Error(exception.Message, exception);
|
||||
}
|
||||
|
||||
public void Info(string msg)
|
||||
{
|
||||
MLog.Info(msg);
|
||||
}
|
||||
|
||||
public void Warn(string msg)
|
||||
{
|
||||
MLog.Warn(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Getf.Service.Transfer.Client.WinService.Helpers
|
||||
{
|
||||
public static class Md5Helper
|
||||
{
|
||||
public static string Md5(string str)
|
||||
{
|
||||
MD5 md5 = MD5.Create();
|
||||
byte[] data = Encoding.UTF8.GetBytes(str);
|
||||
data = md5.ComputeHash(data);
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
{
|
||||
sb.Append(data[i].ToString("x2"));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Getf.Service.Transfer.Client.WinService.Helpers
|
||||
{
|
||||
public static class TypeHelper
|
||||
{
|
||||
public static DateTime ToDateTime(long timeStamp)
|
||||
{
|
||||
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区
|
||||
DateTime dt = startTime.AddSeconds(timeStamp);
|
||||
return dt;
|
||||
}
|
||||
public static long GetTimeStamp()
|
||||
{
|
||||
System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1, 0, 0, 0, 0));
|
||||
long t = (long)(DateTime.Now - startTime).TotalSeconds;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user