From 96418613ddbf6b1424c1da2ebd859900c41bf869 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Mon, 17 Apr 2023 11:51:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=86=99=E5=85=A5=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Program.cs | 98 +++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 49 deletions(-) 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);