Esempio n. 1
0
        public static void Strip(string ebookPath, string outputDir, string name, string ccNumber)
        {
            if (string.IsNullOrEmpty(outputDir))
            {
                outputDir = Path.GetDirectoryName(ebookPath);
            }
            var ebook = new Pdb(ebookPath);

            var processor = new EReaderProcessor(ebook, name, ccNumber);

            outputDir = Path.Combine(outputDir, ebook.Filename);
            if (!Directory.Exists(outputDir))
            {
                Directory.CreateDirectory(outputDir);
            }
            string path;

            for (var i = 0; i < processor.numImagePages; i++)
            {
                var img = processor.GetImage(i);
                path = Path.Combine(outputDir, img.filename);
                using (var stream = File.Create(path))
                    stream.Write(img.content, 0, img.content.Length);
            }
            var pml = processor.GetText();

            path = Path.Combine(outputDir, ebook.Filename + ".pml");
            using (var stream = File.CreateText(path))
                stream.Write(pml);
        }
Esempio n. 2
0
        public static void Strip(string ebookPath, string outputDir, string name, string ccNumber)
        {
            if (string.IsNullOrEmpty(outputDir)) outputDir = Path.GetDirectoryName(ebookPath);
            var ebook = new Pdb(ebookPath);

            var processor = new EReaderProcessor(ebook, name, ccNumber);
            outputDir = Path.Combine(outputDir, ebook.Filename);
            if (!Directory.Exists(outputDir)) Directory.CreateDirectory(outputDir);
            string path;
            for (int i = 0; i < processor.numImagePages; i++)
            {
                EReaderImageInfo img = processor.GetImage(i);
                path = Path.Combine(outputDir, img.filename);
                using (FileStream stream = File.Create(path)) stream.Write(img.content, 0, img.content.Length);
            }
            string pml = processor.GetText();
            path = Path.Combine(outputDir, ebook.Filename + ".pml");
            using (StreamWriter stream = File.CreateText(path)) stream.Write(pml);
        }