elezzark
07-16-2013, 07:13 PM
how do I make my proxies auto refresh every certain interval, i also have ProxyRefresh as a link label
Public Sub RefreshProxies()
Try
Dim oldCount As Integer = Proxies.Count
Proxies.Clear()
If Not File.Exists(My.Settings.ProxySource) Then
Using http As New Net.WebClient
Dim r As String = http.DownloadString(New Uri(My.Settings.ProxySource))
If Regex.IsMatch(r, "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}") Then
For Each m As Match In Regex.Matches(r, "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}")
Dim url As String = m.Groups(0).ToString
Proxies.Add(url)
Next
Proxies = Proxies.Distinct.ToList
End If
End Using
Else
Proxies.Clear()
Proxies = File.ReadAllLines(My.Settings.ProxySource).ToList
ProxyCount.Text = Proxies.Count.ToString("N0")
End If
Catch ex As Exception
Debug.Print(ex.Message)
Finally
ProxyCount.Text = Proxies.Count.ToString("N0")
End Try
End Sub
Public Sub RefreshProxies()
Try
Dim oldCount As Integer = Proxies.Count
Proxies.Clear()
If Not File.Exists(My.Settings.ProxySource) Then
Using http As New Net.WebClient
Dim r As String = http.DownloadString(New Uri(My.Settings.ProxySource))
If Regex.IsMatch(r, "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}") Then
For Each m As Match In Regex.Matches(r, "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}")
Dim url As String = m.Groups(0).ToString
Proxies.Add(url)
Next
Proxies = Proxies.Distinct.ToList
End If
End Using
Else
Proxies.Clear()
Proxies = File.ReadAllLines(My.Settings.ProxySource).ToList
ProxyCount.Text = Proxies.Count.ToString("N0")
End If
Catch ex As Exception
Debug.Print(ex.Message)
Finally
ProxyCount.Text = Proxies.Count.ToString("N0")
End Try
End Sub