Exemplo n.º 1
0
        private void ImportFile_Click_1(object sender, EventArgs e)
        {
            Bitmap databasePng = new Bitmap(Image.FromFile(this.selectedFileLocation)); // create Bitmap from the selected image file

            // PULL DATA FROM IMAGE TO STRING
            string data = StegImportExport.extractText(databasePng); // create string which will contain data pulled from image

            stegTextRecieved.Text = data;

            //CONVERT STRING TO ENCRYPTED COMPRESSED DATABASE FILE
            //using (SaveFileDialog saveFile = new SaveFileDialog()) {
            //    saveFile.Filter = "Password Database Files (*.csv.gz) | *.csv.gz"; // save file only as .csv.gz file, which we use for databases
            //    saveFile.InitialDirectory = "c:\\"; // start search in the C drive

            //    if (saveFile.ShowDialog() == DialogResult.OK) {
            //        File.WriteAllText(saveFile.FileName.ToString(), data); // write data to the database file if save is successful
            //    }
            //}
        }
Exemplo n.º 2
0
        private void ExportFile_Click_1(object sender, EventArgs e)
        {
            // HERE WE COMPRESS AND ENCRYPT THE DATABASE FILE :)

            // LOAD IMAGE AND USE ALGORITHM TO CREATE IMAGE WITH DATABASE HELD WITHIN
            //Console.WriteLine(File.ReadAllText(FileOP.GetFile()));
            //string data = File.ReadAllText(FileOP.GetFile());

            Bitmap png     = new Bitmap(Image.FromFile(this.selectedFileLocation));
            Bitmap stegPng = StegImportExport.embedText(stegTextInfo.Text.ToString(), png);



            //----------SAVE STEG IMAGE WHERE SELECTED-----------
            using (SaveFileDialog saveFile = new SaveFileDialog()) {
                saveFile.Filter           = "Image Files (*.png) | *.png";
                saveFile.InitialDirectory = "c:\\";

                if (saveFile.ShowDialog() == DialogResult.OK)
                {
                    stegPng.Save(saveFile.FileName.ToString());
                }
            }
        }