public void callFinishEvent(proxyEventFinish e) { foreach (Action <proxyEventFinish> method in finEvents) { method(e); } }
public static void ProxyFinish(proxyEventFinish e) { Console.Clear(); print("======================"); print("Used: " + e.proxiesUsed); print("Successfull: " + e.proxiesSuccessfull); print("Failed: " + e.proxiesFailed); print("======================"); }
public void connectToSite(bool Threading, int threadLimit) { if (proxUseList) { if (Threading) { while (curProx < (proxyList.Count() - 1)) { Console.WriteLine(curProx < (proxyList.Count() - 1)); Console.WriteLine((proxyList.Count() - 1) - curProx); Console.WriteLine(threadsRan.Count()); if (activeThreads.Count < threadLimit && curProx < proxyList.Count()) { string s = proxyList.ElementAt(curProx); //Console.WriteLine(s); Thread t = new Thread(() => proxConnect(s, activeThreads.Count())); activeThreads.Add(t); threadsRan.Add(t); t.Start(); curProx += 1; } Thread.Sleep(100); } } else { foreach (string s in proxyList) { try { proxConnect(s); //return cli.DownloadString(url); } catch { } } } } else { try { proxConnect(prox); //return cli.DownloadString(url); } catch { } } abortThreads(); activeThreads.Clear(); Thread.Sleep(2000); proxyEventFinish pef = new proxyEventFinish(); pef.proxiesUsed = threadsRan.Count(); pef.proxiesSuccessfull = successfulProx.Count(); pef.proxiesFailed = failedProx.Count(); pef.proxFailedList = failedProx; pef.proxiesSuccessfullList = successfulProx; callFinishEvent(pef); }