Пример #1
0
        public override Chapter[] GetUpdates()
        {
            List <Chapter> result = new List <Chapter>();

            String[] dlc         = GetDLChapters();
            bool     doFullSetup = true;

            foreach (string chapterUrl in KissMangaHelper.GetChapterUrls(KissMangaHelper.KISS_URL + "/manga/" + mangaRoot.Name))
            {
                string[] urlSplits = chapterUrl.Split('/');
                string   chapID    = urlSplits[urlSplits.Length - 1];
                string   chapNum   = chapID.Substring(8); // remove "chapter_"
                if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                {
                    if (!Directory.Exists(Path.Combine(mangaRoot.FullName, chapID)))
                    {
                        DirectoryInfo chapDir    = FileHelper.CreateFolder(mangaRoot, chapID);
                        Chapter       newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                        chapters.Add(newchapter);
                        result.Add(newchapter);
                    }
                }
            }

            return(result.ToArray());
        }
Пример #2
0
        /// <summary>
        /// Creates manga.txt, then calls Load()
        /// </summary>
        /// <param name="mangaUrl"></param>
        public override void _Create(string mangaUrl)
        {
            id = mangaUrl;
            string title     = KissMangaHelper.GetName(mangaUrl);
            string lang_code = "gb"; // Not that it matters for KissManga

            FileHelper.CreateFolder(FileHelper.APP_ROOT, KissMangaHelper.GetUrlName(mangaUrl));

            MangaInfo info = new MangaInfo()
            {
                Type     = "manga",
                Source   = "kissmanga",
                Id       = KissMangaHelper.GetUrlName(mangaUrl),
                Name     = title,
                LangCode = lang_code,
                Group    = "^any-group",
                UserName = title,
                Chapter  = "1",
                Page     = "1",
                Latest   = "1"
            };

            string output = JsonConvert.SerializeObject(info);

            File.WriteAllText(Path.Combine(mangaRoot.FullName, "manga.json"), output);

            _Load(false);
            GetSetPrunedChapters(true);
        }
        public void StartDownloading()
        {
            File.Create(Path.Combine(chapter.GetChapterRoot().Parent.FullName, "dl" + chapter.GetID())).Close();

            string mName = chapter.GetChapterRoot().Parent.Name;
            string cUrl  = "https://kissmanga.org/chapter/" + mName + "/" + chapter.GetID();

            string[] pageUrls = KissMangaHelper.GetPageUrls(cUrl);

            foreach (string url in pageUrls)
            {
                string imgFile = Path.Combine(chapter.GetChapterRoot().FullName, KissMangaHelper.GetPageFileName(url));
                DownloadAsync(new Uri(url), imgFile);
            }
        }
Пример #4
0
        public override Chapter[] GetSetPrunedChapters(bool overrideDlc)
        {
            chapters.Clear();

            List <Chapter> result = new List <Chapter>();

            String[] dlc = GetDLChapters();
            bool     doFullSetup;

            if (!overrideDlc)
            {
                doFullSetup = true;
            }
            else // override
            {
                doFullSetup = false;
            }

            foreach (string chapterUrl in KissMangaHelper.GetChapterUrls(KissMangaHelper.KISS_URL + "/manga/" + mangaRoot.Name))
            {
                string[] urlSplits = chapterUrl.Split('/');
                string   chapID    = urlSplits[urlSplits.Length - 1];
                string   chapNum   = chapID.Substring(8); // remove "chapter_"
                if ((!doFullSetup) || (doFullSetup && dlc == null) || (doFullSetup && dlc[0].Equals("-1")) || (doFullSetup && dlc.Contains(chapNum)))
                {
                    DirectoryInfo chapDir = null; // Only create folder if doing full setup
                    if (doFullSetup)
                    {
                        chapDir = FileHelper.CreateFolder(mangaRoot, chapID);
                    }
                    Chapter newchapter = new Chapter(chapDir, chapID, chapNum, doFullSetup);
                    chapters.Add(newchapter);
                    result.Add(newchapter);
                }
            }

            chapters = result;
            return(result.ToArray());
        }