public static bool CheckCode(string mCode, string regCode,string key)
 {
     try
     {
         if (mCode.Length < 10)
         {
             return false;
         }
         if (regCode.Length < 10)
         {
             return false;
         }
         char[] mCodeL = mCode.ToCharArray();
         char tmp = mCodeL[1];
         mCodeL[1] = mCodeL[mCodeL.Length - 2];
         mCodeL[mCodeL.Length - 2] = tmp;
         HardwareInfo h = new HardwareInfo();
         string dCode = h.DD(regCode, key);
         if (dCode == new string(mCodeL))
         {
             return true;
         }
         return false;
     }
     catch
     {
         return false;
     }
 }
        private void btnOK_Click(object sender, EventArgs e)
        {
            string regCode = txtRegCode.Text.Trim();
            string mCode   = this.txtMCode.Text.Trim();

            if (string.IsNullOrEmpty(regCode))
            {
                MessageBox.Show("请输入注册码!");
                return;
            }
            if (HardwareInfo.CheckCode(mCode, regCode, Form1.GameName))
            {
                Regedit.SetAppRegKeyValue(Form1.RegistryDirName, "RegCode", regCode);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("无效注册码!");
                txtRegCode.Text = "";
                txtRegCode.Focus();
                return;
            }
        }