Exemple #1
0
        public static MangaMeta CreateNewMeta(Manga manga)
        {
            MangaMeta newMeta = new MangaMeta();
            newMeta.ParentManga = manga;

            newMeta.Author = newMeta.Series = newMeta.Publisher = string.Empty;
            newMeta.Volume = newMeta.Year = -1;

            return newMeta;
        }
Exemple #2
0
        public static MangaMeta Get(Manga manga)
        {
            Dictionary<string, object>[] resultSet = Database.Select("meta", "`mid`=" + Database.Quote(manga.Id.ToString()));

            if (resultSet.Length > 0)
            {
                MangaMeta newMeta = FromData(resultSet[0]);
                newMeta.ParentManga = manga;
                return newMeta;
            }

            return null;
        }
Exemple #3
0
 private static Manga FromData(Dictionary<string, object> data)
 {
     Manga newManga = new Manga();
     newManga.Id = Convert.ToInt32(data["id"]);
     newManga.ParentCollectionId = Convert.ToInt32(data["cid"]);
     newManga.Title = Convert.ToString(data["title"]);
     newManga.MangaPath = Convert.ToString(data["path"]);
     newManga.MangaType = Convert.ToInt32(data["type"]);
     newManga.ModifiedTime = Convert.ToInt32(data["time"]);
     newManga.Size = Convert.ToInt64(data["size"]);
     newManga.NumberOfPages = Convert.ToInt32(data["numpages"]);
     newManga.View = Convert.ToInt32(data["view"]);
     newManga.Status = Convert.ToInt32(data["status"]);
     newManga.LeftToRight = Convert.ToInt32(data["ltr"]) == 1;
     return newManga;
 }
Exemple #4
0
        public static MangaListItemJson[] ToListItemJsonArray(Manga[] mangas)
        {
            List<MangaListItemJson> objs = new List<MangaListItemJson>();
            foreach (Manga manga in mangas)
            {
                objs.Add(manga.ToMangaListItemJson());
            }

            return objs.ToArray();
        }
Exemple #5
0
 public static void DeleteMangas(Manga[] mangas)
 {
     foreach (Manga manga in mangas)
     {
         manga.Delete();
     }
 }
Exemple #6
0
        public static Manga CreateNewManga(Collection collection, string path)
        {
            Manga newManga = new Manga();
            newManga.ParentCollectionId = collection.Id;
            newManga._parentCollection = collection;
            newManga.MangaPath = path;
            newManga.MangaType = CheckMangaType(path);
            newManga.InnerRefreshContent();
            newManga.View = newManga.Status = 0;
            newManga._meta = MangaMeta.CreateNewMeta(newManga);
            newManga.LeftToRight = false;

            string title = newManga.MangaPath.Substring(0, newManga.MangaPath.LastIndexOf("."));
            title = title.Substring(title.LastIndexOf("\\") + 1);
            newManga.Title = title.Length > 100 ? title.Substring(0, 100) : title;

            return newManga;
        }