public static EpubSchema ReadSchema(ZipArchive epubArchive) { EpubSchema result = new EpubSchema(); string rootFilePath = RootFilePathReader.GetRootFilePath(epubArchive); string contentDirectoryPath = ZipPathUtils.GetDirectoryPath(rootFilePath); result.ContentDirectoryPath = contentDirectoryPath; EpubPackage package = PackageReader.ReadPackage(epubArchive, rootFilePath); result.Package = package; EpubNavigation navigation = NavigationReader.ReadNavigation(epubArchive, contentDirectoryPath, package); result.Navigation = navigation; return result; }
public static async Task<EpubSchema> ReadSchemaAsync(ZipArchive epubArchive) { EpubSchema result = new EpubSchema(); // Reading META-INF/container.xml string rootFilePath = await RootFilePathReader.GetRootFilePathAsync(epubArchive); // Getting directory path - usually it's: META-INF/ string contentDirectoryPath = ZipPathUtils.GetDirectoryPath(rootFilePath); result.ContentDirectoryPath = contentDirectoryPath; //Reading the file content.opf EpubPackage package = await PackageReader.ReadPackageAsync(epubArchive, rootFilePath); result.Package = package; EpubNavigation navigation = await NavigationReader.ReadNavigationAsync(epubArchive, contentDirectoryPath, package); result.Navigation = navigation; return result; }