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

            return(memoryStream);
        }
예제 #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);
        }