예제 #1
0
 private void SetValue(BookInfo book)
 {
     this.book = book;
     this.title.Content = book.Title;
     this.cover.Source = DataExtraction.ImageToSource(book.BigCoverImage);
     this.brief.Text = book.DetailInfo;
 }
예제 #2
0
 public BookElement(BookInfo book)
 {
     InitializeComponent();
     this.book = book;
     this.title.Content = book.Title;
     this.cover.Source = DataExtraction.ImageToSource(book.SmallCoverImage);
     this.brief.Text = book.BriefInfo;
 }
예제 #3
0
 public void GetMoreDetail(BookInfo book)
 {
     this.title.Content = book.Title;
     Visibility = Visibility.Visible;
     loadingLabel.Visibility = Visibility.Visible;
     subThread = new Thread(new ParameterizedThreadStart(getDetail));
     subThread.Start(book);
 }
예제 #4
0
 public static ManualResetEvent showInputBox(BookInfo book)
 {
     mre.Reset();
     Instance.Visibility = Visibility.Visible;
     Instance.IsCancelClicked = false;
     Instance.IsSubmitClicked = false;
     Instance.STR.Text = "";
     Instance.title.Content = book.Title;
     Instance.ssid.Content = "SS号:" + book.SSID;
     return mre;
 }
예제 #5
0
        public static void GetDetailInfo(this BookInfo book)
        {
            if (book.isDetail)
            {
                return;
            }
            String coveReg = "(http://cover.*?)\"";
            string source  = HttpWebResponseUtility.GetHtmlByHttpWebRequest(book.DetailInfoUrl);
            Match  m       = Regex.Match(source, coveReg);

            if (m.Success)
            {
                book.BigCoverImage = HttpWebResponseUtility.GetImage(m.Groups[1].Value);
                book.isDetail      = true;
            }
            String regexStr = "<p>([\\s\\S]*?)</p>";

            m = Regex.Match(source, regexStr);
            while (m.Success)
            {
                book.DetailInfo += DataExtraction.RemoveHTMLTab(m.Groups[1].Value).Replace("\n", "").Replace("\r", "").Replace("\t", "").Replace(" ", "").Replace("&gt;", "->") + "\n";
                m = m.NextMatch();
            }
        }
예제 #6
0
 public void addBook(BookInfo book)
 {
     _booklist.Add(book);
 }
예제 #7
0
 public Download(BookInfo book, string path)
 {
     _book = book;
     ThreadCount = 5;
     _lockthis = new object();
     DownloadPath = path;
     _imagepath = Path.Combine(DownloadPath, book.Title);
     Directory.CreateDirectory(_imagepath);
     MaxTryingTimesWhenFailed = 10;
     PDFFilePath = Path.Combine(DownloadPath, _book.Title + PDFType);
     _bodypagesinfo = new BodyPagesInfo[ThreadCount - 1];
     for (int i = 0; i < ThreadCount - 1; i++)
         _bodypagesinfo[i] = new BodyPagesInfo();
     _frontpagesinfo = new FrontPagesInfo();
     Status = TaskStatus.Preparing;
 }
        public DownloadTaskElement(BookInfo book, DownloadTaskList downloadmanager)
        {
            InitializeComponent();
            _book = book;
            _downloadmanager = downloadmanager;
            _download = new Download(book, Setting.downloadPath);
            _download.Finish += new Download.FinishedEventHandler(_download_Finish);
            _download.Exception += new Download.ExceptionEventHandler(_download_Exception);
            _download.Progress += new Download.ProgressEventHandler(_download_Progress);


            this.Exception += new ExceptionEventHandler(downloadmanager.Exception);
            this.Finish += new FinishEventHandler(downloadmanager.Finish);
            this.Status = TaskStatus.Waiting;
            initUI();
        }
예제 #9
0
 private static BookInfo GetBriefBookInfo(this GroupCollection gc)
 {
     BookInfo book = new BookInfo();
     book.DetailInfoUrl = gc[1].Value;
     book.SmallCoverImage = HttpWebResponseUtility.GetImage(gc[2].Value);
     book.DXID = gc[3].Value;
     book.SSID = gc[4].Value;
     book.Title = RemoveHTMLTab(gc[5].Value);
     book.ReadBookUrlTemp = Setting.platformHost[Setting.platformIndex] + gc[6].Value;
     book.IsReadAll = book.ReadBookUrlTemp.Contains("gobaoku");
     book.BriefInfo = RemoveHTMLTab(gc[7].Value.Replace("&nbsp;", " ").Replace("<br>", "\n"));
     book.PagesNum = GetPageNum(book.BriefInfo);
     return book;
 }
예제 #10
0
 public void addBook(BookInfo book)
 {
     _booklist.Add(book);
 }
예제 #11
0
 public void StartNewTask(BookInfo book)
 {
     DownloadTaskElement de = new DownloadTaskElement(book, this);
     AddTaskElement(de);
     StartOneToDownload();
 }