public override void load_chapters(KeyValuePair <String, String> infos) { String[] html = HtmlRequest.get_html(infos.Value); List <String[]> array_positions = new List <string[]>(); int found; int found2; int found3; name = infos.Key; link = infos.Value; int nb_cell = 0; int synopsis = 0; list_chapter.Clear(); Tome current_tome = null; int index = 0; foreach (String i2 in html) { String i = i2.Replace("\t", ""); found = i.IndexOf("<a href=\"//www.japscan.com/lecture-en-ligne/"); found2 = i.IndexOf("<h2>Volume"); found3 = i.IndexOf("<div class=\"cell\">"); if (found3 == 0) { nb_cell++; } if (found3 == 0 && nb_cell == 6) { auteur = i.Substring(18, i.Length - 24); } if (found3 == 0 && nb_cell == 7) { année = i.Substring(18, i.Length - 24); } if (synopsis == 1) { resumé = i.Substring(0, i.Length - 6); synopsis = 0; } if (i.IndexOf("<div id=\"synopsis\">") == 0) { synopsis = 1; } if (found == 0) { int end_pos = i.IndexOf("/\">"); String link = i.Substring(11, end_pos - 11); String desc = i.Substring(end_pos + 3, i.Length - end_pos - 7); String desc_det; String title = null; if (current_tome != null && i.IndexOf("Tome " + current_tome.getNumber()) != -1) { list_chapter.Add(new Chapters(index, false, current_tome.getNumber(), "http://" + link + "/", current_tome, title, null)); } else { if (desc.Substring(desc.IndexOf(name) + name.Length).IndexOf(":") != -1) { desc_det = desc.Substring(desc.IndexOf(name) + name.Length, desc.IndexOf(":") - (desc.IndexOf(name) + name.Length)); title = desc.Substring(desc.IndexOf(": ") + 2, desc.Length - (desc.IndexOf(": ") + 2)); } else { desc_det = desc.Substring(desc.IndexOf(name) + name.Length, desc.Length - (desc.IndexOf(name) + name.Length)); } Double number = TryParseDouble(desc_det); list_chapter.Add(new Chapters(index, true, number, "http://" + link + "/", current_tome, title, null)); index++; } } else if (found2 == 0) { String data = i.Substring(i.IndexOf("<h2>") + 4); data = data.Substring(0, data.IndexOf("</h2>")); String nb_tome = Regex.Match(data, @"\d+").Value; int pos_sep = data.IndexOf(":"); String title; if (pos_sep != -1) { title = data.Substring(pos_sep + 2); } else { title = null; } current_tome = new Tome(title, Int32.Parse(nb_tome)); } } }
public override void load_chapters(KeyValuePair <String, String> infos) { String[] html = HtmlRequest.get_html(infos.Value); List <Chapters> array_positions = new List <Chapters>(); this.name = infos.Key; this.link = infos.Value; list_chapter.Clear(); int is_chapter_list = 0; int is_start = 0; String[] tab; String link = ""; String desc; int img = 0; int cpt_desc = 0; resumé = ""; int index = 0; Tome current_tome = null; Chapters current_chapter = null; foreach (String i in html) { if (i.IndexOf("has been licensed") != -1) { list_chapter.Add(new Chapters(-1, false, 0, "", null, "Manga has been licensed", null)); } if (i.IndexOf("<div class=\"detail_list\">") != -1) { is_chapter_list = 1; } if (i.IndexOf("<a class=\"color_0077\"") != -1 && is_chapter_list == 1) { is_start = 1; current_chapter = new Chapters(); link = HtmlRequest.cut_str(i, "href=\"", "\" >"); if (link == "NOT FOUND") { link = HtmlRequest.cut_str(i, "href=\"", "\" name"); } current_chapter.setLink(link); current_chapter.SetisChapter(true); } if (i.IndexOf("</a>") != -1 && is_start == 1) { desc = i.Substring(0, i.IndexOf("</a>")); current_chapter.setNumber(TryParseDouble(desc.Replace(name, ""))); } if (i.IndexOf("<span class=\"mr6\"") != -1 && is_start == 1) { int tome_nb = 0; if (i.IndexOf("Vol ") != -1) { tome_nb = Int32.Parse(HtmlRequest.cut_str(i, "Vol ", "</span>")); } if (current_tome == null || current_tome.getNumber() != tome_nb) { current_tome = new Tome(null, tome_nb); } current_chapter.setTome(current_tome); } if (i.IndexOf("<span class=\"right\">") != -1 && is_start == 1) { is_start = 0; current_chapter.setIndex(index); current_chapter.date = HtmlRequest.cut_str(i, "<span class=\"right\">", "</span>"); index++; list_chapter.Add(current_chapter); } if (i.IndexOf("class=\"tab_comment clearfix\">") != -1 && is_chapter_list == 1) { is_chapter_list = 0; } if (i.IndexOf("<li><label>Author(s):</label>") != -1) { auteur = HtmlRequest.cut_str(i, "\">", "</a></li>"); } if (img == 1) { img_link = HtmlRequest.cut_str(i, "<img src=\"", "\" onerror"); img = 0; } if (i.IndexOf("<div class=\"manga_detail_top clearfix\">") != -1) { img = 1; } if (i.IndexOf("<p id=\"show\" style=\"display:none;\">") != -1) { cpt_desc = 1; } if (cpt_desc == 1) { if (i.IndexOf("<p id=\"show\" style=\"display:none;\">") != -1 && i.IndexOf(" <a href=") != -1) { resumé = HtmlRequest.cut_str(i, "style=\"display:none;\">", " <a href="); } else if (i.IndexOf("<p id=\"show\" style=\"display:none;\">") != -1) { int pos = i.IndexOf("<p id=\"show\" style=\"display:none;\">") + 35; resumé += i.Substring(pos, i.Length - pos); } else if (i.IndexOf(" <a href=") != -1) { resumé += i.Substring(0, i.IndexOf(" <a href=")); } else { resumé += i; } } if (i.IndexOf(" <a href=") != -1 && cpt_desc == 1) { cpt_desc = 0; } } resumé = resumé.Replace(""", "\""); nb_tomes = 0; }