示例#1
0
        private void hideMessageButton_Click(object sender, EventArgs e)
        {
            hideMessageButton.Text    = @"Hiding ...";
            hideMessageButton.Enabled = false;

            try {
                // Generate stego image
                _stegoImage = _embedder.HideMessage(
                    _carrier,
                    _message,
                    stegoPasswordTextbox.Text,
                    bppComboBox.SelectedIndex + 1,
                    bitPlaneFirstRadio.Checked
                    );

                // Fill labels with data
                stegoImageNameLabel.Text = _stegoImage.Name;
                stegoImageSizeLabel.Text = _defaultLabelValue;

                // Display image
                stegoImagePictureBox.Image = _stegoImage.Image;
            } catch (MessageTooBigException) {
                MessageBox.Show(
                    @"Could not hide the message since it is too big!",
                    @"Error!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            } catch (MessageNameTooBigException) {
                MessageBox.Show(
                    @"Could not hide the message since its file name is too long!",
                    @"Error!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            } catch (Exception ex) {
                MessageBox.Show(
                    @"The sysem caught an exception:"
                    + "\nType:        " + ex.GetType().Name
                    + "\nMessage:  " + ex.Message,
                    @"Critical error!",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error
                    );
            }

            // Check GUI components
            hideMessageButton.Text = @"Hide message";
            CheckEverything();
        }