public WebBrowser() { InitializeComponent(); NicoWeb.Source = new Uri(this.baseurl.ToString()); this.Next.IsEnabled = false; this.Back.IsEnabled = false; this.DL.IsEnabled = false; this.NicoManga = new NicoMangaClass(); this.Title = ""; }
private void Button_Click_1(object sender, RoutedEventArgs e) { NicoMangaClass NicoManga = new NicoMangaClass(); PdfClass pdf = new PdfClass(); bool idflag = true; bool loginflag; string[] id = new string[3]; string type; if (NicoClass.nicologinflag) { loginflag = true; } else { if (NicoManga.NicoLogin(NicoFileClass.mail, NicoFileClass.password)) { this.log.Text += "ログインに成功しました\r\n"; loginflag = true; } else { this.log.Text += "ログインに失敗しました\r\n"; loginflag = false; } } if (mgid0.Text != "" && NicoManga.MangaIdCheck(mgid0.Text)) { id[0] = mgid0.Text; } else { idflag = false; } if (mgid1.Text != "" && NicoManga.MangaIdCheck(mgid2.Text)) { id[1] = mgid1.Text; } else { id[1] = ""; } if (mgid2.Text != "" && NicoManga.MangaIdCheck(mgid1.Text)) { id[2] = mgid2.Text; } else { id[2] = ""; } mgid0.Text = ""; mgid1.Text = ""; mgid2.Text = ""; if (loginflag && idflag) { type = Global.GraphFormatTypeNameGet(int.Parse(NicoFileClass.formattype)); NicoManga.MangaInfoMultiGet(id); NicoManga.MangaIllustInfoMultiGet(id); for (int i = 0; i < 3; i++) { if (id[i] != "") { this.log.Text += NicoManga.mangainfomulti[i].id + ":ダウンロードを開始しました\r\n"; if (NicoManga.mangaimagemulti[i].flag&&NicoManga.mangainfomulti[i].image_player_id<=0) { if (type != "pdf") { if (NicoManga.MangaIllustDownload(NicoManga.mangaimagemulti[i], NicoManga.mangainfomulti[i].title, NicoFileClass.userfolderpath, type)) { this.log.Text += NicoManga.mangainfomulti[i].id + ":ダウンロードに成功しました\r\n"; } else { this.log.Text += NicoManga.mangainfomulti[i].id + ":ダウンロードに失敗しました\r\n"; } } else { if (NicoManga.MangaIllustDownload(NicoManga.mangaimagemulti[i], "tmp", NicoFileClass.baseuserfolderpath, "jpg")) { pdf.GraphConvertPdf(NicoManga.mangainfomulti[i].title, NicoFileClass.userfolderpath, NicoFileClass.baseuserfolderpath + "\\tmp", "jpg"); System.IO.Directory.Delete("tmp", true); this.log.Text += NicoManga.mangainfomulti[i].id + ":ダウンロードに成功しました\r\n"; } else { this.log.Text += NicoManga.mangainfomulti[i].id + ":ダウンロードに失敗しました\r\n"; } } } else { if (NicoManga.mangainfomulti[i].image_player_id > 0) { this.log.Text += NicoManga.mangainfomulti[i].id + ":この漫画はダウンロードできません\r\n"; } else { this.log.Text += NicoManga.mangainfomulti[i].id + ":ダウンロードに失敗しました\r\n"; } } this.log.Text += "\r\n"; } } } else { if (!loginflag) { MessageBox.Show("ログインに失敗しました"); } if (!idflag) { MessageBox.Show("1件以上は入力してください"); } } }
private void Button_Click4(object sender, RoutedEventArgs e) { NicoMangaClass NicoManga = new NicoMangaClass(); string id = NicoManga.MangaIdSearch(this.NicoWeb.Source.ToString()); string type; bool flag; if (id !=null) { if (NicoClass.nicologinflag) { flag = true; } else { if (NicoManga.NicoLogin(NicoFileClass.mail, NicoFileClass.password)) { flag = true; this.MainWindowPointer.log.Text += "ログインに成功しました\r\n"; } else { flag = false; this.MainWindowPointer.log.Text += "ログインに失敗しました\r\n"; } } if (flag) { NicoManga.MangaInfoGet(id); NicoManga.MangaIllustInfoGet(id); this.MainWindowPointer.log.Text += id + ":ダウンロードを開始しました\r\n"; if (NicoManga.mangaimageinfo.flag&&NicoManga.mangainfo.image_player_id<=0) { type = Global.GraphFormatTypeNameGet(int.Parse(NicoFileClass.formattype)); if (type != "pdf") { if (NicoManga.MangaIllustDownload(NicoManga.mangaimageinfo, NicoManga.mangainfo.title, NicoFileClass.userfolderpath, type)) { this.MainWindowPointer.log.Text += id + ":ダウンロードに成功しました\r\n"; } else { this.MainWindowPointer.log.Text += id + ":ダウンロードに失敗しました\r\n"; } } else { if (NicoManga.MangaIllustDownload(NicoManga.mangaimageinfo, "tmp", NicoFileClass.baseuserfolderpath, "jpg")) { PdfClass pdf = new PdfClass(); pdf.GraphConvertPdf(NicoManga.mangainfo.title, NicoFileClass.userfolderpath, NicoFileClass.baseuserfolderpath + "\\tmp", "jpg"); System.IO.Directory.Delete("tmp", true); this.MainWindowPointer.log.Text += id + ":ダウンロードに成功しました\r\n"; } else { this.MainWindowPointer.log.Text += id + ":ダウンロードに失敗しました\r\n"; } } } else { if (NicoManga.mangainfo.image_player_id > 0) { this.MainWindowPointer.log.Text += id + ":この漫画はダウンロードできません\r\n"; } } this.MainWindowPointer.log.Text += "\r\n"; } else { System.Windows.MessageBox.Show("ログインに失敗しました"); } } else { System.Windows.MessageBox.Show("この漫画はダウンロードできません"); } this.MainWindowPointer.Topmost = true; }