示例#1
0
        private void button5_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtDecodeImageLocation.Text.Length > 0)
                {
                    TP_File file = TP_Stenography.DecodeImage((Bitmap)Bitmap.FromFile(txtDecodeImageLocation.Text), txtDecodeKey.Text);
                    saveFileDialog2.FileName = file.GetFileName();

                    DialogResult d = saveFileDialog2.ShowDialog();
                    if (d == DialogResult.OK)
                    {
                        file.Save(saveFileDialog2.FileName);
                    }

                    MessageBox.Show("File Extracted!", "2pix", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch
            {
                MessageBox.Show("There was an error extracting a file from this image.\nPossbile causes include:\n\n" +
                                " - Invalid decryption key\n - Image does not contain any hidden files\n - Image was corrupted", "2pix",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        protected void UploadFiles(object sender, EventArgs e)
        {
            string strFile = upload_1.FileName;

            if (upload_1.HasFile)
            {
                var path = Path.Combine("uf", upload_1.FileName);
                try
                {
                    upload_1.PostedFile.SaveAs(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path));
                    _tpRepository.AddFile(TP_File.Create(GetId(), path));
                    _uow.Commit();
                }
                catch { }
            }
            var strSPContractorID = GetId();

            if (strSPContractorID > 0)
            {
                StringBuilder strMessenger = new StringBuilder("");
                var           subject      = _tpRepository.Get(strSPContractorID);
                if (subject != null)
                {
                    foreach (var each in subject.Files.OrderByDescending(x => x.Id))
                    {
                        strMessenger.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString());
                    }
                    pnlUploads.Controls.Add(new LiteralControl(strMessenger.ToString()));
                }
            }
        }
示例#3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                string fileName = textBox1.Text;
                string key      = textBox2.Text;

                string dest = fileName.Substring(0, fileName.LastIndexOf("\\")) + "\\";

                if (File.Exists(fileName))
                {
                    TP_File file = TP_Stenography.DecodeImage((Bitmap)Bitmap.FromFile(fileName), key);

                    // Get the original file name, but don't overwrite anything
                    string name = dest + file.GetFileName();
                    if (File.Exists(name))
                    {
                        name = dest + "2pix_" + file.GetFileName();
                    }

                    file.Save(name);
                }

                MessageBox.Show("The file was extracted!", "2pix",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.Close();
            }
            catch
            {
                MessageBox.Show("There was an error extracting a file from this image.\nPossbile causes include:\n\n" +
                                " - Invalid decryption key\n - Image does not contain any hidden files\n - Image was corrupted", "2pix",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                this.Close();
            }
        }
示例#4
0
 void ITPRepository.AddFile(TP_File TP_File)
 {
     _context.Insert(TP_File);
 }