コード例 #1
0
 public void threadTask()
 {
     try
     {
         var    datas          = new List <BookData>();
         String htmlData       = HtmlDown.DownHtmlPage(url);
         var    bookName       = stringHelper.getrexDataByRex(htmlData, data.netBookNameRex).data;
         var    lastPage       = stringHelper.getrexDataByRex(htmlData, data.netLastPageRex).data;
         var    bookType       = stringHelper.getrexDataByRex(htmlData, data.netBookTypeRex).data;
         var    bookUrl        = stringHelper.getrexDataByRex(htmlData, data.netBookUrlRex).data;
         var    nameListLength = bookName.Count;
         for (var i = 0; i < nameListLength; i++)
         {
             BookData book = new BookData();
             book.bookName = bookName[i];
             if (lastPage != null && lastPage.Count > i)
             {
                 book.lastPage  = lastPage[i];
                 book.pageCount = getPageCount(lastPage[i]);
             }
             if (bookType != null && bookType.Count > i)
             {
                 book.bookType = bookType[i];
             }
             if (bookUrl != null && bookUrl.Count > i)
             {
                 book.bookUrl = bookUrl[i];
             }
             datas.Add(book);
         }
         back(datas);
     }
     catch (Exception e)
     {
         Console.Out.WriteLine(e.ToString());
     }
 }
コード例 #2
0
 public void threadTask()
 {
     try
     {
         var datas = new List<BookData>();
         String htmlData = HtmlDown.DownHtmlPage(url);
         var bookName = stringHelper.getrexDataByRex(htmlData,data.netBookNameRex).data;
         var lastPage = stringHelper.getrexDataByRex(htmlData, data.netLastPageRex).data;
         var bookType = stringHelper.getrexDataByRex(htmlData, data.netBookTypeRex).data;
         var bookUrl = stringHelper.getrexDataByRex(htmlData, data.netBookUrlRex).data;
         var nameListLength = bookName.Count;
         for (var i = 0; i < nameListLength; i++)
         {
             BookData book = new BookData();
             book.bookName = bookName[i];
             if (lastPage != null && lastPage.Count > i)
             {
                 book.lastPage = lastPage[i];
                 book.pageCount = getPageCount(lastPage[i]);
             }
             if (bookType != null && bookType.Count > i)
             {
                 book.bookType = bookType[i];
             }
             if (bookUrl != null && bookUrl.Count > i)
             {
                 book.bookUrl = bookUrl[i];
             }
             datas.Add(book);
         }
         back(datas);
     }
     catch (Exception e)
     {
         Console.Out.WriteLine(e.ToString());
     }
 }