Exemple #1
0
        private void backgroundWorker_0_DoWork(object sender, DoWorkEventArgs e)
        {
            NovelInfo novelInfo;

            string[]  getID;
            NovelInfo chapterInfo;

            object[]         chapterUrl;
            BackgroundWorker backgroundWorker = sender as BackgroundWorker;
            Page             page             = new Page(this.ruleConfigInfo_0, this.taskConfigInfo_0);

            backgroundWorker.ReportProgress(0, Localization.Get("====== 开始测试获得最新列表 ======"));
            string str = this.ruleConfigInfo_0.NovelListUrl.Pattern.Replace("\r\n", "♂");

            char[]      chrArray  = new char[] { '\u2642' };
            NovelInfo[] novelList = page.GetNovelList(str.Split(chrArray));
            if ((int)novelList.Length == 0)
            {
                throw new ApplicationException(Localization.Get("没有获得小说列表"));
            }
            string str1 = "";

            for (int i = 0; i < (int)novelList.Length; i++)
            {
                getID = new string[] { str1, novelList[i].GetID, "\t", novelList[i].Name, "\n" };
                str1  = string.Concat(getID);
            }
            backgroundWorker.ReportProgress(0, str1);
            backgroundWorker.ReportProgress(0, "");
            backgroundWorker.ReportProgress(0, Localization.Get("====== 开始测试小说信息页 ======"));
            Random random = new Random();

            novelInfo = ((this.string_0 == "0" ? true : this.string_0 == "") ? novelList[random.Next((int)novelList.Length)] : new NovelInfo()
            {
                GetID = this.string_0
            });
            NovelInfo novelInfo1 = page.GetNovelInfo(novelInfo);
            string    str2       = "获取失败";

            if (novelInfo1.Cover != null)
            {
                str2 = "获取成功";
            }
            getID = new string[] { "NovelUrl:\t", novelInfo1.NovelUrl.AbsolutePath, "\nNovelName:\t", novelInfo1.Name, "\nNovelAuthor:\t", novelInfo1.Author, "\nLagerSort:\t", novelInfo1.LagerSort, "\nSmallSort:\t", novelInfo1.SmallSort, "\nNovelIntro:\t", novelInfo1.Intro, "\nNovelKeyword:\t", novelInfo1.Keyword, "\nNovelCover:\t", str2, "\nNovelDegree:\t", novelInfo1.Degree.ToString() };
            backgroundWorker.ReportProgress(0, string.Concat(getID));
            backgroundWorker.ReportProgress(0, "");
            backgroundWorker.ReportProgress(0, Localization.Get("====== 开始测试章节目录页 ======"));
            Thread.Sleep(100);
            backgroundWorker.ReportProgress(0, string.Concat("PubIndexUrl\t", novelInfo1.IndexUrl));
            ChapterInfo[] chapterList = page.GetChapterList(novelInfo1, true);
            if ((int)chapterList.Length == 0)
            {
                throw new ApplicationException(Localization.Get("没有获得章节列表"));
            }
            string str3 = "";
            int    num  = FormatText.GetInt(this.ruleConfigInfo_0.PubContentChapterNum.Pattern, 0);

            for (int j = 0; j < (int)chapterList.Length; j++)
            {
                getID = new string[] { str3, chapterList[j].GetID, "\t", chapterList[j].VolumeName, "\t", chapterList[j].ChapterName };
                str3  = string.Concat(getID);
                str3  = (((int)chapterList.Length - j > num ? true : !(this.ruleConfigInfo_0.PubContentChapterName.Pattern != "")) ? string.Concat(str3, "\n") : string.Concat(str3, "\t[新]\n"));
            }
            backgroundWorker.ReportProgress(0, str3);
            backgroundWorker.ReportProgress(0, "");
            backgroundWorker.ReportProgress(0, Localization.Get("====== 开始测试章节内容页 ======"));
            Thread.Sleep(100);
            if (this.string_1 != "0")
            {
                int num1 = 0;
                while (num1 < (int)chapterList.Length)
                {
                    if (chapterList[num1].GetID == this.string_1)
                    {
                        novelInfo1.LastChapter = chapterList[num1];
                        chapterInfo            = page.GetChapterInfo(novelInfo1, false);
                        chapterUrl             = new object[] { "PubContentUrl:\t", chapterInfo.LastChapter.ChapterUrl, "\nPubTextUrl:\t", chapterInfo.LastChapter.TextUrl };
                        backgroundWorker.ReportProgress(0, string.Concat(chapterUrl));
                        chapterInfo.LastChapter.ChapterText = page.Replace(chapterInfo.LastChapter.ChapterText, this.ruleConfigInfo_0.PubContentReplace);
                        backgroundWorker.ReportProgress(0, string.Concat("PubContentText:\t", chapterInfo.LastChapter.ChapterText));
                        return;
                    }
                    else
                    {
                        num1++;
                    }
                }
            }
            else
            {
                novelInfo1.LastChapter = chapterList[random.Next((int)chapterList.Length)];
            }
            chapterInfo = page.GetChapterInfo(novelInfo1, false);
            chapterUrl  = new object[] { "PubContentUrl:\t", chapterInfo.LastChapter.ChapterUrl, "\nPubTextUrl:\t", chapterInfo.LastChapter.TextUrl };
            backgroundWorker.ReportProgress(0, string.Concat(chapterUrl));
            chapterInfo.LastChapter.ChapterText = page.Replace(chapterInfo.LastChapter.ChapterText, this.ruleConfigInfo_0.PubContentReplace);
            backgroundWorker.ReportProgress(0, string.Concat("PubContentText:\t", chapterInfo.LastChapter.ChapterText));
        }
