コード例 #1
0
 public void Scan(string url)
 {
     CurrentPage = new BLPage(url);
     while (CurrentPage.NextPageUrl != null)
     {
         ImageUrls.AddRange(CurrentPage.Images.Where(img => ImageUrls.All(im => im != img.Url)).Select(im => im.Url));
         CurrentPage = new BLPage(CurrentPage.NextPageUrl);
     }
 }
コード例 #2
0
 public void ReplaceOrAddPage(BLPage page)
 {
     if (page.CurrentPageNumber != -1)
     {
         LoadedPages.RemoveAll(lp => lp.CurrentPageNumber == page.CurrentPageNumber);
         LoadedPages.Add(RemoveQuotesAndRepeats(page));
     }
     Debug.WriteLine("Invalid page added");
 }
コード例 #3
0
        public BLPage GetBLPageByPageNumber(int pageNumber)
        {
            if (LoadedPages.Any(lp => lp.CurrentPageNumber == pageNumber))
            {
                return(LoadedPages.First(lp => lp.CurrentPageNumber == pageNumber));
            }
            string pageUrl = OpeningPostUrl;

            if (OpeningPostUrl.Contains('/'))
            {
                pageUrl = OpeningPostUrl.Substring(0, OpeningPostUrl.LastIndexOf('/'));
            }
            var pageUrlIdentity = OpeningPostUrl.Split('/').Last().Split('?')[0];
            var bPage           = new BLPage(string.Format(pageByUrlFormat, pageUrl, pageUrlIdentity, pageNumber));

            LoadedPages.Add(RemoveQuotesAndRepeats(bPage));
            return(bPage);
        }
コード例 #4
0
 public BLPage RemoveQuotesAndRepeats(BLPage newPage)
 {
     newPage.Images.RemoveAll(im => LoadedPages.Any(lp => lp.Images.Any(lpi => lpi.Url == im.Url)));
     return(newPage);
 }