protected MangaObject ToMangaObject(MangaDetails details) { if (Equals(details, null)) { return(null); } MangaItem mangaItem = ApiMangaList.Manga.FirstOrDefault(m => Equals(m.Alias, details.Alias)); MangaObject MangaObject = details.ToMangaObject(); MangaObject.Locations = new List <LocationObject> { new LocationObject() { Enabled = true, ExtensionName = ExtensionDescriptionAttribute.Name, ExtensionLanguage = ExtensionDescriptionAttribute.Language, Url = String.Format("https://www.mangaeden.com/api/manga/{0}", mangaItem.Id) } }; foreach (ChapterObject ChapterObject in MangaObject.Chapters) { LocationObject LocObj = ChapterObject.Locations.First(); LocObj.ExtensionName = ExtensionDescriptionAttribute.Name; LocObj.ExtensionLanguage = ExtensionDescriptionAttribute.Language; } return(MangaObject); }
public static MangaObject ToMangaObject(this MangaDetails details) { details.Chapters = details.Chapters.Reverse().ToArray(); return(new MangaObject() { AlternateNames = (from Alt in details.Aka select HtmlEntity.DeEntitize(Alt)).ToList(), Artists = { HtmlEntity.DeEntitize(details.Artist) }, Authors = { HtmlEntity.DeEntitize(details.Author) }, Chapters = (from Chapter in details.Chapters select Chapter.ToChapterObject()).ToList(), Description = HtmlEntity.DeEntitize(details.Description), Released = new DateTime(details.Released, 1, 1), CoverLocations = { new LocationObject() { Enabled = true, Url = String.Format("https://cdn.mangaeden.com/mangasimg/{0}", details.Cover) } }, Name = details.Title, Genres = details.Categories.ToList() }); }