private void btnHide_Click(object sender, System.EventArgs e)
        {
            //get a stream for the message to hide
            Stream messageStream = GetMessageStream();

            if (messageStream.Length == 0)
            {
                MessageBox.Show("Please enter a message or select a file.");
                txtMessageText.Focus();
            }
            else
            {
                this.Cursor = Cursors.WaitCursor;

                try{
                    //hide the message
                    CryptUtility.HideMessageInBitmap(messageStream, imagesHide, keys, chkSplitBytes.Checked);
                }catch (Exception ex) {
                    MessageBox.Show(ex.Message + "\nStackTrace: " + ex.StackTrace, "Exception");
                }

                this.Cursor = Cursors.Default;
            }
            messageStream.Close();
        }
Exemple #2
0
        private void btnHide_Click(object sender, System.EventArgs e)
        {
            Bitmap bitmap = (Bitmap)picImage.Image;

            //get a stream for the message to hide
            Stream messageStream = GetMessageStream();

            if (messageStream.Length == 0)
            {
                MessageBox.Show("Please enter a message or select a file.");
                txtMessageText.Focus();
            }
            else
            {
                //get a stream fot the key
                Stream keyStream = GetKeyStream();
                if (keyStream.Length == 0)
                {
                    MessageBox.Show("Please enter a password or select a key file.");
                    txtKeyText.Focus();
                }
                else
                {
                    try{
                        //hide the message
                        CryptUtility.HideMessageInBitmap(messageStream, bitmap, keyStream, chkGrayscale.Checked);
                        //display result
                        picImage.Image        = bitmap;
                        btnSaveBitmap.Enabled = true;
                    }catch (Exception ex) {
                        MessageBox.Show("Exception:\r\n" + ex.Message);
                    }
                }
                keyStream.Close();
            }
            messageStream.Close();
            bitmap = null;
        }