注册码显示逻辑修改

This commit is contained in:
sc committed 2024-06-29 00:00:33 +08:00
commit 85bcc41e58
3 files changed
+64 -46

No files matched your search

+33 -9
View File
@@ -41,16 +41,34 @@ namespace formula_manage.Windows
private void Window_CDKEY(object sender, RoutedEventArgs e) //打开页面
{
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);//生效配置读取
cdk.Text = Configini.IniReadvalue("SN", "SN1"); //读配置文件
string cdk = Configini.IniReadvalue("SN", "SN1"); //读配置文件
try
{
string Y = (2255 - StrToInt.To16Convert10(cdk.Text.Substring(6, 2))).ToString();
string M = (255 - StrToInt.To16Convert10(cdk.Text.Substring(8, 2))).ToString();
string D = (255 - StrToInt.To16Convert10(cdk.Text.Substring(10, 2))).ToString();
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
if (cdk.Length == 16)
{
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Substring(0, 12)), true) == cdk.Substring(12, 4)) //校验key的crc校验值
{
try
{
string Y = (2255 - StrToInt.To16Convert10(cdk.Substring(6, 2))).ToString();
string M = (255 - StrToInt.To16Convert10(cdk.Substring(8, 2))).ToString();
string D = (255 - StrToInt.To16Convert10(cdk.Substring(10, 2))).ToString();
sn_time.Text = "注册有效时间: " + Y + "-" + M + "-" + D;
}
catch (Exception)
{
sn_time.Text = "注册有效时间: --------";
}
}
else
{
sn_time.Text = "注册有效时间: --------";
}
}
catch (Exception ex) { }
else
{
sn_time.Text = "注册有效时间: --------";
}
// 获取CPU序列号
cpuSerialNumber = HardwareSN.GetCPUSerialNumber();
// 获取主板序列号
@@ -68,7 +86,13 @@ namespace formula_manage.Windows
string id_1;
id_1 = sn_id.Text.Substring(5, 1) + sn_id.Text.Substring(0, 1) + sn_id.Text.Substring(4, 1) + sn_id.Text.Substring(1, 1) + sn_id.Text.Substring(3, 1) + sn_id.Text.Substring(2, 1);
if ((id_1 == cdk.Text.Substring(0, 6)) && (cdk.Text.Length == 16))
if(cdk.Text.Length != 16)
{
System.Windows.MessageBox.Show("CDKEY: 无效注册码", "ERR", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
if (id_1 == cdk.Text.Substring(0, 6))
{
if (CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(cdk.Text.Substring(0, 12)), true) == cdk.Text.Substring(12, 4)) //校验key的crc校验值
{