public void Run(string mainPathInput, string mainPathOutput) { var logger = new Logger(); var characterNormaliserConverter = new CharacterNormaliserConverter(); var txtToListConverter = new TxtToListConverter(characterNormaliserConverter); var voiceBookmarkMetadataConverter = new VoiceBookmarkMetadataConverter(); var voiceBookMarksImporter = new VoiceBookmarksImporter(voiceBookmarkMetadataConverter, txtToListConverter); var simpleBookmarksImporter = new SimpleBookmarksImporter(txtToListConverter); var bookMetadataImporter = new BookMetadataImporter(logger); var txtBookImporter = new TxtBookImporter(txtToListConverter); var bookMetadatas = bookMetadataImporter.Import(mainPathInput); foreach (var bookMetadata in bookMetadatas) { logger.Info($"Started converting the book titled '{bookMetadata.BookName}'."); var bookImporter = GetBookImporter(txtBookImporter, bookMetadata); var book = bookImporter.Import(bookMetadata.BookPath); var bookmarksImporter = GetBookmarksImporter(voiceBookMarksImporter, simpleBookmarksImporter, bookMetadata); var bookmarkCollection = bookmarksImporter.Import(bookMetadata.BookmarksPath); var bookAndBookmarkCompiler = new BookAndBookmarkCompiler(logger); var(findings, paragraphsToOutput) = bookAndBookmarkCompiler.Compile(bookmarkCollection.Bookmarks, book); var paragraphProximityHelper = new ParagraphProximityHelper(); var metadatas = paragraphProximityHelper.GetBookmarkParagraphs(paragraphsToOutput, book); var htmlExporter = new HtmlExporter(); var outputLocation = mainPathOutput + "\\" + bookMetadata.BookName + ".html"; htmlExporter.Output(outputLocation, metadatas, book); logger.Info($"Converted the book titled '{bookMetadata.BookName}' and exported it to {outputLocation} successfully."); } Debugger.Break(); }
public TxtBookImporter(TxtToListConverter txtToListConverter) { TxtToListConverter = txtToListConverter; }