예제 #1
0
        public void ShowBook(QueryBookInfo book)
        {
            mBook           = book;
            label_name.Text = book.title;
            string wordCount = book.wordCount + "字";

            if (book.wordCount >= 10000)
            {
                wordCount = (book.wordCount / 10000) + " 万字";
            }
            label_baseinfo.Text = book.author + " | " + book.cat + " | " + wordCount;
            if (!string.IsNullOrWhiteSpace(book.retentionRatio))
            {
                label_retentionRatio.Text = "追书留存率:" + book.retentionRatio + "%";
            }
            else
            {
                label_retentionRatio.Text = "追书留存率:无数据";
            }

            label_latelyFollower.Text = "追书人数:" + book.latelyFollower + " 人";
            label_lastChapter.Text    = "最后更新章节:" + book.lastChapter;
            label_site.Text           = "首发网站:" + book.site;
            textBox_shortIntro.Text   = book.shortIntro;
            string url           = book.cover;
            int    urlStartIndex = url.IndexOf("http:");

            if (urlStartIndex >= 0)
            {
                url = url.Substring(urlStartIndex);
                picturebox_cover.ImageLocation = url;
            }

            mMixToc = LibZhuiShu.getMixToc(mBook._id);
            mTocs   = LibZhuiShu.getTocSummary(mBook._id);
            if (mMixToc != null)
            {
                changeToc(-1);
            }
            else if (mTocs != null && mTocs.Length > 0)
            {
                changeToc(0);
            }
            else
            {
                MessageBox.Show("无可用的书源!");
                return;
            }

            this.Show();
        }
예제 #2
0
        /// <summary>
        /// 开始下载
        /// </summary>
        public void StartDownload()
        {
            // 获得章节列表和所有书源
            var mixTocInfo = LibZhuiShu.getMixToc(mBookID);
            // 获得所有书源
            var tocs = LibZhuiShu.getTocSummary(mBookID);
            List <TocChaperListInfo> tocChaperListInfoList = new List <TocChaperListInfo>();

            foreach (var toc in tocs)
            {
                if (toc.name == "优质书源")
                {
                    continue;
                }
                var tocChaperList = LibZhuiShu.getChaperList(toc._id);
                tocChaperListInfoList.Add(tocChaperList);
            }
            foreach (var chapter in mixTocInfo.chapters)
            {
                ChapterDownloadContext context = new ChapterDownloadContext()
                {
                    title = chapter.title
                };
                context.links.Add(chapter.link);
                foreach (var tocChaterListInfo in tocChaperListInfoList)
                {
                    foreach (var tocChapter in tocChaterListInfo.chapters)
                    {
                        if (tocChapter.title.Replace(" ", "").ToLower() == context.title.Replace(" ", "").ToLower())
                        {
                            if (!context.links.Contains(tocChapter.link))
                            {
                                context.links.Add(tocChapter.link);
                            }
                            break;
                        }
                    }
                }
                mChapters.Add(context);
                mChaptersDownloadQueue.Enqueue(context);
            }

            for (int i = 0; i < 10; i++)
            {
                Thread workThread = new Thread(DownLoadThread);
                mWorkThreads.Add(workThread);
                workThread.Start();
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            var result = LibZhuiShu.autoComplate("完美");
            var books  = LibZhuiShu.fuzzySearch("完美世界", 0, 1);

            foreach (var book in books)
            {
                Console.WriteLine(string.Format("{0}  {1}  {2}", book._id, book.title, book.author));
                var tocs        = LibZhuiShu.getTocSummary(book._id);
                var chapertList = LibZhuiShu.getChaperList(tocs[0]._id);
                Console.WriteLine(LibZhuiShu.getChapter(chapertList.chapters[0].link).body);
            }
            foreach (var item in result)
            {
                Console.WriteLine("章节:" + item);
                Console.ReadKey();
            }
        }