Example #1
0
 private void encryptButton_Click(object sender, EventArgs e)
 {
     if (currentMode == Mode.Image && image != null)
     {
         Bitmap encrypted;
         if (random.Checked || randomM2.Checked)
         {
             encrypted = Test1.InsertEncryptedTextToImage(image, textBox.Text);
         }
         else
         {
             encrypted = Test1.InsertEncryptedTextToImageLinear(image, textBox.Text);
         }
         if (encrypted != null)
         {
             saveDialog.FileName = "*.*";
             DialogResult res = saveDialog.ShowDialog();
             if (res == System.Windows.Forms.DialogResult.OK)
             {
                 encrypted.Save(saveDialog.FileName);
                 OutputConsole.Write("Image saved");
             }
         }
     }
     if (currentMode == Mode.Audio && audio != null)
     {
         byte[] file;
         if (random.Checked)
         {
             file = AudioSteganography.EncryptText(audio, textBox.Text);
         }
         else
         {
             file = AudioSteganography.EncryptTextLinear(audio, textBox.Text);
         }
         if (file != null)
         {
             DialogResult res = saveWav.ShowDialog();
             if (res == System.Windows.Forms.DialogResult.OK)
             {
                 File.WriteAllBytes(saveWav.FileName, file);
                 OutputConsole.Write("Wav file saved");
             }
         }
     }
 }