diff --git a/IRaCIS.Core.API/Program.cs b/IRaCIS.Core.API/Program.cs index 10148204..e58662a7 100644 --- a/IRaCIS.Core.API/Program.cs +++ b/IRaCIS.Core.API/Program.cs @@ -25,56 +25,9 @@ namespace IRaCIS.Core.API public class Program { public readonly string environment; - public static void Main(string[] args) + public static async Task Main(string[] args) { - #region 认证程序 - if (!File.Exists($@"C:\ProgramData\.xingcang\config.json")) - { - Console.WriteLine("当前未注册"); - //Log.Logger.Error("当前未注册"); - Console.ReadLine(); - return; - } - else - { - var json = File.ReadAllText($@"C:\ProgramData\.xingcang\config.json"); - - JObject jsonObject = JObject.Parse(json); - - var key = jsonObject["key"].ToString(); - - var value = jsonObject["value"].ToString(); - - - var physicalAddressList = NetworkInterface.GetAllNetworkInterfaces().Select(t => t.GetPhysicalAddress().ToString()); - - // 判断文件里面的机器码是否是本机的 - if (!physicalAddressList.Contains(key)) - { - Console.WriteLine("机器码和本机不对应"); - //Log.Logger.Error("机器码和本机不对应"); - Console.ReadLine(); - - return; - } - - - var secrete = MD5Helper.Md5($"{key}_XINGCANG"); - - if (value != secrete) - { - Console.WriteLine("机器码和注册码不匹配"); - //Log.Logger.Error("机器码和注册码不匹配"); - Console.ReadLine(); - - return; - - } - - } - - #endregion try @@ -121,12 +74,59 @@ namespace IRaCIS.Core.API + #region 认证程序 + if (!File.Exists($@"C:\ProgramData\.xingcang\config.json")) + { + Console.WriteLine("当前未注册"); + Log.Logger.Error("当前未注册"); + Console.ReadLine(); + return; + } + else + { + var json = File.ReadAllText($@"C:\ProgramData\.xingcang\config.json"); + + JObject jsonObject = JObject.Parse(json); + + var key = jsonObject["key"].ToString(); + + var value = jsonObject["value"].ToString(); + + + var physicalAddressList = NetworkInterface.GetAllNetworkInterfaces().Select(t => t.GetPhysicalAddress().ToString()); + + // 判断文件里面的机器码是否是本机的 + if (!physicalAddressList.Contains(key)) + { + Console.WriteLine("机器码和本机不对应"); + Log.Logger.Error("机器码和本机不对应"); + Console.ReadLine(); + + return; + } + + + var secrete = MD5Helper.Md5($"{key}_XINGCANG"); + + if (value != secrete) + { + Console.WriteLine("机器码和注册码不匹配"); + Log.Logger.Error("机器码和注册码不匹配"); + Console.ReadLine(); + + return; + + } + + } + + #endregion //缓存项目的状态 匿名化数据 - //await InitCache(host); + await InitCache(host);