Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //LicenseHelper.GenKey();
            LicenseHelper.GetPriKey();

            string guid = LicenseHelper.GetCpuId();


            string license = DateTime.Now.Date.ToString("yyyy-MM-dd") + LicenseHelper.GenLicense(guid);

            txtBoxLicense.Text = FileHelper.Encrypt(license, guid.Substring(0, 8));

            FileHelper.WriteToTextFile(txtBoxLicense.Text, "license.dat");
        }
Exemple #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            string licenseCode = FileHelper.Decrypt(FileHelper.ReadTextFile("License.dat"), LicenseHelper.GetCpuId().Substring(0, 8));

            richTextBox3.Text = licenseCode;

            LicenseHelper.GetPubKey();
            if (true == LicenseHelper.CheckLicense(licenseCode.Substring(10, licenseCode.Length - 10), LicenseHelper.GetCpuId()))
            {
                MessageBox.Show("正确");
            }
            else
            {
                MessageBox.Show("errro");
            }
        }