/// <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); }
public async Task <List <EpubChapterRef> > GetChaptersAsync() { return(await Task.Run(() => ChapterReader.GetChapters(this)).ConfigureAwait(false)); }