Esempio n. 1
0
        public static async Task <MemoryStream> SaveMobiDocument(MobiDocument document)
        {
            MemoryStream memoryStream = new MemoryStream();
            await document.Write(memoryStream);

            return(memoryStream);
        }
Esempio n. 2
0
        public static async Task <MobiDocument> GetMobiDocument(Stream stream)
        {
            var mobiDocument = new MobiDocument(stream);

            mobiDocument.PDBHeader = new PDBHeader(stream);
            await mobiDocument.PDBHeader.LoadPDBHeader();

            mobiDocument.MOBIHeader = new MOBIHeader(stream, mobiDocument.PDBHeader.MobiHeaderSize);
            await mobiDocument.MOBIHeader.LoadMobiHeader();

            stream.Position             = 0;
            mobiDocument.CoverExtractor = new CoverExtractor(stream);
            return(mobiDocument);
        }