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

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

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

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

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

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