private void button2_Click_1(object sender, EventArgs e)
        {
            string data = string.Empty;

            Encrypt("forever", ref data);
            RegistryOperate.WriteSubKey("zdsoftware", "permission", data);
        }
 private void button1_Click_2(object sender, EventArgs e)
 {
     try
     {
         string value = string.Empty;
         RegistryOperate.ReadSubKey("zdsoftware", "allow", ref value);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private string GetPermission()
        {
            string permission = string.Empty;

            RegistryOperate.ReadSubKey("zdsoftware", "permission", ref permission);
            if (!string.IsNullOrEmpty(permission))
            {
                string p = string.Empty;
                Decrypt(permission, ref p);
                permission = p;
            }
            return(permission);
        }
        private int GetRunTime()
        {
            string runtime = string.Empty;

            RegistryOperate.ReadSubKey("zdsoftware", "runtime", ref runtime);
            if (!string.IsNullOrEmpty(runtime))
            {
                string p = string.Empty;
                Decrypt(runtime, ref p);
                runtime = p;
                return(int.Parse(runtime));
            }
            return(0);
        }
        private void timer1_Tick(object sender, EventArgs e)
        {
            int runtime = GetRunTime();

            if (runtime >= RuntimeLimit)
            {
                timer1.Enabled = false;
                MessageBox.Show("产品已过试用期,请联系供应商进行处理", "提示");
                Application.Exit();
            }
            runtime += 1;
            string t = string.Empty;

            Encrypt(runtime.ToString(), ref t);
            RegistryOperate.WriteSubKey("zdsoftware", "runtime", t);
        }