Example #1
0
        private void btnCurrSave_Click(object sender, EventArgs e)
        {
            if (currCrawller != null)
            {
                currCrawller.Title              = txtCurrTitle.Text;
                currCrawller.Description        = txtCurrDescription.Text;
                currCrawller.SiteUrl            = txtCurrSiteUrl.Text;
                currCrawller.Group              = txtCurrGroup.Text;
                currCrawller.PlanTime           = txtCurrPlanTime.Text;
                currCrawller.MaxCount           = int.Parse(txtCurrMaxCount.Text);
                currCrawller.ExistCompareFields = txtCurrExistCompareFields.Text;
                if (!string.IsNullOrWhiteSpace(txtMaxEndTime.Text))
                {
                    currCrawller.MaxEndTime = int.Parse(txtMaxEndTime.Text);
                }
                currCrawller.IsCrawlAll         = chkCurrCrawlAll.Checked;
                currCrawller.Enabled            = chkCurrEnabled.Checked;
                currCrawller.ExistsUpdate       = chkCurrExistsUpdate.Checked;
                currCrawller.ExistsHtlCtx       = chkUpdateCtx.Checked;
                currCrawller.ExistsUpdateAttach = chkUpdateAttach.Checked;
                ToolComm.UpdateNodeConfigs(currNode, false);

                ToolComm.SaveConfigs(treCrawlers);
            }
        }
Example #2
0
        public void InitTreeView()
        {
            AppendText("初始化信息抓取选项数据......");

            ToolComm.InitCrawller(treCrawlers);

            BindSertchList();

            AppendText("初始化完成。");
        }
Example #3
0
        /// <summary>
        /// 启动定时抓取程序
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnBegin_Click(object sender, EventArgs e)
        {
            dictTimerCrawllers.Clear();

            int count = 0;
            Dictionary <string, WebSiteCrawller> crawllers = ToolComm.GetEnabledCrawllers(treCrawlers);

            foreach (string key in crawllers.Keys)
            {
                count++;
                WebSiteCrawller crawller = crawllers[key];

                if (dictTimerCrawllers.ContainsKey(crawller.PlanTime))
                {
                    dictTimerCrawllers[crawller.PlanTime].Add(crawller);
                }
                else
                {
                    List <WebSiteCrawller> list = new List <WebSiteCrawller>();
                    list.Add(crawller);
                    dictTimerCrawllers.Add(crawller.PlanTime, list);
                }
            }

            if (count == 0)
            {
                MessageBox.Show("请选择要抓取的选项!");
                return;
            }

            ToolComm.SaveConfigs(treCrawlers);

            timer.AutoReset = true;
            timer.Enabled   = true;
            timer.Interval  = 60 * 1000; //1分钟执行一次
            timer.Elapsed  += new System.Timers.ElapsedEventHandler(timer_Tick);
            AppendText("开始抓取数据......");
            BtnBegin.Enabled = false;
            grpCurr.Enabled  = false;
        }
Example #4
0
 private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
 {
     ToolComm.SaveConfigs(treCrawlers);
 }