async void doExtract() { try { progressBarExtract.Value = 0; btnBrowse.Enabled = false; btnEmbed.Enabled = false; btnExtract.Enabled = false; btnExtract.Text = "Proces..."; st.Reset(); st.Start(); string msg = await Task.Run(() => LSB.Extract(img2)); richTextBox2.Text = msg; lblExtract.Text = "Extract Time : " + st.Elapsed; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { btnBrowse.Enabled = true; btnExtract.Enabled = true; btnEmbed.Enabled = true; btnExtract.Text = "Embed"; st.Stop(); } }
async void doEmbed() { try { progressBarEmbed.Value = 0; btnBrowse.Enabled = false; btnEmbed.Enabled = false; btnExtract.Enabled = false; btnEmbed.Text = "Proces..."; st.Reset(); st.Start(); string msg = richTextBox1.Text; img2 = await Task.Run(() => LSB.Embed(img1, msg)); pictureBox2.Image = Pixel.ScaledBitmap(img2, pictureBox2.Size); lblEmbed.Text = "Embed Time : " + st.Elapsed; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { btnBrowse.Enabled = true; btnExtract.Enabled = true; btnEmbed.Enabled = true; btnEmbed.Text = "Embed"; st.Stop(); } }
static void Main(string[] args) { for (int i = 0; i < args.Length; i++) { args[i] = args[i].ToLower(); } //parse the command line arguments if (args.Length == 0) { Console.WriteLine("No arguments were entered type --help for help with usage"); } else if (args[0] == "--help" || args[0] == "-help" || args[0] == "help") { Menu(); } else if (args[0] == "--e" || args[0] == "-e" || args[0] == "-e") { if (args.Length < 4) { Console.WriteLine("Invalid Number of arguments type --help for help"); } else if (args.Length == 5 && (args[4] == "--p" || args[4] == "-p" || args[4] == "p")) { LSB.Encode(args[1], args[2], args[3], true); } else { LSB.Encode(args[1], args[2], args[3]); } } else if (args[0] == "--d" || args[0] == "-d" || args[0] == "d") { if (args.Length < 3) { Console.WriteLine("Invalid Number of arguments type --help for help"); } else if (args.Length == 4 && (args[3] == "--p" || args[3] == "-p" || args[3] == "p")) { LSB.Decode(args[1], args[2], true); } else { LSB.Decode(args[1], args[2]); } } else if (args[0] == "--xor" || args[0] == "-xor" || args[0] == "xor") { if (args.Length < 4) { Console.WriteLine("Invalid Number of arguments type --help for help"); } else { Xor.XorImages(args[1], args[2], args[3]); } } else { Console.WriteLine("Arguments are not valid type --help for help with arguments"); } }