private void ButtonDecode_Click(object sender, EventArgs e)
        {
            var     selectedAlg = comboBoxAlgorithmus.SelectedIndex;
            ICrypto base64      = new Base64();
            ICrypto encrypter   = new Rijndael();
            ICrypto rot13       = new Rot13();

            if (entered == 1)
            {
                if (selectedAlg == 0)
                {
                    string decodedText = rot13.Decode(CodedTextBox.Text);
                    DecodedTextBox.Clear();
                    DecodedTextBox.Text = decodedText;
                }
                if (selectedAlg == 1)
                {
                    string decodedText = base64.Decode(CodedTextBox.Text);
                    DecodedTextBox.Clear();
                    DecodedTextBox.Text = decodedText;
                }
                if (selectedAlg == 2)
                {
                    string decodedText = encrypter.Decode(CodedTextBox.Text);
                    DecodedTextBox.Clear();
                    DecodedTextBox.Text = decodedText;
                }
            }
            else
            {
                MessageBox.Show("Es ist kein Algorithmus ausgewählt", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
 public void DecodeBasicTest()
 {
     TestObj.Decode("EBG13 rknzcyr.").ShouldBe("ROT13 example.");
     TestObj.Decode("Guvf vf zl svefg EBG13 rkprepvfr!").ShouldBe("This is my first ROT13 excercise!");
 }