Exemple #1
0
 public EpubConverter(string epubFolder, string bookFolder, BookMetadata metadata, XmlDocument bloomDoc)
 {
     _metadata   = metadata;
     _epubFolder = epubFolder;
     _bookFolder = bookFolder;
     _bloomDoc   = bloomDoc;
 }
Exemple #2
0
        public static void Main(string[] args)
        {
            var bookName   = "Too Much Noise";
            var baseFolder = "/d/steve/MyTest/BL/BL-6981/";

            ExtractZippedFiles(Path.Combine(baseFolder, bookName) + ".epub", Path.Combine(baseFolder, bookName, "epub"));
            var metadata = new BookMetadata(Path.Combine(baseFolder, bookName, "epub"));

            Console.WriteLine("Title = {0}", metadata.Title);
            Console.WriteLine("Author = {0}", String.Join(", ", metadata.Authors));
            Console.WriteLine("Modified = {0}", metadata.Modified.ToString());
            Console.WriteLine("Illustrator = {0}", String.Join(", ", metadata.Illustrators));
            Console.WriteLine("Page files = {0}", String.Join("\n", metadata.PageFiles));
            Console.WriteLine("Image files = {0}", String.Join("\n", metadata.ImageFiles));

            ExtractZippedFiles("/d/steve/MyTest/BL/BL-6981/BlankBloom.zip", Path.Combine(baseFolder, bookName, bookName));
            File.Move(Path.Combine(baseFolder, bookName, bookName, "Book.htm"), Path.Combine(baseFolder, bookName, bookName, bookName + ".htm"));
            var bloomDoc = new XmlDocument();

            bloomDoc.PreserveWhitespace = true;
            bloomDoc.Load(Path.Combine(baseFolder, bookName, bookName, bookName + ".htm"));

            var epubConverter = new EpubConverter(Path.Combine(baseFolder, bookName, "epub"), Path.Combine(baseFolder, bookName, bookName), metadata, bloomDoc);

            epubConverter.ConvertBook();
            File.Move(Path.Combine(baseFolder, bookName, bookName, bookName + ".htm"), Path.Combine(baseFolder, bookName, bookName, "bookhtml.bak"));
            bloomDoc.Save(Path.Combine(baseFolder, bookName, bookName, bookName + ".htm"));
        }