示例#1
0
        private void buttonDecode_Click(object sender, EventArgs e)
        {
            try
            {
                switch (algorithm)
                {
                case Algorithm.Base64Unicode:
                    textBoxDecode.Text = TranString.DecodeBase64Unicode(textBoxEncode.Text);
                    break;

                case Algorithm.Base64:
                    textBoxDecode.Text = TranString.DecodeBase64(textBoxEncode.Text);
                    break;

                case Algorithm.UrlEncode:
                    textBoxDecode.Text = TranString.DecodeUrlDecode(textBoxEncode.Text);
                    break;

                case Algorithm.AES:
                    textBoxDecode.Text = TranString.DecodeAES(textBoxEncode.Text, textBoxKey.Text);
                    break;

                case Algorithm.Rijndael:
                    textBoxDecode.Text = TranString.DecodeRijndael(textBoxEncode.Text, textBoxRijndaelKey.Text, textBoxRijndaelVector.Text);
                    break;

                default:
                    throw new ArgumentOutOfRangeException($"algorithm : {algorithm}");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }