using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
namespace RuralHosesInvestigation.Authorization
{
public class RegisterForm : Form
{
private IContainer icontainer_0;
private Label label1;
private TextBox txtCpuId;
private Label label2;
private TextBox txtRegisterNum;
private Button btnRegister;
protected override void Dispose(bool disposing)
{
if (disposing && this.icontainer_0 != null)
{
this.icontainer_0.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent()
{
this.label1 = new Label();
this.txtCpuId = new TextBox();
this.label2 = new Label();
this.txtRegisterNum = new TextBox();
this.btnRegister = new Button();
base.SuspendLayout();
this.label1.AutoSize = true;
this.label1.Location = new Point(13, 16);
this.label1.Name = "label1";
this.label1.Size = new Size(53, 12);
this.label1.TabIndex = 0;
this.label1.Text = "机器码:";
this.txtCpuId.Location = new Point(72, 13);
this.txtCpuId.Name = "txtCpuId";
this.txtCpuId.ReadOnly = true;
this.txtCpuId.Size = new Size(232, 21);
this.txtCpuId.TabIndex = 1;
this.label2.AutoSize = true;
this.label2.Location = new Point(13, 43);
this.label2.Name = "label2";
this.label2.Size = new Size(53, 12);
this.label2.TabIndex = 0;
this.label2.Text = "注册码:";
this.txtRegisterNum.Location = new Point(72, 40);
this.txtRegisterNum.Name = "txtRegisterNum";
this.txtRegisterNum.Size = new Size(232, 21);
this.txtRegisterNum.TabIndex = 1;
this.btnRegister.Location = new Point(72, 68);
this.btnRegister.Name = "btnRegister";
this.btnRegister.Size = new Size(67, 23);
this.btnRegister.TabIndex = 2;
this.btnRegister.Text = "注册";
this.btnRegister.UseVisualStyleBackColor = true;
this.btnRegister.Click += new EventHandler(this.btnRegister_Click);
base.AutoScaleDimensions = new SizeF(6f, 12f);
base.AutoScaleMode = AutoScaleMode.Font;
base.ClientSize = new Size(316, 100);
base.Controls.Add(this.btnRegister);
base.Controls.Add(this.txtRegisterNum);
base.Controls.Add(this.label2);
base.Controls.Add(this.txtCpuId);
base.Controls.Add(this.label1);
base.FormBorderStyle = FormBorderStyle.FixedToolWindow;
base.Name = "RegisterForm";
this.Text = "农房调查软件注册";
base.ResumeLayout(false);
base.PerformLayout();
}
public RegisterForm()
{
this.InitializeComponent();
this.txtCpuId.Text = Class16.smethod_2() + Class16.smethod_3();
if (!Class16.Boolean_0)
{
if (Class16.Boolean_1)
{
this.txtRegisterNum.Text = Class16.String_0;
this.btnRegister.Text = "升级授权";
}
return;
}
this.txtRegisterNum.Text = Class16.String_0;
this.btnRegister.Text = "已注册";
this.btnRegister.Enabled = false;
}
private void btnRegister_Click(object sender, EventArgs e)
{
string text = this.txtRegisterNum.Text.Trim();
if (string.IsNullOrEmpty(text))
{
MessageBox.Show("请输入注册码!");
return;
}
if (text == RegisterForm.smethod_0(this.txtCpuId.Text))
{
Class16.smethod_6(text);
MessageBox.Show("注册成功!");
this.btnRegister.Text = "已注册";
this.btnRegister.Enabled = false;
return;
}
if (!(text == RegisterForm.smethod_1(this.txtCpuId.Text)))
{
MessageBox.Show("注册码不正确,注册失败!");
return;
}
Class16.smethod_7(text);
MessageBox.Show("注册成功,您现在已是高级用户!");
this.btnRegister.Text = "升级授权";
}
private static string smethod_0(string string_0)
{
byte[] byte_ = RegisterForm.smethod_2(string_0);
byte[] byte_2 = RegisterForm.smethod_3(byte_, "Sj170319");
byte[] value = RegisterForm.smethod_5(byte_2);
return BitConverter.ToString(value).Replace("-", "");
}
private static string smethod_1(string string_0)
{
byte[] byte_ = RegisterForm.smethod_2(string_0);
byte[] byte_2 = RegisterForm.smethod_3(byte_, "Aza17052");
byte[] value = RegisterForm.smethod_5(byte_2);
return BitConverter.ToString(value).Replace("-", "");
}
private static byte[] smethod_2(string string_0)
{
byte[] bytes = Encoding.UTF8.GetBytes(string_0);
for (int i = 0; i < bytes.Length; i++)
{
byte b = bytes[i];
byte b2 = b / 16;
byte b3 = b % 16;
switch (i % 4)
{
case 1:
b3 = 15 - b3;
break;
case 2:
b2 = 15 - b2;
break;
case 3:
b2 = 15 - b2;
b3 = 15 - b3;
break;
}
if (i % 2 != 0)
{
bytes[i] = b3 * 16 + b2;
}
else
{
bytes[i] = b2 * 16 + b3;
}
}
if (bytes.Length > 1)
{
byte b4 = bytes[0] / 16;
byte b5 = bytes[bytes.Length - 1] % 16;
bytes[0] = b5 * 16 + b4;
for (int j = 1; j < bytes.Length; j++)
{
byte b6 = bytes[j - 1] % 16;
byte b7 = bytes[j] / 16;
bytes[j] = b6 * 16 + b7;
}
return bytes;
}
return bytes;
}
private static byte[] smethod_3(byte[] byte_0, string string_0)
{
byte[] bytes = Encoding.UTF8.GetBytes(string_0);
byte[] rgbIV = bytes;
DESCryptoServiceProvider dESCryptoServiceProvider = new DESCryptoServiceProvider();
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, dESCryptoServiceProvider.CreateEncryptor(bytes, rgbIV), CryptoStreamMode.Write);
cryptoStream.Write(byte_0, 0, byte_0.Length);
cryptoStream.FlushFinalBlock();
return memoryStream.ToArray();
}
private static string smethod_4(string string_0, string string_1)
{
byte[] bytes = Encoding.UTF8.GetBytes(string_1);
byte[] rgbIV = bytes;
byte[] array = Convert.FromBase64String(string_0);
DESCryptoServiceProvider dESCryptoServiceProvider = new DESCryptoServiceProvider();
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, dESCryptoServiceProvider.CreateDecryptor(bytes, rgbIV), CryptoStreamMode.Write);
cryptoStream.Write(array, 0, array.Length);
cryptoStream.FlushFinalBlock();
return Encoding.UTF8.GetString(memoryStream.ToArray());
}
private static byte[] smethod_5(byte[] byte_0)
{
MD5 mD = new MD5CryptoServiceProvider();
return mD.ComputeHash(byte_0);
}
}
}
跪求更改的机制,或者怎么做和注册机啊,谢谢
跪谢!!!!!
[培训]内核驱动高级班,冲击BAT一流互联网大厂工作,每周日13:00-18:00直播授课