public IPProxyManager(bool autoIpCheck, int ipCheckWorkerCounts, params IIPProxyCartridge[] proxyCartridges)
        {
            ProxyBucket = new List <IPProxy>();

            IPCheckWorkerCounts = ipCheckWorkerCounts;
            ProxyCartridges     = proxyCartridges;

            foreach (var c in ProxyCartridges)
            {
                c.OnFreeIPProviderSourceCompleted += (s, e) =>
                {
                    if (ProxyCartridges.All(p => p.AgentStatus == IPProxyAgentStatusEnum.Completed))
                    {
                        OnFreeIPProviderSourcesCompleted?.Invoke(this,
                                                                 new FreeIPProviderSourcesCompletedEventArgs(ProxyCartridges.Sum(p => p.TotalPagesScraped)));
                    }
                    else
                    {
                        OnFreeIPProviderSourceCompleted?.Invoke(s,
                                                                new FreeIPProviderSourceCompletedEventArgs(e.TotalPages));
                    }
                };
                c.OnFreeIPProxiesReading += (s, e) => OnFreeIPProxiesReading?.Invoke(s, e);
                c.OnFreeIPProxiesParsed  += (s, e) =>
                {
                    foreach (var prx in e.IPProxies)
                    {
                        lock (ProxyBucket)
                        {
                            ProxyBucket.Add(prx);
                        }
                    }
                    ((IIPProxyCartridge)s).ClearProxyBucket();
                    OnFreeIPProxiesParsed?.Invoke(s, e);
                };
                c.OnFreeIPProxyParsed += (s, e) => OnFreeIPProxyParsed?.Invoke(s, e);
            }

            if (autoIpCheck)
            {
                RunChecker();
            }
        }
 public void InvokeEventFreeIPProxiesParsed(EventHandlers.FreeIPProxiesParsedEventArgs a)
 {
     OnFreeIPProxiesParsed?.Invoke(this, a);
 }