Blacker.Scraper.MangaFox.GetPages C# (CSharp) Метод

GetPages() приватный Метод

private GetPages ( IChapterRecord chapter ) : string>.IDictionary
chapter IChapterRecord
Результат string>.IDictionary
        private IDictionary<int, string> GetPages(IChapterRecord chapter)
        {
            IDictionary<int, string> pages = new Dictionary<int, string>();

            var document = WebHelper.GetHtmlDocument(chapter.Url);

            var commentsLink = document.SelectSingleNode(@"//a[@id=""comments""]");
            if (commentsLink == null)
            {
                throw new ParserException("Could not find expected elements on website.", document.InnerHtml);
            }

            var link = commentsLink.Attributes["href"].Value;

            var chapterPages = document.SelectNodes(@"//select[@class=""m""][1]/option");
            if (chapterPages == null)
            {
                throw new ParserException("Could not find expected elements on website.", document.InnerHtml);
            }

            foreach (var pageLink in chapterPages)
            {
                int pageNumber = 0;

                if (!Int32.TryParse(pageLink.InnerText, out pageNumber))
                    continue;

                if (pages.ContainsKey(pageNumber)) // if page is already in dictionary then skip adding it
                    continue;

                pages.Add(pageNumber, link + pageNumber + ".html");
            }

            return pages;
        }