示例#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("条"));
     }));
 }
示例#2
0
        private void backgroundWorker_0_DoWork(object sender, DoWorkEventArgs e)
        {
            NovelInfo[] novelList;
            this.backgroundWorker_0.ReportProgress(2, Localization.Get("正在获得小说列表"));
            try
            {
                novelList = LocalProvider.GetInstance().GetNovelList(this.CmdText);
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                if (this.Log)
                {
                    SpiderException.Debug(Localization.Get("批量生成"), exception.Message);
                }
                else
                {
                    MessageBox.Show(string.Concat(Localization.Get("无法载入小说列表,有可能是SQL语句错误。\n\n"), exception.Message));
                }
                return;
            }
            this.backgroundWorker_0.ReportProgress(5, (int)novelList.Length - 1);
            int num = 0;

            while (num < (int)novelList.Length)
            {
                if (this.backgroundWorker_0.CancellationPending)
                {
                    e.Cancel = true;
                    break;
                }
                else
                {
                    this.backgroundWorker_0.ReportProgress(3, num);
                    this.backgroundWorker_0.ReportProgress(0, string.Concat(novelList[num].PutID, " | ", novelList[num].Name));
                    this.backgroundWorker_0.ReportProgress(2, Localization.Get("正在获得章节列表"));
                    if (this.ChapterHtml)
                    {
                        try
                        {
                            ChapterInfo[] chapterList = LocalProvider.GetInstance().GetChapterList(novelList[num].PutID);
                            this.backgroundWorker_0.ReportProgress(6, (int)chapterList.Length - 1);
                            int num1 = 0;
                            while (num1 < (int)chapterList.Length)
                            {
                                if (this.backgroundWorker_0.CancellationPending)
                                {
                                    e.Cancel = true;
                                    goto Label1;
                                }
                                else
                                {
                                    this.backgroundWorker_0.ReportProgress(4, num1);
                                    this.backgroundWorker_0.ReportProgress(1, string.Concat(chapterList[num1].VolumeName, " ", chapterList[num1].ChapterName));
                                    this.backgroundWorker_0.ReportProgress(2, Localization.Get("正在生成章节内容HTML"));
                                    int    putID       = 0;
                                    int    putID1      = 0;
                                    string chapterName = "";
                                    string str         = "";
                                    string volumeName  = "";
                                    if (num1 != 0)
                                    {
                                        chapterName = chapterList[num1 - 1].ChapterName;
                                        putID       = chapterList[num1 - 1].PutID;
                                    }
                                    if ((int)chapterList.Length > num1 + 1)
                                    {
                                        str    = chapterList[num1 + 1].ChapterName;
                                        putID1 = chapterList[num1 + 1].PutID;
                                    }
                                    volumeName = chapterList[num1].VolumeName;
                                    LocalProvider.GetInstance().CreateSingleChapter(novelList[num], chapterList[num1], false, putID, putID1, chapterName, str, volumeName);
                                    num1++;
                                }
                            }
                        }
                        catch (Exception exception3)
                        {
                            Exception exception2 = exception3;
                            if (this.Log)
                            {
                                SpiderException.Debug(Localization.Get("批量生成"), exception2.Message);
                            }
                            else
                            {
                                MessageBox.Show(exception2.Message);
                            }
                        }
                    }
Label1:
                    this.backgroundWorker_0.ReportProgress(1, "--");
                    this.backgroundWorker_0.ReportProgress(2, Localization.Get("正在生成目录页,全文页及电子书"));
                    try
                    {
                        LocalProvider.GetInstance().CreateIndex(novelList[num], this.IndexHtml, this.FullHtml, this.bool_0, this.bool_1, false, false, 0);
                    }
                    catch (Exception exception5)
                    {
                        Exception exception4 = exception5;
                        if (this.Log)
                        {
                            SpiderException.Debug(Localization.Get("批量生成"), exception4.Message);
                        }
                        else
                        {
                            MessageBox.Show(exception4.Message);
                        }
                    }
                    num++;
                }
            }
        }
        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++;
                }
            }
        }