hey im working on a program that reads the hash of a new file there is created!
then if it match the database its say hash detected!
but first time i create a new file it works fine, but when i try to delete the file
its say the file is running in another program?
source:
Code:Private Sub fsw1_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles fsw1.Created Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider Dim f As FileStream = New FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 8192) f = New FileStream(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read, 8192) md5.ComputeHash(f) Dim hash As Byte() = md5.Hash Dim buff As StringBuilder = New StringBuilder Dim hashByte As Byte For Each hashByte In hash buff.Append(String.Format("{0:X2}", hashByte)) Next f.Close() Dim newtext As New TextBox Dim read As String = My.Computer.FileSystem.ReadAllText("database.db") newtext.Text = read If newtext.ToString.Contains(buff.ToString) Then MsgBox("hash detected") Else MsgBox("hash not detected!") End If End Sub




Reply With Quote
