private void VerificationRegistration() { if (EnDe.ReadAk() == null) { EnDe.WriteAk(EnDe.DESEncrypt(DateTime.Now.ToString(), "1q2w3e4r", "11111111")); } }
private void Registration() { string text = EnDe.DESDecrypt(EnDe.ReadAk(), "1q2w3e4r", "11111111"); string EnCPU = EnDe.GetCPU(); if (EnCPU != text) { TimeSpan ts1 = new TimeSpan(DateTime.Now.Ticks); TimeSpan ts2 = new TimeSpan(DateTime.Now.Ticks);; try { ts2 = new TimeSpan(DateTime.Parse(text).Ticks); } catch { //MessageBox.Show("注册文件错误,请购买正版!"); System.Environment.Exit(0); } TimeSpan tSpan = ts1 - ts2; int Day = (int)tSpan.TotalDays; if (Day > 300) { //MessageBox.Show("系统试用结束,请购买正版!"); System.Environment.Exit(0); } else if (Day < 0) //可能用户向后调整了时间 { EnDe.WriteAk(EnDe.DESEncrypt("asdf", "1q2w3e4r", "11111111")); //MessageBox.Show("注册文件错误,请购买正版!"); System.Environment.Exit(0); } else { //MessageBox.Show("系统还可试用" + (30 - Day) + "天!"); } } }