private void btn_encrypt_Click(object sender, EventArgs e) { Output.Output output = new Output.Output(); Encrypt.Encrypt encrypt = new Encrypt.Encrypt(); Encrypt.EncryptedPackage package = new Encrypt.EncryptedPackage(); if (File_Upload.Checked) // if its a file upload it will pass the file name otherwise the file name is null { try { package = encrypt.EncyptText(response); output.Textorfile(package.text, package.key, "file", filename); File.Delete(OriginalFileName); response = null; MessageBox.Show("Your text has been encrypted successfuly and the uploaded file has been deleted", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Your text has not been encrypted because an error has occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { try { response = Input_textbox.Text; response = response.Replace("\r\n", null); package = encrypt.EncyptText(response); output.Textorfile(package.text, package.key, "textbox", null); } catch { MessageBox.Show("Your text has not been encrypted because an error has occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
static void Main(string[] args) { string response = "Hi my ~name is jacob ouellet. I live in Raymond NH, and I am a CIS major at MCC."; Encrypt test = new Encrypt(); EncryptedPackage x = new EncryptedPackage(); x = test.EncyptText(response); Console.WriteLine(x.key); Console.WriteLine(x.text); Console.ReadLine(); }