[C#] 纯文本查看 复制代码
private void LicenseVerify()
{
int year = this.Function("Convert.ToInt32", "2000");
int month = this.Function("Convert.ToInt32", "1");
int day = this.Function("Convert.ToInt32", "1");
DateTime d = new DateTime(year, month, day);
x_Const.Today = (DateTime.Today - d).Days;
if (x_Const.Today < this.fld_pluginDate)
{
return;
}
List<string> list = new List<string>();
bool flag = false;
if (!File.Exists(x_Const.LicenseFile))
{
RegistryKey registryKey = Registry.CurrentUser.CreateSubKey(this.fld_regDir);
string text = Convert.ToString(registryKey.GetValue(this.fld_Key));
if (text == string.Empty)
{
int arg = x_Const.Today + x_Const.FreeDays;
text = string.Concat(new string[]
{
this.SubKey(x_Const.HDD_id),
"#",
this.Function("ToString", arg),
"#",
this.Function("ToString", x_Const.Today),
"#1#",
x_Const.FreeDays.ToString(),
"#012#1#"
});
text = this.CheckSumm(text) + "#" + text;
text = this.Crypt(text, x_Const.HDD_id, this.Function("Convert.ToInt32", "0"));
}
list.Add(text);
}
else
{
StreamReader streamReader = new StreamReader(x_Const.LicenseFile);
flag = true;
while (!streamReader.EndOfStream)
{
list.Add(streamReader.ReadLine());
}
streamReader.Close();
}
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
string text2 = "";
int num5 = 0;
string value = "#";
string text3 = "";
for (int i = 0; i < list.Count; i++)
{
int num6 = list[i].IndexOf("+");
string text4 = list[i];
if (num6 > 0)
{
text3 = text4.Substring(num6 + 1);
text4 = text4.Substring(0, num6);
}
int num7 = this.Function("Convert.ToInt32", "1");
num7 = this.Function("minus", i, num7);
text4 = this.Crypt(text4, x_Const.HDD_id, num7);
int num8 = text4.IndexOf(value);
string a = text4.Substring(0, num8);
string text5 = text4.Substring(num8 + 1);
if (!(a != this.CheckSumm(text5)))
{
num8 = text5.IndexOf(value);
string a2 = text5.Substring(0, num8);
if (!(a2 != this.SubKey(x_Const.HDD_id)))
{
text5 = text5.Substring(num8 + 1);
num8 = text5.IndexOf(value);
string arg2 = text5.Substring(0, num8);
num2 = this.Function("Convert.ToInt32", arg2);
text5 = text5.Substring(num8 + 1);
num8 = text5.IndexOf(value);
arg2 = text5.Substring(0, num8);
num3 = this.Function("Convert.ToInt32", arg2);
text5 = text5.Substring(num8 + 1);
num8 = text5.IndexOf(value);
arg2 = text5.Substring(0, num8);
x_Const.WorkedDay = this.Function("Convert.ToInt32", arg2);
text5 = text5.Substring(num8 + 1);
num8 = text5.IndexOf(value);
arg2 = text5.Substring(0, num8);
num4 = this.Function("Convert.ToInt32", arg2);
text5 = text5.Substring(num8 + 1);
num8 = text5.IndexOf(value);
text2 = text5.Substring(0, num8);
text5 = text5.Substring(num8 + 1);
num8 = text5.IndexOf(value);
arg2 = text5.Substring(0, num8);
num5 = this.Function("Convert.ToInt32", arg2);
num = i;
break;
}
}
}
if (flag && text3 == "")
{
x_Debug.ShowMessage("Используется старая версия лицензии, необходимо установить новую.\nПо всем вопросам Вы всегда можите обратиться к разработчику [email]office@xplugins.com[/email]");
return;
}
if (x_Const.Today != num3)
{
int num9 = this.Function("plus", x_Const.Today, num3);
num9 = this.Function("abs", num9, num4);
x_Const.WorkedDay = this.Function("minus", x_Const.WorkedDay, num9);
}
if (num5 == this.Function("Convert.ToInt32", "0"))
{
x_Const.WorkedDay = this.Function("shiftL", num4, num3);
}
if (num2 < x_Const.Today)
{
x_Const.WorkedDay = this.Function("shiftL", num4, x_Const.WorkedDay);
}
if (num2 < this.fld_pluginDate)
{
x_Const.WorkedDay = this.Function("shiftL", num4, x_Const.Today);
}
if (this.Function("Convert.ToInt32", "0") < x_Const.WorkedDay && x_Const.WorkedDay < num4)
{
x_Const.LicenseVerified = this.Function("Convert.ToInt32", "1");
}
else
{
x_Const.WorkedDay = this.Function("abs", num4, x_Const.Today);
num5 = this.Function("Convert.ToInt32", "0");
}
text3 = x_ConstByte.LicenseVerify(text3);
list[num] = string.Concat(new string[]
{
this.SubKey(x_Const.HDD_id),
"#",
this.Function("ToString", num2),
"#",
this.Function("ToString", x_Const.Today),
"#",
this.Function("ToString", x_Const.WorkedDay),
"#",
this.Function("ToString", num4),
"#",
text2,
"#",
this.Function("ToString", num5),
"#"
});
list[num] = this.CheckSumm(list[num]) + "#" + list[num];
list[num] = this.Crypt(list[num], x_Const.HDD_id, this.Function("Convert.ToInt32", "0"));
if (!File.Exists(x_Const.LicenseFile))
{
RegistryKey registryKey2 = Registry.CurrentUser.CreateSubKey(this.fld_regDir);
registryKey2.SetValue(this.fld_Key, list[num]);
}
else
{
StreamWriter streamWriter = new StreamWriter(x_Const.LicenseFile);
List<string> list2;
int index;
(list2 = list)[index = num] = list2[index] + "+" + text3;
foreach (string value2 in list)
{
streamWriter.WriteLine(value2);
}
streamWriter.Close();
}
x_Const.DaysLeft = this.Function("plus", num4, x_Const.WorkedDay);
if (x_Const.DaysLeft < 0)
{
x_Const.DaysLeft = 0;
}
}