コード例 #1
0
        // The methods that do the work.
        private void OpenFileToHide()
        {
            openFileDialogSourceFile.Filter   = "All files (*.*)|*.*";
            openFileDialogSourceFile.FileName = "";

            if (openFileDialogSourceFile.ShowDialog() == DialogResult.OK)
            {
                buttonSelectRawImage.Enabled             = true;
                imageToEncodeToolStripMenuItem.Enabled   = true;
                generateFractalToolStripMenuItem.Enabled = true;

                byte[] sourceFile = File.ReadAllBytes(openFileDialogSourceFile.FileName);
                fi = new FileInformation(openFileDialogSourceFile.SafeFileName, sourceFile);

                labelFileInfo.Text = fi.FileName + "\n" + fi.FileName.Length + " characters in file name. \n" + fi.FileContents.Length + " bytes in file. ";

                // Calculate header size.
                headerLength = (16 + 4 + 4 + (fi.FileName.Length * 8));

                estimatedBytes       = (((fi.FileContents.Length) + headerLength));
                labelEstEncSize.Text = estimatedBytes.ToString();
                fp = new FormPassword(this);
                fp.Show();
                buttonGenerateFractal.Enabled = true;
                tabControl.SelectTab(0);
            }
        }
コード例 #2
0
        private void OpenImageToDecode()
        {
            if (openFileDialogSourceFile.ShowDialog() == DialogResult.OK)
            {
                encImg = (Bitmap)Image.FromFile(openFileDialogSourceFile.FileName);
                pictureBoxEncodedImage.Image    = encImg;
                pictureBoxEncodedImage.SizeMode = PictureBoxSizeMode.Zoom;

                fp = new FormPassword(this);
                fp.ShowDialog();

                buttonRetrieveFile.Enabled = true;
                retrieveFileFromImageToolStripMenuItem.Enabled = true;
                tabControl.SelectTab(1);
            }
        }