Esempio n. 1
0
        private void btnClearProxy_Click(object sender, EventArgs e)
        {
            objProxyForm = this;
            List<ProxyInfo> objProxyList = BaseConfig.GetBaseConfig().ProxyList;
            objProxyInfoListOK = new List<ProxyInfo>();

            CheckingProxy objCheckingProxy = new CheckingProxy(objProxyList, objProxyForm,tbTryUrl.Text,tbCharset.Text,tbSuccessText.Text);
            ThreadStart checkingThreadDelegate = new ThreadStart(objCheckingProxy.ExecuteChecking);
            threadCount = 5;
            finishedThreadCount = 0;
            checkThreads = new Thread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                checkThreads[i] = new Thread(checkingThreadDelegate);
                checkThreads[i].Name = i.ToString();
                checkThreads[i].Start();
            }
            ThreadStart ojbWriteXmlDelegate = new ThreadStart(objCheckingProxy.WriteCheckedProxy);
            Thread objWriteThread = new Thread(ojbWriteXmlDelegate);
            objWriteThread.Start();

            //foreach (Thread checkThread in checkThreads)
            //{

            //}
            //Utility.Utility.ClearXmlProxyList();

            //Utility.Utility.WriteProxyListToXml(objProxyList);
        }
Esempio n. 2
0
        private void btnClearProxy_Click(object sender, EventArgs e)
        {
            objProxyForm = this;
            List <ProxyInfo> objProxyList = BaseConfig.GetBaseConfig().ProxyList;

            objProxyInfoListOK = new List <ProxyInfo>();

            CheckingProxy objCheckingProxy       = new CheckingProxy(objProxyList, objProxyForm, tbTryUrl.Text, tbCharset.Text, tbSuccessText.Text);
            ThreadStart   checkingThreadDelegate = new ThreadStart(objCheckingProxy.ExecuteChecking);

            threadCount         = 5;
            finishedThreadCount = 0;
            checkThreads        = new Thread[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                checkThreads[i]      = new Thread(checkingThreadDelegate);
                checkThreads[i].Name = i.ToString();
                checkThreads[i].Start();
            }
            ThreadStart ojbWriteXmlDelegate = new ThreadStart(objCheckingProxy.WriteCheckedProxy);
            Thread      objWriteThread      = new Thread(ojbWriteXmlDelegate);

            objWriteThread.Start();

            //foreach (Thread checkThread in checkThreads)
            //{

            //}
            //Utility.Utility.ClearXmlProxyList();

            //Utility.Utility.WriteProxyListToXml(objProxyList);
        }
Esempio n. 3
0
 public CheckingProxy(List <ProxyInfo> proxyInfoList, ProxyForm proxyForm, string testPageUrl, string testPageCharset, string testPageSuccessText)
 {
     m_ProxyForm           = proxyForm;
     m_ProxyInfoList       = proxyInfoList;
     m_TestPageUrl         = testPageUrl;
     m_TestPageCharset     = testPageCharset;
     m_TestPageSuccessText = testPageSuccessText;
 }
Esempio n. 4
0
        private void btnGetProxy_Click(object sender, EventArgs e)
        {
            objProxyForm = this;

            List <ProxyGetInfo> objProxyGetList = new List <ProxyGetInfo>();

            objProxyGetList = ProxyGetConfig.GetProxyGetPageUrlList();
            string returnData;

            foreach (ProxyGetInfo objProxyGetInfo in objProxyGetList)
            {
                objProxyForm.SetText(string.Format("Url:{0}分析开始\r\n", objProxyGetInfo.PageUrl));
                returnData = Conn.GetData(objProxyGetInfo.PageUrl, objProxyGetInfo.Charset, objProxyGetInfo.PageUrl, 10000, null, null);
                if (cbxDebugMode.Checked == true)
                {
                    tbMessage.Text += string.Format("{0}\r\n", returnData);
                }
                else
                {
                    RegexFunc rFunc = new RegexFunc();
                    System.Text.RegularExpressions.MatchCollection m = rFunc.GetMatchFull(returnData, objProxyGetInfo.Regex);
                    List <ProxyInfo> objProxyList = new List <ProxyInfo>();
                    foreach (System.Text.RegularExpressions.Match objMatch in m)
                    {
                        ProxyInfo objProxyInfo = new ProxyInfo();
                        objProxyInfo.Address = objMatch.Groups[1].Value.Split(':')[0];
                        objProxyInfo.Port    = int.Parse(objMatch.Groups[1].Value.Split(':')[1]);
                        objProxyInfo.Name    = "暂无";
                        objProxyList.Add(objProxyInfo);
                        tbMessage.Text += string.Format("获得地址:{0}:{1}\r\n", objProxyInfo.Address, objProxyInfo.Port);
                    }

                    Utility.Utility.WriteProxyListToXml(objProxyList);
                }
            }
        }
Esempio n. 5
0
        private void btnProxySet_Click(object sender, EventArgs e)
        {
            ProxyForm objForm = new ProxyForm();

            objForm.Show();
        }
Esempio n. 6
0
        private void btnGetProxy_Click(object sender, EventArgs e)
        {
            objProxyForm = this;

            List<ProxyGetInfo> objProxyGetList = new List<ProxyGetInfo>();
            objProxyGetList = ProxyGetConfig.GetProxyGetPageUrlList();
            string returnData;
            
            foreach (ProxyGetInfo objProxyGetInfo in objProxyGetList)
            {

                objProxyForm.SetText(string.Format("Url:{0}分析开始\r\n",objProxyGetInfo.PageUrl));
                returnData = Conn.GetData(objProxyGetInfo.PageUrl, objProxyGetInfo.Charset,objProxyGetInfo.PageUrl,10000,null,null);
                if (cbxDebugMode.Checked == true)
                {
                    tbMessage.Text += string.Format("{0}\r\n", returnData);
                }
                else
                {
                    RegexFunc rFunc = new RegexFunc();
                    System.Text.RegularExpressions.MatchCollection m = rFunc.GetMatchFull(returnData, objProxyGetInfo.Regex);
                    List<ProxyInfo> objProxyList = new List<ProxyInfo>();
                    foreach (System.Text.RegularExpressions.Match objMatch in m)
                    {
                        ProxyInfo objProxyInfo = new ProxyInfo();
                        objProxyInfo.Address = objMatch.Groups[1].Value.Split(':')[0];
                        objProxyInfo.Port = int.Parse(objMatch.Groups[1].Value.Split(':')[1]);
                        objProxyInfo.Name = "暂无";
                        objProxyList.Add(objProxyInfo);
                        tbMessage.Text += string.Format("获得地址:{0}:{1}\r\n", objProxyInfo.Address, objProxyInfo.Port);
                    }

                    Utility.Utility.WriteProxyListToXml(objProxyList);
                }
            }
        }
Esempio n. 7
0
 public CheckingProxy(List<ProxyInfo> proxyInfoList, ProxyForm proxyForm, string testPageUrl, string testPageCharset, string testPageSuccessText)
 {
     m_ProxyForm = proxyForm;
     m_ProxyInfoList = proxyInfoList;
     m_TestPageUrl = testPageUrl;
     m_TestPageCharset = testPageCharset;
     m_TestPageSuccessText = testPageSuccessText;
 }
Esempio n. 8
0
 private void btnProxySet_Click(object sender, EventArgs e)
 {
     ProxyForm objForm = new ProxyForm();
     objForm.Show();
 }