Пример #1
0
        private void btnSelectFile_Click(object sender, EventArgs e)
        {
            if (btnFile.Checked)
            {
                if (ofdOpenFile.ShowDialog() == DialogResult.OK)
                {
                    txtString.ReadOnly = true;
                    txtString.Text     = "";

                    string fileName = ofdOpenFile.FileName;
                    txtFileName.Text = fileName;
                    txtMD5.Text      = FileHasher.MD5Hash(fileName);
                    txtSHA1.Text     = FileHasher.SHA1Hash(fileName);
                    txtSHA256.Text   = FileHasher.SHA256Hash(fileName);
                    txtSHA384.Text   = FileHasher.SHA384Hash(fileName);
                    txtSHA512.Text   = FileHasher.SHA512Hash(fileName);
                }
            }
        }
Пример #2
0
        private void MainForm_DragDrop(object sender, DragEventArgs e)
        {
            // Extract the data from the DataObject-Container into a string list
            string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);

            btnFile.Checked       = true;
            txtString.ReadOnly    = true;
            txtString.Text        = "";
            txtFileName.ReadOnly  = false;
            btnSelectFile.Enabled = true;


            // Do something with the data...
            txtFileName.Text     = FileList[0];
            ofdOpenFile.FileName = FileList[0];
            string fileName = ofdOpenFile.FileName;

            txtMD5.Text    = FileHasher.MD5Hash(fileName);
            txtSHA1.Text   = FileHasher.SHA1Hash(fileName);
            txtSHA256.Text = FileHasher.SHA256Hash(fileName);
            txtSHA384.Text = FileHasher.SHA384Hash(fileName);
            txtSHA512.Text = FileHasher.SHA512Hash(fileName);
        }
Пример #3
0
        private void btnCompare_Click(object sender, EventArgs e)
        {
            if (btnMd5.Checked && fileName != "")
            {
                hashvalue = FileHasher.MD5Hash(fileName);
                ShowMsg(hashvalue, txtHash.Text);
            }

            else if (btnSha1.Checked && fileName != null)
            {
                hashvalue = FileHasher.SHA1Hash(fileName);
                ShowMsg(hashvalue, txtHash.Text);
            }

            else if (btnSha256.Checked && fileName != null)
            {
                hashvalue = FileHasher.SHA256Hash(fileName);
                ShowMsg(hashvalue, txtHash.Text);
            }

            else if (btnSha384.Checked && fileName != null)
            {
                hashvalue = FileHasher.SHA384Hash(fileName);
                ShowMsg(hashvalue, txtHash.Text);
            }

            else if (btnSha512.Checked && fileName != null)
            {
                hashvalue = FileHasher.SHA512Hash(fileName);
                ShowMsg(hashvalue, txtHash.Text);
            }
            else
            {
                MessageBox.Show("Enter all datas");
            }
        }