Example #1
0
        private void ButtonGenerateManga_Click(object sender, EventArgs e)
        {
            StatusBar.Clear();

            // Validate the url exists.

            Uri uriResult;
            if (!Uri.TryCreate(TextBoxMangaUrl.Text, UriKind.Absolute, out uriResult))
            {
                StatusBar.Error(ErrorType.InvalidUrl, TextBoxMangaUrl.Text);
                return;
            }

            // Validate the save folder exists.

            if (!Directory.Exists(TextBoxSaveFolder.Text))
            {
                StatusBar.Error(ErrorType.SaveFolderDoesNotExist, TextBoxSaveFolder.Text);
                return;
            }

            // TODO: Use dependency injection framework for this.

            ComicBookZipFileSerialiser serialiser = new ComicBookZipFileSerialiser(StatusBar);
            MangaMakerManager manager = new MangaMakerManager(serialiser);
            IEnumerable<string> downloadList = CreateDownloadList();

            foreach (string downloadUrl in downloadList)
            {
                Uri url = new Uri(downloadUrl);
                HtmlDocumentProcessor htmlProcessor = new HtmlDocumentProcessor();
                IMangaSiteImageDownloader downloader = new MangareaderSiteImageDownloader(htmlProcessor, StatusBar);

                manager.GenerateManga(url, downloader, TextBoxSaveFolder.Text, StatusBar);
            }
        }
        public MangaMakerManager(ComicBookZipFileSerialiser comicBookZipFileSerialiser)
        {
            if (comicBookZipFileSerialiser == null) throw new ArgumentNullException("comicBookZipFileSerialiser");

            ComicBookZipFileSerialiser = comicBookZipFileSerialiser;
        }
Example #3
0
 public static MangaMakerManager CreateMangaMakerManager(ComicBookZipFileSerialiser serialiser)
 {
     return new MangaMakerManager(serialiser);
 }