本帖最后由 WinRose 于 2023-9-28 15:18 编辑
修改逻辑如下,实现自动注册:
[C#] 纯文本查看 复制代码 RemotePPT.About
------private void button2_Click(object sender, EventArgs e)------
{
RegBox regBox = new RegBox();
regBox.Location = new Point(base.Location.X + 10, base.Location.Y + 30);
if (regBox.ShowDialog() == DialogResult.OK)
{
string text = regBox.rName.Text.Trim();
string text2 = regBox.rEmail.Text.Trim();
string text3 = regBox.rCode.Text.Trim();
if (text.Length < 3 || text2.Length < 3 || text3.Length < 5)
{
return;
}
string text4 = text3.Substring(0, 1);
if (!(text4 == "1") && !(text4 == "2"))
{
return;
}
//修改此处的调用逻辑
this.setRegState2(text, text2, text3, DateTime.Now.ToString("yyyy-MM-dd"), "2");
this.RPForm.reCalReg();
this.reSetRegState();
}
}
------private int setRegState2(string RegName, string RegEmail, string RegCode, string RegDate, string RegMode)-------
if (RegMode == "2")
{
string text8 = "2005-02-25".Replace("-", "").Substring(2, 6);
for (int m = 0; m < 6; m++)
{
int num4 = int.Parse(text5.Substring(m, 1)) * int.Parse(text8.Substring(m, 1));
num4 %= 10;
text6 += text3.Substring(num4, 1);
}
if (text6 == RegCode.Trim().ToUpper())
{
this.label6.Text = infoStr.str_NoLimit;
this.edition.Text = infoStr.str_PE;
this.button2.Enabled = false;
this.button2.Text = infoStr.str_Actived;
num2 = 2;
}
else
{
//此处修改校验失败后自动用正确的激活码写入授权文件
this.label6.Text = infoStr.str_NoLimit;
this.edition.Text = infoStr.str_PE;
this.button2.Enabled = false;
this.button2.Text = infoStr.str_Actived;
num2 = 2;
CommonFuns.saveRegInfo("2" + text6, RegName, RegEmail, "2", CommonFuns.getUID(), DateTime.Now.ToString("yyyy-MM-dd"));
}
}
修改后,在激活界面输入以“2”开头的任意激活码(2开头为专业版,1开头为订阅版)
|