增加写入文件
parent
b0f85fae1c
commit
96418613dd
|
@ -25,56 +25,9 @@ namespace IRaCIS.Core.API
|
||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
public readonly string environment;
|
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
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue