public void AddPage(string html) { html = html.Replace('\uFFFF', ' '); HtmlParser parser = new HtmlParser(); IHtmlDocument document = parser.Parse(html); RobloxPage page = new RobloxPage(document, this); if (page.PageNumber == CurrentPage) { try { if (CurrentPage == 0) { AddFirstPage(document, page); } else { Pages.Add(page); CurrentPage++; } } catch (Exception ex) { Console.Write(ex.Message + " In Thread # " + ThreadId); throw new Exception(ex.Message + " In Thread # " + ThreadId); } } else { throw new Exception("Unexpected page number"); } }
//First page add, performs some additional stuff public void AddFirstPage(IHtmlDocument document, RobloxPage page) { if (!page.IsEmpty) { ParseForum(document); ParseTitle(document); ParseNumberOfPages(document); Pages.Add(page); CurrentPage++; } else { IsEmpty = true; } }