public async Task DownloadThread(int nHentaiId, WinForms.FolderBrowserDialog folder) { Doujin doujin = new Doujin(nHentaiId); string newName = doujin.name.Replace("/", "").Replace("?", "").Replace("%", "").Replace("*", "").Replace(":", "").Replace("|", "").Replace(".", "").Replace("<", "").Replace(">", "").Replace('"'.ToString(), ""); if (!Directory.Exists($@"{folder.SelectedPath}/{newName}")) { using (WebClient client = new WebClient()) { int i = 1; var notify = Notifications.Notifications.CreateNotificationWPBarNImg("Download", $"{doujin.name} is being downloaded", $"{i} of {doujin.pageCount}", 1, doujin.pageCount); notify.LayoutTransform = new RotateTransform(180); var window = DoujinUtility.MainWindow; window.notificationPanellul.Children.Add(notify); foreach (string ext in DoujinUtility.GetPage(doujin)) { Console.WriteLine($"https://i.nhentai.net/galleries/{doujin.mediaId}/{i}{ext}, {folder.SelectedPath}/{newName}/{i}{ext}"); Directory.CreateDirectory($@"{folder.SelectedPath}/{newName}"); await Task.Run(() => client.DownloadFile(new Uri("https://i.nhentai.net/galleries/" + doujin.mediaId + "/" + i + ext), $@"{folder.SelectedPath}/{newName}/{i}{ext}")); notify.UpdateNotificationWBarNImg($"{i} of {doujin.pageCount}", i); i++; } // OR } } else { Console.WriteLine("DAS GIBTS DOCH SCHON!!!!11!!elf"); } }
public DoujinViewer(int mediaid, int nhentaiid, int pages, string coverurl, string ext) { InitializeComponent(); viewport.BeginInit(); gDoujin.mediaId = mediaid; gDoujin.nhentaiId = nhentaiid; gDoujin.pageCount = pages; gDoujin.coverUrl = coverurl; gDoujin.coverExt = ext; gDoujin.thumbnailExt = ext; Load(gDoujin); viewport.EndInit(); gDoujin.pageExt = DoujinUtility.GetPage(nhentaiid); }