Exemple #2
0
 protected override void SaveTheNovelInfo(NovelInfo novelinfo)
 {
     MessageBox.Show(novelinfo.Name);
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="list"></param>
 /// <param name="novelinfo"></param>
 public ChapterListEventArgs(List <Chapter> list, NovelInfo novelinfo)
 {
     this._ChapterList = list;
     this._NovelInfo   = novelinfo;
 }
Exemple #4
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="novelinfo"></param>
 public NovelInfoEventArgs(NovelInfo novelinfo)
 {
     this._NovelInfo = novelinfo;
 }
Exemple #5
0
 /// <summary>
 /// 保存基本信息
 /// </summary>
 /// <param name="novelinfo"></param>
 public void SaveNovelInfo(NovelInfo novelinfo)
 {
     SaveTheNovelInfo(novelinfo);
 }
Exemple #6
0
 /// <summary>
 /// 保存基本信息
 /// </summary>
 protected virtual void SaveTheNovelInfo(NovelInfo novelinfo)
 {
 }
Exemple #7
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="chatper"></param>
 /// <param name="novelinfo"></param>
 public ChapterEventArgs(Chapter chatper, NovelInfo novelinfo)
 {
     this._Chapter   = chatper;
     this._NovelInfo = novelinfo;
 }
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="list">章节列表</param>
 /// <param name="novelinfo">与分卷相关章节信息</param>
 public VolumeListEventArgs(List <Volume> list, NovelInfo novelinfo)
 {
     this._Volumes   = list;
     this._NovelInfo = novelinfo;
 }
 private void backgroundWorker_0_DoWork(object sender, DoWorkEventArgs e)
 {
     if (Configs.CmsName != "Qiwen")
     {
         if (this.textBox_0.Text != "")
         {
             NovelInfo[] novelList = NovelSpider.Local.LocalProvider.GetInstance().GetNovelList(this.textBox_0.Text.ToString());
             int         num       = 0;
             while (num < (int)novelList.Length)
             {
                 if (this.backgroundWorker_0.CancellationPending)
                 {
                     e.Cancel = true;
                     return;
                 }
                 else
                 {
                     int putID = novelList[num].PutID;
                     this.backgroundWorker_0.ReportProgress(0, string.Concat(putID.ToString(), " | ", novelList[num].Name.ToString()));
                     this.backgroundWorker_0.ReportProgress(1, string.Concat(num + 1, " / ", (int)novelList.Length));
                     if ((!this.bool_0 ? true : (int)NovelSpider.Local.LocalProvider.GetInstance().GetChapterList(putID).Length < this.int_0))
                     {
                         NovelInfo novelInfo = new NovelInfo()
                         {
                             PutID = putID
                         };
                         NovelSpider.Local.LocalProvider.GetInstance().ClearNovel(novelInfo);
                         NovelSpider.Local.LocalProvider.GetInstance().DeteleNovel(putID);
                         File.AppendAllText("Delete.log", string.Concat(putID.ToString(), " | ", novelList[num].Name.ToString(), "\r\n"));
                     }
                     num++;
                 }
             }
         }
         else
         {
             MessageBox.Show(Localization.Get("请输入自定义SQL,选择单本或批量方式的请先生成自定义SQL。"));
         }
     }
     else if (!this.backgroundWorker_0.IsBusy)
     {
         DataTable dataTable = SqlHelper.ExecuteDataTable(SqlHelper.ConnectionString, CommandType.Text, e.Argument.ToString(), null);
         int       num1      = 0;
         while (num1 < dataTable.Rows.Count)
         {
             if (this.backgroundWorker_0.CancellationPending)
             {
                 e.Cancel = true;
                 return;
             }
             else
             {
                 int num2 = Convert.ToInt32(dataTable.Rows[num1]["id"]);
                 this.backgroundWorker_0.ReportProgress(0, string.Concat(num2.ToString(), " | ", dataTable.Rows[num1]["booktitle"].ToString()));
                 this.backgroundWorker_0.ReportProgress(1, string.Concat(num1 + 1, " / ", dataTable.Rows.Count));
                 if ((!this.bool_0 ? true : (int)NovelSpider.Local.LocalProvider.GetInstance().GetChapterList(num2).Length < this.int_0))
                 {
                     NovelSpider.Local.LocalProvider.GetInstance().DeteleNovel(num2);
                     File.AppendAllText("Delete.log", string.Concat(num2.ToString(), " | ", dataTable.Rows[num1]["booktitle"].ToString(), "\r\n"));
                 }
                 num1++;
             }
         }
     }
     else
     {
         MessageBox.Show(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++;
                }
            }
        }
Exemple #11
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="name">章名</param>
 /// <param name="chapteruri">章地址</param>
 /// <param name="novelinfo">相关小说信息</param>
 public Chapter(string name, Uri chapteruri, NovelInfo novelinfo)
 {
     this._Name       = name;
     this._ChapterUri = chapteruri;
     this._NovelInfo  = novelinfo;
 }