using Microsoft.Win32; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace LLMF { public partial class FrmActive : Form { RegistryHelper registryHelper = new RegistryHelper(); RegistryKey localMachineRegistry = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32); public FrmActive() { InitializeComponent(); } private void btnActive_Click(object sender, EventArgs e) { string softTime = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftTime"); string softLastTime = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftLastTime"); string softParam6 = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam6"); string softParam1 = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam1"); string softParam2 = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam2"); string softParam3 = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam3"); string softParam4 = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam4"); string softParam5 = registryHelper.GetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam5"); string active = txtActive.Text; if (string.IsNullOrEmpty(active)) { return; } if (active == "7418259015") { if (softParam1 == "0") { if (softParam2 == "1") { SetOver("SoftParam2"); } if (softParam3 == "1") { SetOver("SoftParam3"); } if (softParam4 == "1") { SetOver("SoftParam4"); } if (softParam5 == "1") { SetOver("SoftParam5"); } Set("SoftParam1"); Close(); } else { MessageBox.Show("该激活码已使用"); return; } } if (active == "7886093651") { if (softParam2 == "0") { if (softParam1 == "1") { SetOver("SoftParam1"); } if (softParam3 == "1") { SetOver("SoftParam3"); } if (softParam4 == "1") { SetOver("SoftParam4"); } if (softParam5 == "1") { SetOver("SoftParam5"); } Set("SoftParam2"); Close(); } else { MessageBox.Show("该激活码已使用"); return; } } if (active == "3051805492") { if (softParam3 == "0") { if (softParam1 == "1") { SetOver("SoftParam1"); } if (softParam2 == "1") { SetOver("SoftParam2"); } if (softParam4 == "1") { SetOver("SoftParam4"); } if (softParam5 == "1") { SetOver("SoftParam5"); } Set("SoftParam3"); Close(); } else { MessageBox.Show("该激活码已使用"); return; } } if (active == "3085803765") { if (softParam4 == "0") { if (softParam1 == "1") { SetOver("SoftParam1"); } if (softParam2 == "1") { SetOver("SoftParam2"); } if (softParam3 == "1") { SetOver("SoftParam3"); } if (softParam5 == "1") { SetOver("SoftParam5"); } Set("SoftParam4"); Close(); } else { MessageBox.Show("该激活码已使用"); return; } } if (active == "3067035900") { if (softParam5 == "0") { if (softParam1 == "1") { SetOver("SoftParam1"); } if (softParam2 == "1") { SetOver("SoftParam2"); } if (softParam3 == "1") { SetOver("SoftParam3"); } if (softParam4 == "1") { SetOver("SoftParam4"); } Set("SoftParam5"); Close(); } else { MessageBox.Show("该激活码已使用"); return; } } if (active == "9975640068") { if (softParam6 == "0") { if (softParam1 == "1") { SetOver("SoftParam1"); } if (softParam2 == "1") { SetOver("SoftParam2"); } if (softParam3 == "1") { SetOver("SoftParam3"); } if (softParam4 == "1") { SetOver("SoftParam4"); } if (softParam5 == "1") { SetOver("SoftParam5"); } Set("SoftParam6"); Close(); } else { MessageBox.Show("该激活码已使用"); return; } } if (active == "9966775500") { Init(); Close(); } } public void Init() { registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftTime", DateTime.Now.ToString()); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftLastTime", DateTime.Now.ToString()); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam1", "0"); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam2", "0"); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam3", "0"); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam4", "0"); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam5", "0"); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftParam6", "0"); } public void Set(string name) { registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", name, "1"); registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", "SoftLastTime", DateTime.Now.ToString()); } public void SetOver(string name) { registryHelper.SetRegistryData(localMachineRegistry, "SOFTWARE\\TagReceiver", name, "2"); } } }