public void AddProxy(GoProxy proxy) { lock (Proxies) { Proxies.Add(proxy); } }
public GoProxy GetRandomProxy() { if (Proxies == null) { return(null); } List <GoProxy> availableProxies = new List <GoProxy>(); lock (Proxies) { availableProxies = Proxies.Where(x => x.MaxConcurrentFails > x.CurrentConcurrentFails && x.MaxAccounts > x.CurrentAccounts && !x.IsBanned).ToList(); if (availableProxies.Count == 0) { return(null); } GoProxy returnProxy = availableProxies[GetRandom(0, availableProxies.Count)]; ProxyUsed(returnProxy, true); return(returnProxy); } }
public void MarkProxy(GoProxy proxy, bool isBanned = true) { lock (proxy) { proxy.IsBanned = isBanned; } }
public void IncreaseFailCounter(GoProxy proxy) { lock (proxy) { ++proxy.CurrentConcurrentFails; } }
public void ResetFailCounter(GoProxy proxy) { lock (proxy) { proxy.CurrentConcurrentFails = 0; } }
public void RemoveProxy(GoProxy proxy) { lock (Proxies) { Proxies.Remove(proxy); } }
public bool AddProxy(GoProxy proxy) { lock (Proxies) { return(Proxies.Add(proxy)); } }
public void ResetFailCounter(GoProxy proxy) { if (proxy != null) { proxy.ClearFailCounter(); } }
public void ProxyUsed(GoProxy proxy, bool addition = true) { lock (proxy) { if (addition) { ++proxy.CurrentAccounts; } else { --proxy.CurrentAccounts; } } }
private void fastObjectListViewProxies_FormatCell(object sender, BrightIdeasSoftware.FormatCellEventArgs e) { GoProxy proxy = (GoProxy)e.Model; if (e.Column == olvColumnCurrentFails) { if (proxy.CurrentConcurrentFails == 0) { e.SubItem.ForeColor = Color.Green; } else if (proxy.CurrentConcurrentFails > 0) { e.SubItem.ForeColor = Color.Yellow; } else if (proxy.CurrentConcurrentFails >= proxy.MaxConcurrentFails) { e.SubItem.ForeColor = Color.Red; } } else if (e.Column == olvColumnTimeOut) { e.SubItem.ForeColor = proxy.CoolDownTimer.IsRunning ? Color.Red : Color.Green; } else if (e.Column == olvColumnUsageCount) { if (proxy.CurrentCreations == 0) { e.SubItem.ForeColor = Color.Green; } else if (proxy.CurrentCreations <= proxy.MaxCreations) { e.SubItem.ForeColor = Color.Yellow; } else { e.SubItem.ForeColor = Color.Red; } } else if (e.Column == olvColumnStatu) { e.SubItem.ForeColor = proxy.GetStatusColor(); } }
public bool AddProxy(string data) { ProxyEx proxy = null; if (!ProxyEx.TryParse(data, out proxy)) { return(false); } GoProxy goProxy = new GoProxy { Address = proxy.Address, Password = proxy.Password, Port = proxy.Port, Username = proxy.Username }; return(AddProxy(goProxy)); }