Beispiel #1
0
        /// <summary>
        /// Select a bitmap file as stago file
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_browseStego_Click(object sender, EventArgs e)
        {
            using (Status status = new Status(null, this.lbl_status, "Open stego file"))
            {
                try
                {
                    string path = AppUtil.SelectFile("Open stego file", "Bitmap (*.bmp)|*.bmp|AVI (*.avi)|*.avi|WAV (*.wav)|*.wav", "bmp").ToLower();

                    if (!string.IsNullOrEmpty(path))
                    {
                        this.txt_stegoObject.Text = path;

                        ///Dispose the previous processor
                        if (this._processor != null)
                        {
                            this._processor.Dispose();
                        }

                        this._processor = StegoProcessorBase.GetProcessor(path, false);
                        this._processor.LoadHost(path, true);

                        if (this._processor.MType == HostMediaType.Bitmap)
                        {
                            ///Let show the pic in preview box. Open the image by giving the path
                            ///The size mode of this image is set to zoom. So if the image is bigger then the
                            ///frame it will automatically adjust it to fit the frame. Same happens if it is smaller
                            ///then the frame
                            this.pic_stegoPreview.Image = new System.Drawing.Bitmap(this.txt_stegoObject.Text);
                        }
                        else if (this._processor.MType == HostMediaType.Wave)
                        {
                            this.pic_stegoPreview.Image = global::HideIt.Properties.Resources.wav;
                        }
                        else
                        {
                            ///setup the Avi icon image
                            this.pic_stegoPreview.Image = global::HideIt.Properties.Resources.avi;
                        }
                    }
                }
                catch (Exception exc)
                {
                    UIMessage.Error(exc.Message, TITLE);

                    if (this._processor != null)
                    {
                        try
                        {
                            this._processor.Dispose();
                        }
                        catch (Exception)
                        {
                        }
                        this._processor = null;
                    }
                }
            }
        }
Beispiel #2
0
        private void LoadProcessor(string path)
        {
            this._processor = StegoProcessorBase.GetProcessor(path, false);
            if (this._processor == null)
            {
                return;
            }

            this._processor.LoadHost(path, true);

            if (this._processor.MType != HostMediaType.Video)
            {
                this.cb_watermark.Enabled = false;
            }

            if (this._processor.MType == HostMediaType.Bitmap)
            {
                ///Show the bitmap summary control
                BitmapSummary summaryControl = new BitmapSummary();
                this._currentControl = summaryControl;
                this.ShowNewSummaryControl(summaryControl);

                ///Display cover file size
                summaryControl.HostSize = this.ToSize(this._processor.HostSize);

                ///Save and display hiding capacity of cover object
                this._hidingCapacity          = (int)this._processor.HidingCapacity / 2;
                summaryControl.HidingCapacity = this.ToSize(this._hidingCapacity);

                ///Setup the maximum length of message
                this.rtxt_message.MaxLength = this._hidingCapacity - (Stego.Message.MAX_KEY_LEN + 8);

                ///Let show the pic in preview box. Open the image by giving the path
                ///The size mode of this image is set to zoom. So if the image is bigger then the
                ///frame it will automatically adjust it to fit the frame. Same happens if it is smaller
                ///then the frame
                this.pic_coverPreview.Image = new System.Drawing.Bitmap(this.txt_coverFileName.Text);
            }
            else if (this._processor.MType == HostMediaType.Wave)
            {
                ///Show the bitmap summary control
                WaveSummary summaryControl = new WaveSummary();
                this._currentControl = summaryControl;
                this.ShowNewSummaryControl(summaryControl);

                Wave host = (Wave)this._processor.HostObject;

                ///Display number of channels
                summaryControl.Channels = host.Format.nChannels.ToString();

                ///Display samples/sec
                summaryControl.SamplesPerSec = host.Format.nSamplesPerSec.ToString();

                ///Save and display hiding capacity of cover object
                this._hidingCapacity          = (int)this._processor.HidingCapacity / 2;
                summaryControl.HidingCapacity = this.ToSize(this._hidingCapacity);

                ///Setup the maximum length of message
                this.rtxt_message.MaxLength = this._hidingCapacity - (Stego.Message.MAX_KEY_LEN + 8);

                ///Setup the Avi icon image in the preview box
                this.pic_coverPreview.Image = global::HideIt.Properties.Resources.wav;
            }
            else
            {
                if (this.cb_watermark.Checked)
                {
                    this.LoadWatermarkingStegoProcessor();
                }
                else
                {
                    this.LoadAviStegoProcessor();
                }
            }
        }
Beispiel #3
0
        private void LoadWatermarkingStegoProcessor()
        {
            try
            {
                ///Reduce the message length to 256 character
                if (this.cb_watermark.Checked)
                {
                    ///Change summary controls
                    WatermarkSummary summaryControl = new WatermarkSummary();
                    this._currentControl = summaryControl;
                    this.ShowNewSummaryControl(summaryControl);

                    if (this._processor != null)
                    {
                        try
                        {
                            this._processor.Dispose();
                        }
                        catch (Exception)
                        {
                        }
                        this._processor = null;
                    }

                    this._processor = StegoProcessorBase.GetProcessor(this.txt_coverFileName.Text, true);
                    if (this._processor == null)
                    {
                        return;
                    }
                    this._processor.LoadHost(this.txt_coverFileName.Text, true);

                    WatermarkingStegoProcessor processor = (WatermarkingStegoProcessor)this._processor;

                    ///Display the length of video
                    summaryControl.VideoLength = processor.Length.ToString() + " sec";

                    ///Display the framerate
                    summaryControl.FrameRate = processor.FrameRate.ToString();

                    ///Display the dimensions
                    summaryControl.Dimension = processor.Width.ToString() + " x " + processor.Height.ToString() + " px";

                    ///Display the hiding capacity
                    this._hidingCapacity = (int)processor.HidingCapacity / 2;

                    this.rtxt_message.MaxLength = WATERMARK_LEN;

                    ///If there is already text in text box
                    if (rtxt_message.Text.Length > WATERMARK_LEN)
                    {
                        DialogResult result = UIMessage.Ask(this, @"Enabling watermarking allows only " + WATERMARK_LEN.ToString() + " characters for hiding.\r\n"
                                                            + "The current length of message is " + this.rtxt_message.Text.Length.ToString() + ".\r\n"
                                                            + "Do you wish to automatically strip the mssage to " + WATERMARK_LEN.ToString() + " characters?",
                                                            TITLE);

                        if (result == DialogResult.Yes)
                        {
                            this.rtxt_message.Text = this.rtxt_message.Text.Substring(0, WATERMARK_LEN - 1);
                        }
                        else
                        {
                            this.cb_watermark.Checked = false;
                        }
                    }
                }
                else
                {
                    this.LoadProcessor(this.txt_coverFileName.Text);
                }
            }
            catch (Exception exc)
            {
                UIMessage.Error(exc.Message, TITLE);
                if (this._processor != null)
                {
                    try
                    {
                        this._processor.Dispose();
                    }
                    catch (Exception)
                    {
                    }
                    this._processor = null;
                }
            }
        }