Exemplo n.º 1
0
 private void method_1(string[] string_3, string string_0)
 {
     for (int i = 0; i < (int)string_3.Length && !this.backgroundWorker_0.CancellationPending; i++)
     {
         NovelInfo novelInfo = new NovelInfo()
         {
             GetID = string_3[i],
             PutID = 0,
             Name  = ""
         };
         SpiderException.Show(200, Localization.Get("错误生成器生成错误"), novelInfo, true, string_0, this.tInfo.RuleFile);
     }
     base.Invoke(new EventHandler((object sender, EventArgs e) => {
         this.button_3.Enabled = true;
         this.label7.Text      = string.Concat(Localization.Get("已经生成错误日志"), (int)string_3.Length, Localization.Get("条"));
     }));
 }
        private void backgroundWorker_0_DoWork(object sender, DoWorkEventArgs e)
        {
            bool flag = false;

            if (this.BymeRad.Checked)
            {
                this.MinID = this.meminID;
                this.MaxID = this.memaxID;
                flag       = true;
            }
            int minID = this.MinID;

            while (minID <= this.MaxID)
            {
                if (this.backgroundWorker_0.CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }
                else
                {
                    NovelInfo novelInfo = new NovelInfo();
                    if (!flag)
                    {
                        novelInfo.GetID = minID.ToString();
                    }
                    else
                    {
                        Thread.Sleep(Convert.ToInt32(this.numericUpDown1.Value) * 1000);
                        NovelInfo novelInfo1 = new NovelInfo()
                        {
                            PutID = minID
                        };
                        try
                        {
                            SpiderException.Debug(Localization.Get("开始按本站ID获取信息并搜索目标站"));
                            Page page = new Page(this.rInfo, this.tInfo);
                            novelInfo1      = LocalProvider.GetInstance().GetNovelInfo(novelInfo1, this.tInfo.NameAndAuthor);
                            novelInfo1      = page.GetNovelInfo(novelInfo1);
                            novelInfo.GetID = novelInfo1.GetID;
                        }
                        catch (Exception exception1)
                        {
                            Exception exception = exception1;
                            object[]  putID     = new object[] { Localization.Get("根据本站ID:"), novelInfo1.PutID, Localization.Get("获取目标站ID时错误,请确认规则支持搜索 | "), exception.Message };
                            SpiderException.Show(string.Concat(putID), true);
                            this.backgroundWorker_0.ReportProgress(0, string.Concat(novelInfo1.PutID, " | ", exception.Message));
                        }
                    }
                    try
                    {
                        this.backgroundWorker_0.ReportProgress(0, novelInfo.GetID);
                        Page page1 = new Page(this.rInfo, this.tInfo);
                        SpiderException.Debug(Localization.Get("开始按目标站ID获取小说信息"));
                        novelInfo = page1.GetNovelInfo(novelInfo);
                        this.backgroundWorker_0.ReportProgress(0, string.Concat(novelInfo.GetID, " | ", novelInfo.Name));
                        if (!this.BCover)
                        {
                            novelInfo.Cover = null;
                        }
                        SpiderException.Debug(Localization.Get("更新小说信息完成!"));
                        LocalProvider.GetInstance().UpdateNovel(novelInfo, this.BAuthor, this.BIntro, this.BDegree, this.bool_0, this.bool_1, this.BCover, this.BKeyword);
                    }
                    catch (Exception exception3)
                    {
                        Exception exception2 = exception3;
                        SpiderException.Show(string.Concat(Localization.Get("更新小说信息:"), novelInfo.GetID, " | ", exception2.Message), true);
                        this.backgroundWorker_0.ReportProgress(0, string.Concat(novelInfo.GetID, " | ", exception2.Message));
                    }
                    minID++;
                }
            }
        }