Exemplo n.º 1
0
        /// <summary>
        ///     Opens the book asynchronously and reads all of its content into the memory. Does not hold the handle to the EPUB file.
        /// </summary>
        /// <param name="stream">Stream of EPUB book</param>
        /// <returns><seealso cref="EpubBook"/></returns>
        public static async Task <EpubBook> ReadBookAsync(Stream stream)
        {
            var result = new EpubBook();

            using (var epubBookRef = await OpenBookAsync(stream).ConfigureAwait(false))
            {
                result.Schema     = epubBookRef.Schema;
                result.Title      = epubBookRef.Title;
                result.AuthorList = epubBookRef.AuthorList;
                result.Content    = await ReadContent(epubBookRef.Content).ConfigureAwait(false);

                result.CoverImage = await BookCoverReader.ReadBookCoverAsync(epubBookRef).ConfigureAwait(false);

                var chapterRefs = ChapterReader.GetChapters(epubBookRef);
                result.Chapters = await ReadChapters(chapterRefs).ConfigureAwait(false);
            }

            return(result);
        }
Exemplo n.º 2
0
 public async Task <byte[]> ReadCoverAsync()
 {
     return(await BookCoverReader.ReadBookCoverAsync(this).ConfigureAwait(false));
 }