Public Class Form1
Dim percent = 0
Dim red
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
percent = (ListBox2.Items.Count / ListBox1.Items.Count) * 100
If (ListBox1.SelectedIndex < ListBox1.Items.Count - 1) Then
ProgressBar1.Value = percent
Label2.Text = "Scanning for: " & ListBox1.SelectedItem
ListBox2.Items.Add("Scanning: " & ListBox1.SelectedItem)
Try
If Dir(ListBox1.SelectedItem.ToString) <> "" Then
ListBox3.Items.Add("Threat Found: " & ListBox1.SelectedItem.ToString)
ElseIf Dir(ListBox1.SelectedItem.ToString, FileAttribute.Hidden) <> "" Then
ListBox3.Items.Add("Threat Found: " & ListBox1.SelectedItem.ToString)
Else
End If
Catch ex As Exception
End Try
ListBox1.SelectedIndex += 1
Else
If ListBox1.Items.Count - 1 >= 1 Then
ListBox3.SelectedIndex = 0
Button3.Enabled = True
End If
Timer1.Stop()
ProgressBar1.Value = 100
Label2.Text = "Finished Scanning. " & ListBox3.Items.Count & "Threat found!"
Button2.Enabled = False
Button1.Enabled = True
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.Enabled = False
Button2.Enabled = False
Button3.Enabled = False
ComboBox1.SelectedItem = 0
ComboBox1.Items.AddRange(System.IO.Directory.GetLogicalDrives)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Value = 0
ListBox2.Items.Clear()
ListBox3.Items.Clear()
percent = 0
Button1.Enabled = False
ListBox1.SelectedItem = 0
Timer1.Start()
Button2.Enabled = True
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex >= 1 Then
ListBox1.Items.Clear()
ListBox1.Text = My.Resources.VirusList.ToString
For Each line As String In TextBox1.Lines
ListBox1.Items.Add(ComboBox1.SelectedItem.ToString & line.ToString)
Next
If ListBox1.Items.Count - 1 >= 0 Then
Label1.Text = "DataBase Loaded!"
Button1.Enabled = True
Else
Label1.Text = "No DataBase Loaded!"
Button1.Enabled = False
End If
Else
Button1.Enabled = False
ListBox1.Items.Clear()
TextBox1.Text = ""
Label1.Text = "No DataBase Loaded!"
End If
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Label1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.TextChanged
red = Replace(ListBox3.SelectedItem.ToString, "Threat Found: ", "")
Try
System.IO.File.Delete(red)
If Dir(red) <> "" Then
MsgBox("Unable to delete " & red, MsgBoxStyle.Critical)
Else
MsgBox("File " & red & " Successfully Deleted", MsgBoxStyle.Critical)
ListBox3.Items.Remove(ListBox3.SelectedItem)
End If
Catch ex As Exception
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If ListBox3.Items.Count - 1 >= 0 Then
ListBox3.Enabled = True
Button3.Enabled = True
Else
Button3.Enabled = False
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
If ListBox3.Items.Count - 1 >= 0 Then
ListBox3.SelectedIndex = 0
Button3.Enabled = True
End If
Button2.Enabled = False
Button1.Enabled = True
End Sub
End Class