- UID
- 37798
注册时间2007-12-1
阅读权限20
最后登录1970-1-1
以武会友
 
TA的每日心情 | 开心 2024-4-14 19:08 |
---|
签到天数: 83 天 [LV.6]常住居民II
|

楼主 |
发表于 2025-4-19 20:03:46
|
显示全部楼层
代码中好像注册码绑定的本机的MAC
using System;
using System.Globalization;
using Common.Utilities;
using Microsoft.Win32;
using ParkingManage.Common;
public static bool ResetLock(string mac, string tempendTimestr, bool useDateEnable, out string errorMsg)
{
errorMsg = "";
string keyPath = "";
string text = Security.DecryptDES(tempendTimestr, ShareData.Endkey);
string[] array = text.Split('@');
if (array.Length != 2 || (array.Length > 1 && array[1] == "00163E88210C"))
{
if (array.Length == 1)
{
DateTime result = DateTime.Now;
if (DateTime.TryParse(array[0], out result))
{
RegistryKey localMachine = Registry.LocalMachine;
RegistryKey registryKey = localMachine.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
registryKey.SetValue("ParkingRegTime", tempendTimestr);
errorMsg = "授权成功";
return true;
}
errorMsg = "无效的授权码";
return false;
}
if (array.Length == 2 && array[1] == "00163E88210C" && mac == "00163E88210C")
{
try
{
string value = Security.EncryptDES(DateTime.ParseExact(array[0], "yyyyMMdd", CultureInfo.CurrentCulture).ToString("yyyy-MM-dd HH:mm:ss"), ShareData.Endkey);
RegistryKey localMachine2 = Registry.LocalMachine;
RegistryKey registryKey2 = localMachine2.CreateSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run");
registryKey2.SetValue("ParkingRegTime", value);
errorMsg = "授权成功";
return true;
}
catch
{
errorMsg = "无效的授权码";
return false;
}
}
errorMsg = "无效的授权码";
return false;
}
if (!CheckLockDog.IsExitLockDog(out keyPath))
{
errorMsg = "未找到加密狗";
return false;
}
if (array[1] != mac)
{
errorMsg = "该授权码不适用本机";
return false;
}
DateTime dateTime;
try
{
dateTime = DateTime.ParseExact(array[0], "yyyyMMdd", CultureInfo.CurrentCulture);
}
catch
{
errorMsg = "无效的授权码";
return false;
}
string companyName = ShareData.CompanyName;
string encryptString = DateTime.Now.ToString("yyyyMMdd");
string encryptString2 = dateTime.ToString("yyyyMMdd");
string text2 = (useDateEnable ? "1" : "0");
int num = ((ShareData.DogInfo == null) ? 13 : ShareData.DogInfo.ChannelType);
companyName = Security.EncryptDES(companyName, ShareData.Compkey);
encryptString = Security.EncryptDES(encryptString, ShareData.Beginkey);
encryptString2 = Security.EncryptDES(encryptString2, ShareData.Endkey);
string text3 = companyName + ":" + encryptString + ":" + encryptString2 + ":" + text2 + ":" + num;
int length = text3.Length;
string errorMsg2 = "";
if (!CheckLockDog.WriteLockKey(text3, out errorMsg2))
{
errorMsg = errorMsg2;
return false;
}
return true;
} |
|