public override int getChapterLength(Manga manga, Chapter c) { string chapURL = readURL + manga.urlName + "/" + c.url; string sourceCode = wc.DownloadString(chapURL); Regex regex = new Regex(@"Last Page \(([0-9]+)\)"); // "Last Page (number)" return Convert.ToInt32(regex.Match(sourceCode).Groups[1].Value); }
public override List<Chapter> GetAvailableChapters(Manga manga) { string temp = wc.DownloadString(url + "/" + manga.urlName); Regex regex = new Regex(@"" + readURL + manga.urlName + "/(.*/[0-9]*/).*>(.*)</a>.*[\n|\r|\r\n]<td>(.*)</td>"); // ex. 1119/3041/ MatchCollection matches = regex.Matches(temp); // Groups[i] - 0: complete string; 1: url; 2: Title; 3: Release Date return (from Match v in matches select new Chapter(v.Groups[1].Value, v.Groups[2].Value, v.Groups[3].Value)).ToList(); // Linq (writes every match into a List) }
public override List<string> getChapterImages(Manga m, Chapter c) { int length = getChapterLength(m, c); List<string> images = new List<string>(); for (int i = 1; i <= length; i++) { string img = getImgURL(readURL + m.urlName + "/" + c.url + i); images.Add(img); } return images; }
public override HashSet<Manga> parseMangas() { string sourceCode = wc.DownloadString(url); Regex regex = new Regex(@"http://mangastream.com/manga/([a-z_]+)"">([A-Za-z0-9 -.]+)"); MatchCollection matches = regex.Matches(sourceCode); // Match.Group -> 0: complete Match; 1: url; 2: Manga Name foreach (Match v in matches) { //Console.WriteLine(v.Groups[0].Value); Manga m = new Manga { name = v.Groups[2].Value, urlName = v.Groups[1].Value }; mangas.Add(m); } return mangas; }
/// <summary> /// gets all the images of one chapter /// </summary> /// <param name="m">selected Manga</param> /// <param name="c">c.url -> ex.: Last%20Scene/2557/ or 154/2528/</param> /// <returns>List of images</returns> public abstract List<string> getChapterImages(Manga m, Chapter c);
/// <summary> /// returns the amount of pages from a chapter /// </summary> /// <param name="manga">selected Manga</param> /// <param name="c">c.url -> ex.: Last%20Scene/2557/</param> /// <returns>chapter length</returns> public abstract int getChapterLength(Manga manga, Chapter c);
/// <summary> /// returns all available URLs, Titles and Release Date of chapters for selected Manga /// </summary> /// <param name="m">ex.: Mangastream -> Last%20Scene/2557/ or 154/2528/</param> /// <returns>List of chapters</returns> public abstract List<Chapter> GetAvailableChapters(Manga m);
public override int getChapterLength(Manga manga, Chapter c) { throw new NotImplementedException(); }
public override List<string> getChapterImages(Manga m, Chapter c) { throw new NotImplementedException(); }
public override List<Chapter> GetAvailableChapters(Manga m) { throw new NotImplementedException(); }
/// <summary> /// Creates Table Manga and add all available Chapers /// </summary> /// <param name="m">Manga</param> public void addChapters(Manga m) { }