Need Help With MD5 Treeview Scan!!
ok here it goes..... I currently have a program that I have been creating for quite some time. In the start I was using a listbox to populate the folders inside my selected directory. The listbox itterates down and the MD5 code checks each files Hash signature for virus but due to my large file system I have had to rethink how to go about scanning my directories as it takes to long to populate in a listview. The solution?....... Treeview!!!! but now im forced with the difficult task of replacing the listview with dirtreeview. I will post the code that I am working on. Thank you all in advance
Try
Using scanbox As New TextBox()
Dim read As String = My.Computer.FileSystem.ReadAllText("virusSig.txt")
ProgressBar1.Increment(1)
detected.Text = Conversions.ToString(CheckedListBox1.Items.Count)
files.Text = Conversions.ToString(ProgressBar1.Value)
scanbox.Text = read.ToString
Using md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider()
Dim f As FileStream = New FileStream(ListBox1.SelectedItem, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
f = New FileStream(ListBox1.SelectedItem, 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
If scanbox.Text.Contains(buff.ToString) Then
CheckedListBox1.Items.Add(ListBox1.SelectedItem)
End If
End Using
End Using
Catch ex As Exception
End Try
This code works great with listview but how can I get it to read with treeview?
I have had someone suggest to replace the listbox1.selecteditem with treeview.selectednode but errors unless i add .text or .tostring.......... can fullpath be used? im lost please help!
[Modified: added pre tags and properly formatted your code (added indents and spacing]