Advertisement
Guest User

Timer-1

a guest
Nov 26th, 2010
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  2.         ProgressBar1.Maximum = Conversions.ToString(ListBox1.Items.Count)
  3.         total.Text = Conversions.ToString(ListBox1.Items.Count)
  4.  
  5.         If Not ProgressBar1.Value = ProgressBar1.Maximum Then
  6.             Try
  7.  
  8.                 ListBox1.SelectedIndex = ListBox1.SelectedIndex + 1
  9.                 TextBox1.Text = ListBox1.SelectedItem.ToString
  10.             Catch ex As Exception
  11.             End Try
  12.  
  13.  
  14.  
  15.             Try
  16.  
  17.                 Dim scanbox As New TextBox
  18.                 Dim read As String = My.Computer.FileSystem.ReadAllText("viruslist.txt")
  19.                 ProgressBar1.Increment(1)
  20.                 Detected.Text = Conversions.ToString(ListBox2.Items.Count)
  21.                 files.Text = Conversions.ToString(ProgressBar1.Value)
  22.                 scanbox.Text = read.ToString
  23.                 Dim md5 As MD5CryptoServiceProvider = New MD5CryptoServiceProvider
  24.                 Dim f As FileStream = New FileStream(ListBox1.SelectedItem, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
  25.                 f = New FileStream(ListBox1.SelectedItem, FileMode.Open, FileAccess.Read, FileShare.Read, 8192)
  26.                 md5.ComputeHash(f)
  27.                 Dim hash As Byte() = md5.Hash
  28.                 Dim buff As StringBuilder = New StringBuilder
  29.                 Dim hashByte As Byte
  30.                 For Each hashByte In hash
  31.                     buff.Append(String.Format("{0:X2}", hashByte))
  32.                 Next
  33.  
  34.                 If scanbox.Text.Contains(buff.ToString) Then
  35.  
  36.  
  37.  
  38.                     ListBox2.Items.Add(ListBox1.SelectedItem)
  39.                 End If
  40.             Catch ex As Exception
  41.             End Try
  42.         Else
  43.             Timer1.Stop()
  44.             MsgBox("Finished Scanning Folder!")
  45.             TabControl1.SelectTab(3)
  46.             If ListBox1.Items.Count = 0 Then
  47.                 MsgBox("No Threats were detected, Scan Window will close!", MsgBoxStyle.Information)
  48.  
  49.             End If
  50.         End If
  51.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement