#Region "Leech Proxies"
Dim T As New System.Threading.Thread(AddressOf Fetch)
'Leech Button
Private Sub btnLeech_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Leech_btn.Click
If Mini.Checked = False Then
If Website_list.Items.Count > 0 Then
T = New Thread(New ThreadStart(AddressOf Fetch))
T.Start()
CheckForIllegalCrossThreadCalls = False
Checker.Enabled = False
Home.Enabled = False
End If
Else
If Website_list.Items.Count > 0 Then
Proxies.Show()
Me.WindowState = FormWindowState.Minimized
Me.Visible = False
T = New Thread(New ThreadStart(AddressOf Fetch))
T.Start()
CheckForIllegalCrossThreadCalls = False
End If
End If
End Sub
'Open a bunch of new threads to download sources of webpages
Private Sub Fetch()
Dim Website As String
Dim websiteUri As Uri = Nothing
For I As Integer = 0 To Website_list.Items.Count - 1
SyncLock Me.Website_list.Items
Website = Me.Website_list.Items.Item(I)
End SyncLock
Using wc As Net.WebClient = New Net.WebClient
AddHandler wc.DownloadStringCompleted, AddressOf SourceDownloaded
If Uri.TryCreate(Website, UriKind.Absolute, websiteUri) Then
wc.DownloadStringAsync(New Uri(Website))
Else
If Notify.Checked = True Then
TrayIcon.ShowBalloonTip(1, "Invalid website", "There was a invalid site in the list." & Website.ToString, ToolTipIcon.Error)
Me.TrashSite_list.Items.Add(Website)
Else
Me.TrashSite_list.Items.Add(Website)
End If
End If
End Using
Next
End Sub
'Grab the proxies from the webpages
Private Sub SourceDownloaded(ByVal sender As Object, ByVal e As Net.DownloadStringCompletedEventArgs)
Dim strRegex As String = "\b(?

?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\:[0-9]{1,5}\b"
Dim myRegexOptions As RegexOptions = RegexOptions.None
Dim myRegex As New Regex(strRegex, myRegexOptions)
Dim frm As New Proxies
My.Settings.Proxies = New StringCollection
If e.Error Is Nothing Then
For Each myMatch As Match In myRegex.Matches(e.Result)
If myMatch.Success Then
Try
Proxy2_list.Items.Add(myMatch.ToString)
Proxy_list.Items.Add(myMatch.ToString)
Proxy2_lbl.Text = "Proxies: " & Proxy2_list.Items.Count
Proxy_lbl.Text = "Proxies: " & Proxy2_list.Items.Count
My.Settings.Proxies.Add(myMatch.ToString)
Catch ex As WebException
MessageBox.Show(
ex.ToString,
ErrorToString,
Windows.Forms.MessageBoxButtons.OK)
End Try
End If
Next
End If
End Sub
#End Region