Pickaxe.Runtime.RuntimeBase.InitProxies C# (CSharp) Method

InitProxies() protected method

protected InitProxies ( ) : void
return void
        protected void InitProxies()
        {
            TotalOperations += Proxies.Length;

            if (Proxies.Length > 0)
            {
                var selector = new ProxySelector();

                foreach (var proxyString in Proxies)
                {
                    var proxy = Proxy.FromString(proxyString);
                    RequestFactory = HttpRequestFactory.CreateProxyFactory(proxy);
                    if (TestProxy())
                    {
                        Log.InfoFormat("Proxy added, Proxy={0}", proxy);
                        selector.Add(proxy);
                    }
                    else
                        Log.InfoFormat("Proxy failed, Proxy={0}", proxy);

                    OnProgress();
                }

                if (selector.ProxyCount == 0)
                {
                    Log.Info("No poxies pass test. Fail.");
                    Thread.CurrentThread.Abort();
                }

                RequestFactory = HttpRequestFactory.CreateProxySelector(selector);
            }
        }