예제 #1
0
        public IProxyHandle GetProxyHandle(string className)
        {
            IProxyHandle handle = null;

            handles.TryGetValue(className, out handle);

            return(handle);
        }
예제 #2
0
        protected override void WebResponseHandle(string response, ICatchItem catchItem)
        {
            try
            {
                string className = (string)catchItem.Extend;

                IProxyHandle handle = proxyFactory.GetProxyHandle(className);

                if (handle == null)
                {
                    return;
                }

                List <Proxy> proxyList = handle.DoHandle(response);

                if (proxyList == null)
                {
                    return;
                }

                proxyList.ForEach(proxy =>
                {
                    httpUtil.VerifyProxy(proxy.Address, isSuccess =>
                    {
                        if (isSuccess)
                        {
                            proxyHelper.Add(proxy);
                            logger.InfoFormat("添加代理:{0}", proxy.Address.AbsoluteUri);
                        }
                    });
                });
            }
            catch (Exception ex)
            {
                logger.ErrorFormat("Error ProxyHandle:{0}", ex);
            }
        }