Пример #1
0
        private void txtCode_TextChanged(object sender, EventArgs e)
        {
            if (boxChange)
            {
                return;
            }
            txtCode.Text = txtCode.Text.ToUpper();
            for (int i = 0; i < txtCode.Text.Length; i++)
            {
                if (txtCode.Text[i] != 'A' &&
                    txtCode.Text[i] != 'P' &&
                    txtCode.Text[i] != 'Z' &&
                    txtCode.Text[i] != 'L' &&
                    txtCode.Text[i] != 'G' &&
                    txtCode.Text[i] != 'I' &&
                    txtCode.Text[i] != 'T' &&
                    txtCode.Text[i] != 'Y' &&
                    txtCode.Text[i] != 'E' &&
                    txtCode.Text[i] != 'O' &&
                    txtCode.Text[i] != 'X' &&
                    txtCode.Text[i] != 'U' &&
                    txtCode.Text[i] != 'K' &&
                    txtCode.Text[i] != 'S' &&
                    txtCode.Text[i] != 'V' &&
                    txtCode.Text[i] != 'N')
                {
                    txtCode.Text = txtCode.Text.Remove(i, 1);
                    i--;
                }
            }
            txtCode.SelectionStart  = txtCode.Text.Length;
            txtCode.SelectionLength = 0;
            boxChange = true;
            if (txtCode.Text.Length == 6 || txtCode.Text.Length == 8)
            {
                txtAddress.Text = (GameGenie.ReverseCode(txtCode.Text) & 0xFFFF).ToString("X4");
                txtValue.Text   = ((GameGenie.ReverseCode(txtCode.Text) >> 16) & 0xFF).ToString("X2");
            }
            else
            {
                txtAddress.Text = "";
                txtValue.Text   = "";
            }

            boxChange = false;
        }