public static List<ProxyInfo> ScrapePublicLists() { string list = scrapePublicLists(); string[] proxies = list.Split(new[] { Environment.NewLine },StringSplitOptions.None); List<ProxyInfo> ProxyList = new List<ProxyInfo>(); foreach(string proxy in proxies) { if (String.IsNullOrWhiteSpace(proxy)) continue; string[] ipPort = proxy.Split(':'); HttpToSocks5Proxy socks5 = new HttpToSocks5Proxy(ipPort[0], Convert.ToInt32(ipPort[1])); ProxyInfo proxyCheck = new ProxyInfo(socks5, ipPort); ProxyList.Add(proxyCheck); } return ProxyList; }
private List <ProxyInfo> importProxies() { List <ProxyInfo> ProxyList = new List <ProxyInfo>(); if (!File.Exists(FILEPATH)) { return(ProxyList); } string[] lines = File.ReadAllLines(FILEPATH); foreach (string line in lines) { string[] ipPort = line.Split(':'); HttpToSocks5Proxy socks5 = new HttpToSocks5Proxy(ipPort[0], Convert.ToInt32(ipPort[1])); ProxyInfo proxyCheck = new ProxyInfo(socks5, ipPort); ProxyList.Add(proxyCheck); } Console.WriteLine(ProxyList.Count + " proxies have been imported."); return(ProxyList); }