Exemplo n.º 1
0
        /// <summary>
        /// Apply steganography
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRun_Click(object sender, EventArgs e)
        {
            btnRun.Enabled = false;

            try
            {
                Bitmap result = steganolizer.ExecuteHide();

                string filename = (!string.IsNullOrEmpty(tbFilename.Text)) ? tbFilename.Text : DEFAULT_SAVE_FILENAME;
                result.Save(saveDestPath + "\\" + filename + ".jpg");

                Alerter.Info("Work done !" + Environment.NewLine + "Image saved at : " + saveDestPath);
            }
            catch (SourceImageWidthGreaterThanHost ex)
            {
                Alerter.Error(ex.Message);
            }
            catch (SourceImageHeightGreaterThanHost ex)
            {
                Alerter.Error(ex.Message);
            } finally
            {
                btnRun.Enabled = true;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Display a file dialog to get image.
        /// </summary>
        /// <param name="type"></param>
        private void DisplaySelectImage(IMG type)
        {
            DialogResult dialogResult = openFileDialogImage.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                try
                {
                    if (type.Equals(IMG.HOST))
                    {
                        steganolizer.HostImage = GetImageFromDialog();
                        tbHost.Text            = openFileDialogImage.FileName;
                    }
                    else if (type.Equals(IMG.SRC))
                    {
                        steganolizer.SrcImage = GetImageFromDialog();
                        tbSrc.Text            = openFileDialogImage.FileName;
                    }
                    else if (type.Equals(IMG.FIND))
                    {
                        steganolizer.ProbablyHostImage = GetImageFromDialog();
                        tbDetectImg.Text = openFileDialogImage.FileName;
                    }
                } catch (Exception ex) {
                    Alerter.Error("An error occured. Can not get image.");
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Find image into image
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRunDetection_Click(object sender, EventArgs e)
        {
            // tbDetectSaveFilename.Text - save filename
            btnRunDetection.Enabled = false;

            try
            {
                Bitmap result = steganolizer.ExecuteFind();

                string filename = (!string.IsNullOrEmpty(tbDetectSaveFilename.Text)) ? tbDetectSaveFilename.Text : DEFAULT_SAVE_FILENAME;
                result.Save(tbSavePathDetect.Text + "\\" + filename + ".jpg");

                Alerter.Info("Work done !" + Environment.NewLine + "Image saved at : " + saveDestPath);
            }
            catch (Exception ex)
            {
                Alerter.Error(ex.Message);
            }
            finally
            {
                btnRunDetection.Enabled = true;
            }
        }