public static int Handle(GetUsedFontsParameters options) { if (!Directory.Exists(options.BookPath)) { if (options.BookPath.Contains(".htm")) { Debug.WriteLine("Supply only the directory, not the path to the file."); Console.Error.WriteLine("Supply only the directory, not the path to the file."); } else { Debug.WriteLine("Could not find " + options.BookPath); Console.Error.WriteLine("Could not find " + options.BookPath); } return(1); } Console.WriteLine("Gathering font data."); // Some of this might be useful if we end up needing to instantiate the book to figure out what // is REALLY needed (as opposed to just mentioned in a style sheet). //var collectionFolder = Path.GetDirectoryName(options.BookPath); //var projectSettingsPath = Directory.GetFiles(collectionFolder, "*.bloomCollection").FirstOrDefault(); //var collectionSettings = new CollectionSettings(projectSettingsPath); //XMatterPackFinder xmatterFinder = new XMatterPackFinder(new[] {BloomFileLocator.GetInstalledXMatterDirectory()}); //var locator = new BloomFileLocator(collectionSettings, xmatterFinder, ProjectContext.GetFactoryFileLocations(), // ProjectContext.GetFoundFileLocations(), ProjectContext.GetAfterXMatterFileLocations()); //var bookInfo = new BookInfo(options.BookPath, true); //var book = new Book.Book(bookInfo, new BookStorage(options.BookPath, locator, new BookRenamedEvent(), collectionSettings), // null, collectionSettings, null, null, new BookRefreshEvent()); //book.BringBookUpToDate(new NullProgress()); var fonts = EpubMaker.GetFontsUsed(options.BookPath, false).ToList(); fonts.Sort(); Directory.CreateDirectory(Path.GetDirectoryName(options.ReportPath)); using (var report = new StreamWriter(options.ReportPath)) { foreach (var font in fonts) { report.WriteLine(font); } } Console.WriteLine("Finished gathering font data."); Debug.WriteLine("Finished gathering font data."); return(0); }
public static int Handle(GetUsedFontsParameters options) { if(!Directory.Exists(options.BookPath)) { if(options.BookPath.Contains(".htm")) { Debug.WriteLine("Supply only the directory, not the path to the file."); Console.Error.WriteLine("Supply only the directory, not the path to the file."); } else { Debug.WriteLine("Could not find " + options.BookPath); Console.Error.WriteLine("Could not find " + options.BookPath); } return 1; } Console.WriteLine("Gathering font data."); // Some of this might be useful if we end up needing to instantiate the book to figure out what // is REALLY needed (as opposed to just mentioned in a style sheet). //var collectionFolder = Path.GetDirectoryName(options.BookPath); //var projectSettingsPath = Directory.GetFiles(collectionFolder, "*.bloomCollection").FirstOrDefault(); //var collectionSettings = new CollectionSettings(projectSettingsPath); //XMatterPackFinder xmatterFinder = new XMatterPackFinder(new[] {BloomFileLocator.GetInstalledXMatterDirectory()}); //var locator = new BloomFileLocator(collectionSettings, xmatterFinder, ProjectContext.GetFactoryFileLocations(), // ProjectContext.GetFoundFileLocations(), ProjectContext.GetAfterXMatterFileLocations()); //var bookInfo = new BookInfo(options.BookPath, true); //var book = new Book.Book(bookInfo, new BookStorage(options.BookPath, locator, new BookRenamedEvent(), collectionSettings), // null, collectionSettings, null, null, new BookRefreshEvent()); //book.BringBookUpToDate(new NullProgress()); var fonts = EpubMaker.GetFontsUsed(options.BookPath, false).ToList(); fonts.Sort(); fonts.Remove("inherit"); // not a real font! Directory.CreateDirectory(Path.GetDirectoryName(options.ReportPath)); using (var report = new StreamWriter(options.ReportPath)) { foreach (var font in fonts) { report.WriteLine(font); } } Console.WriteLine("Finished gathering font data."); Debug.WriteLine("Finished gathering font data."); return 0; }