Ejemplo n.º 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string mUrl = "https://kissmanga.org/manga/fruits_basket";

            string name = KissMangaHelper.GetName(mUrl);

            string[] chapters = KissMangaHelper.GetChapterUrls(mUrl);

            string cUrl = chapters[0];

            string[] pages = KissMangaHelper.GetPageUrls(KissMangaHelper.KISS_URL + cUrl);
            string   hash  = KissMangaHelper.GetHash(mUrl);
            bool     x     = false;
        }
Ejemplo n.º 2
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            string url  = gfxBrowser.Url.ToString();
            string name = string.Empty;
            string num  = string.Empty;

            switch (cmboSource.SelectedItem.ToString().ToLower())
            {
            case "mangadex":
                name = url.Split('/')[5];
                num  = url.Split('/')[4];
                url  = MangaDexHelper.MANGADEX_URL + "/api/manga/" + num;

                Manga m = new MangaDex(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, num)), url);

                FrmEdit      editor = new FrmEdit(m, false);
                DialogResult result = editor.ShowDialog();

                if (result == DialogResult.OK)
                {
                    // cleanup
                    foreach (Chapter ch in m.GetChapters())
                    {
                        try
                        {
                            string s = ch.GetChapterRoot().ToString();
                            Directory.Delete(ch.GetChapterRoot().ToString());
                        } catch (Exception) { }
                    }

                    WFClient.dbm.GetMangaDB().Add(m);

                    String[] dls = m.GetDLChapters();
                    if (dls == null || dls[0].Equals("-1"))
                    {
                        foreach (Chapter c in m.GetSetPrunedChapters(false))
                        {
                            WFClient.dlm.AddToQueue(new MangaDexDownload(c));
                        }
                    }
                    else
                    {       // Only download selected chapters
                        foreach (Chapter c in m.GetSetPrunedChapters(false))
                        {
                            if (dls.Contains(c.GetNum()))
                            {
                                WFClient.dlm.AddToQueue(new MangaDexDownload(c));
                            }
                        }
                    }
                    // Start downloading the first one
                    WFClient.dlm.DownloadNext();
                }
                else
                {
                }
                break;

            case "kissmanga":

                // MessageBox.Show("Sorry, can't do this yet! ;(\n\n(ignore the download started box)");
                // break;
                // TODO

                string kName = KissMangaHelper.GetName(url);
                string kHash = KissMangaHelper.GetHash(url);

                // Manga km = new Manga(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, num)), url);

                Manga km = new KissManga(FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, kHash)), url);

                FrmEdit      editor1 = new FrmEdit(km, false);
                DialogResult result1 = editor1.ShowDialog();

                if (result1 == DialogResult.OK)
                {
                    // cleanup
                    foreach (Chapter ch in km.GetChapters())
                    {
                        try
                        {
                            string s = ch.GetChapterRoot().ToString();
                            Directory.Delete(ch.GetChapterRoot().ToString());
                        }
                        catch (Exception) { }
                    }

                    WFClient.dbm.GetMangaDB().Add(km);

                    String[] dls = km.GetDLChapters();
                    if (dls == null || dls[0].Equals("-1"))
                    {
                        foreach (Chapter c in km.GetSetPrunedChapters(false))
                        {
                            WFClient.dlm.AddToQueue(new KissMangaDownload(c));
                        }
                    }
                    else
                    {       // Only download selected chapters
                        foreach (Chapter c in km.GetSetPrunedChapters(false))
                        {
                            if (dls.Contains(c.GetNum()))
                            {
                                WFClient.dlm.AddToQueue(new KissMangaDownload(c));
                            }
                        }
                    }
                    // Start downloading the first one
                    WFClient.dlm.DownloadNext();
                }
                else
                {
                }
                break;

            case "nhentai":
                num  = url.Split('/')[4];
                name = gfxBrowser.DocumentTitle.Substring(0, gfxBrowser.DocumentTitle.IndexOf("nhentai:") - 3);

                JObject hJson = new JObject(
                    new JProperty("hentai",
                                  new JObject(
                                      new JProperty("title", name),
                                      new JProperty("num", num),
                                      new JProperty("url", url))));

                DirectoryInfo hDir = FileHelper.CreateDI(Path.Combine(FileHelper.APP_ROOT.FullName, "h" + num));

                Hentai h = new Nhentai(hDir, hJson.ToString());

                FrmEdit      edit   = new FrmEdit(h, false);
                DialogResult rezult = edit.ShowDialog();

                if (rezult == DialogResult.OK)
                {
                    WFClient.dbm.GetMangaDB().Add(h);

                    Chapter ch = h.GetChapters()[0];
                    WFClient.dlm.AddToQueue(new NhentaiDownload(ch));
                    // Start downloading the first one
                    WFClient.dlm.DownloadNext();
                }
                break;
            }
            MessageBox.Show("Download started! You may close the browser at any time, but please keep MikuReader open until the download has completed.");
        }