CDKEY保存逻辑修改
This commit is contained in:
commit
8a4d7c6d4f
1 file changed
+35
-19
+35
-19
@@ -33,17 +33,17 @@ namespace formula_manage.Windows
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
string KEY;
|
||||
string SN;
|
||||
string cpuSerialNumber;
|
||||
string biosSerialNumber;
|
||||
|
||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
||||
|
||||
private void Window_CDKEY(object sender, RoutedEventArgs e) //打开页面
|
||||
{
|
||||
// 获取CPU序列号
|
||||
string cpuSerialNumber = HardwareSN.GetCPUSerialNumber();
|
||||
cpuSerialNumber = HardwareSN.GetCPUSerialNumber();
|
||||
// 获取主板序列号
|
||||
string biosSerialNumber = HardwareSN.GetBIOSSerialNumber();
|
||||
biosSerialNumber = HardwareSN.GetBIOSSerialNumber();
|
||||
// 获取硬盘序列号
|
||||
//string hardDiskSerialNumber = HardwareSN.GetHardDiskSerialNumber();
|
||||
// 获取网卡地址
|
||||
@@ -67,11 +67,11 @@ namespace formula_manage.Windows
|
||||
|
||||
string YY = DateTime.Now.ToString("yyyy");
|
||||
string MM = DateTime.Now.ToString("MM");
|
||||
string DD = DateTime.Now.ToString("dd");
|
||||
string DD = DateTime.Now.ToString("dd");
|
||||
|
||||
if (string.Compare(Y, YY) >= 0)
|
||||
if (string.Compare(Y, YY) == 0)
|
||||
{
|
||||
if (string.Compare(M, MM) >= 0)
|
||||
if (string.Compare(M, MM) == 0)
|
||||
{
|
||||
if (string.Compare(D, DD) >= 0)
|
||||
{
|
||||
@@ -79,24 +79,40 @@ namespace formula_manage.Windows
|
||||
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
|
||||
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||
Configini.IniWritevalue("SN", " SN1", id_1);
|
||||
Configini.IniWritevalue("SN", " SN2", cdk.Text.Substring(6, 2));
|
||||
Configini.IniWritevalue("SN", " SN3", cdk.Text.Substring(8, 2));
|
||||
Configini.IniWritevalue("SN", " SN4", cdk.Text.Substring(10, 2));
|
||||
Configini.IniWritevalue("SN", " SN1", cdk.Text);
|
||||
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY:overdue");
|
||||
else if(string.Compare(M, MM) > 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY:OK");
|
||||
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
|
||||
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||
Configini.IniWritevalue("SN", " SN1", cdk.Text);
|
||||
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY:overdue");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY:overdue");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (string.Compare(Y, YY) > 0)
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY:overdue");
|
||||
System.Windows.MessageBox.Show("CDKEY:OK");
|
||||
sn_time.Text = "CDkeyDueTime: " + Y + "-" + M + "-" + D;
|
||||
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||
Configini.IniWritevalue("SN", " SN1", cdk.Text);
|
||||
Configini.IniWritevalue("SN", " SN2", MD5check.MD5Encrypt16(cpuSerialNumber + biosSerialNumber));
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Windows.MessageBox.Show("CDKEY:overdue");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user