Esempio n. 1
0
        public Manga(string name)
        {
            name_               = name;
            current_chapter_    = "";
            current_page_index_ = -1;

            chapter_suffixes_        = new List <string>();
            simple_chapter_suffixes_ = new List <string>();
            simple_to_full_chapter_  = new Dictionary <string, string>();
            chapter_to_images_       = new Dictionary <string, List <Image> >();
            chapter_to_background_   = new Dictionary <string, BackgroundDownloader>();

            http_ = new HTTP();

            string main_page_url = url_prefix_ + name_ + "/" + main_page_suffix_;
            string main_page     = http_.DownloadWebPage(main_page_url);

            HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(main_page);
            HtmlNode table = doc.GetElementbyId("listing");

            foreach (HtmlNode row in table.SelectNodes("tr"))
            {
                HtmlNode chapter_row = row.SelectSingleNode("td[1]");
                if (chapter_row == null)
                {
                    continue;
                }
                HtmlNode link_node = chapter_row.SelectSingleNode("a[@class='ch']");
                if (link_node == null)
                {
                    continue;
                }
                string link = link_node.Attributes["href"].Value;
                chapter_suffixes_.Add(link);
            }

            // Create list of simplified chapter suffixes
            foreach (string chapter in chapter_suffixes_)
            {
                Match  m      = Regex.Match(chapter, "/(c(.*))/");
                string simple = m.Groups[2].Value;

                simple_chapter_suffixes_.Add(simple);

                simple_to_full_chapter_[simple] = chapter;
            }

            MangaKitsuneForm.Inst.ReplaceChapterList(simple_chapter_suffixes_);
        }