/// <summary> /// Opens the book asynchronously without reading its content. Holds the handle to the EPUB file. /// </summary> /// <param name="filePath">path to the EPUB file</param> /// <returns></returns> public static async Task <EpubBookRef> OpenBookAsync(string filePath) { IFiler filer = DependencyService.Get <IFiler>(); IZipFile zipFile = DependencyService.Get <IZipFile>(); if (!await filer.DoesFileExistAsync(filePath).ConfigureAwait(false)) { throw new FileNotFoundException("Specified epub file not found.", filePath); } IZipArchive epubArchive = await zipFile.OpenReadAsync(filePath).ConfigureAwait(false); EpubBookRef bookRef = new EpubBookRef(epubArchive); bookRef.FilePath = filePath; bookRef.Schema = await SchemaReader.ReadSchemaAsync(epubArchive).ConfigureAwait(false); bookRef.Title = bookRef.Schema.Package.Metadata.Titles.FirstOrDefault() ?? String.Empty; bookRef.AuthorList = bookRef.Schema.Package.Metadata.Creators.Select(creator => creator.Creator).ToList(); bookRef.Author = string.Join(", ", bookRef.AuthorList); bookRef.Content = await Task.Run(() => ContentReader.ParseContentMap(bookRef)).ConfigureAwait(false); return(bookRef); }