|
|
|
@ -43,29 +43,38 @@ namespace SUNLIGHT_CDKEY |
|
|
|
|
|
|
|
private void Tb_KeyFloating_D(object sender, TextCompositionEventArgs e)//输入事件
|
|
|
|
{ |
|
|
|
d = int.Parse(T_D.Text); |
|
|
|
//Regex re = new Regex("[^0-9.-]+");
|
|
|
|
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
|
|
|
|
e.Handled = !re.IsMatch(e.Text); |
|
|
|
if(d>30)T_D.Text = "30"; |
|
|
|
d = int.Parse(T_D.Text); |
|
|
|
if (d > 30) |
|
|
|
{ |
|
|
|
T_D.Text = "30"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void Tb_KeyFloating_Y(object sender, TextCompositionEventArgs e)//输入事件
|
|
|
|
{ |
|
|
|
y = int.Parse(T_Y.Text); |
|
|
|
//Regex re = new Regex("[^0-9.-]+");
|
|
|
|
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
|
|
|
|
e.Handled = !re.IsMatch(e.Text); |
|
|
|
if (y > 2099) T_Y.Text = "2099"; |
|
|
|
y = int.Parse(T_Y.Text); |
|
|
|
if (y > 2099) |
|
|
|
{ |
|
|
|
T_Y.Text = "2099"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void Tb_KeyFloating_M(object sender, TextCompositionEventArgs e)//输入事件
|
|
|
|
{ |
|
|
|
m = int.Parse(T_M.Text); |
|
|
|
//Regex re = new Regex("[^0-9.-]+");
|
|
|
|
Regex re = new Regex(@"^[.][0-9]+$|^[0-9]*[.]{0,1}[0-9]*$");// 非负浮点数
|
|
|
|
e.Handled = !re.IsMatch(e.Text); |
|
|
|
if (m > 12) T_M.Text = "12"; |
|
|
|
m = int.Parse(T_M.Text); |
|
|
|
if (m > 12) |
|
|
|
{ |
|
|
|
T_M.Text = "12"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void DURATION_DropDownClosed(object sender, EventArgs e) |
|
|
|
@ -101,6 +110,8 @@ namespace SUNLIGHT_CDKEY |
|
|
|
else if (DURATION.Text == "FOREVER") |
|
|
|
{ |
|
|
|
y = 2099; |
|
|
|
m = 12; |
|
|
|
d = 30; |
|
|
|
} |
|
|
|
if (m > 12) |
|
|
|
{ |
|
|
|
@ -118,6 +129,10 @@ namespace SUNLIGHT_CDKEY |
|
|
|
string a; |
|
|
|
string b, my, mm, md; |
|
|
|
|
|
|
|
d = int.Parse(T_D.Text); |
|
|
|
y = int.Parse(T_Y.Text); |
|
|
|
m = int.Parse(T_M.Text); |
|
|
|
|
|
|
|
sn_id.Text = sn_id.Text.ToUpper(); |
|
|
|
|
|
|
|
if (sn_id.Text.Length < 6)//id字节长度大于6有效
|
|
|
|
@ -137,7 +152,7 @@ namespace SUNLIGHT_CDKEY |
|
|
|
md = Convert.ToString(Convert.ToInt32(255 - d), 16).ToUpper(); |
|
|
|
b=my+mm+md; |
|
|
|
|
|
|
|
cdk.Text = a + b + CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(b), true); |
|
|
|
cdk.Text = a + b + CRCcheck16.ToCRC16(CRCcheck16.StringToHexByte(a+b), true); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|