04-18-2011, 10:21 AM
(This post was last modified: 04-18-2011, 11:27 AM by Resistance.)
My Submission:
Now this is what I call useful for something in the future. Great idea Infinity.
Spoiler (Click to View)
Screenshot:
Download Link:
Source Code:
Download Link:
Code:
http://www.mediafire.com/?cp96hb8n4wx4uhn
Code:
Public Class Form1
Public Function VerifyMD5HashCode(ByVal filepath As String) As String
Using verifythefile As New System.IO.FileStream(filepath, IO.FileMode.Open, IO.FileAccess.Read)
Using themd5code As New System.Security.Cryptography.MD5CryptoServiceProvider
Dim thahash() As Byte = themd5code.ComputeHash(verifythefile)
Return ByteArrayToString(thahash)
End Using
End Using
End Function
Private Function ByteArrayToString(ByVal arrInput() As Byte) As String
Dim StringBuilder As New System.Text.StringBuilder(arrInput.Length * 2)
For i As Integer = 0 To arrInput.Length - 1
StringBuilder.Append(arrInput(i).ToString("X2"))
Next
Return StringBuilder.ToString().ToLower
End Function
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
MD5Hash1.Text = VerifyMD5HashCode(filepath1.Text)
MD5Hash2.Text = VerifyMD5HashCode(filepath2.Text)
If filepath1.Text = filepath2.Text Then
MsgBox("The selected files are the same.", 64, "File Comparison Result")
TrueResults.Text = "Both Files Are Identical"
TrueResults.ForeColor = Color.LimeGreen
Else
MsgBox("The selected files are different.", 48, "File Comparison Result")
TrueResults.Text = "Both Files Are Unidentical"
TrueResults.ForeColor = Color.Red
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
SelectFiles.ShowDialog()
SelectFiles.Title = "Select File #1..."
End Sub
Private Sub SelectFiles_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SelectFiles.FileOk
Dim file1 As String = SelectFiles.FileName
filepath1.Text = file1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
SelectFiles2.ShowDialog()
SelectFiles2.Title = "Select File #2..."
End Sub
Private Sub SelectFiles2_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SelectFiles2.FileOk
Dim file2 As String = SelectFiles2.FileName
filepath2.Text = file2
End Sub
Private Sub filepath2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles filepath2.TextChanged
Button3.Enabled = True
End Sub
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
Process.Start("http://www.supportforums.net/member.php?action=profile&uid=4502")
End Sub
End Class
Now this is what I call useful for something in the future. Great idea Infinity.