Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;
            Crittografia steg             = new Crittografia(_bytes, null);
            string       _DecryptedString = steg.Decrypt().Replace("<EOS>", "");

            if (!_DecryptedString.Contains("Errore"))
            {
                richTextBox2.Text = _DecryptedString;
                button2.Enabled   = false;
            }
            else
            {
                MessageBox.Show(_DecryptedString, "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            button2.Enabled = false;
            if (richTextBox1.Text.Length > 0 && !richTextBox1.Text.Contains("<EOS>"))
            {
                Crittografia steg           = new Crittografia(_bytes, richTextBox1.Text + "<EOS>");
                string       _CryptedString = steg.Crypt();

                if (!_CryptedString.Contains("Errore"))
                {
                    _Cryptedbytes = GetBytes(_CryptedString);

                    try
                    {
                        using (MemoryStream ms = new MemoryStream(_Cryptedbytes))
                        {
                            FileStream file = new FileStream(_outpath, FileMode.Create, FileAccess.Write);
                            ms.WriteTo(file);
                            file.Close();
                        }
                    }catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }


                    axWindowsMediaPlayer1.URL = _outpath;
                    button1.Enabled           = false;
                }
                else
                {
                    MessageBox.Show(_CryptedString, "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Inserisci un testo valido", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }