/// /// <param name="mediaType"></param> /// <param name="counter"></param> private string createHref(MediaType mediaType, int counter) { if (MediatypeService.isBitmapImage(mediaType)) { return "image_" + counter + mediaType.getDefaultExtension(); } else { return "item_" + counter + mediaType.getDefaultExtension(); } }
/// /// <param name="resource"></param> private string getResourceItemPrefix(Resource resource) { String result; if (MediatypeService.isBitmapImage(resource.getMediaType())) { result = IMAGE_PREFIX; } else { result = ITEM_PREFIX; } return result; }
/// <summary> /// Finds the cover resource in the packageDocument and adds it to the book if /// found. Keeps the cover resource in the resources map /// </summary> /// <param>resources</param> /// <param name="packageDocument"></param> /// <param name="book"></param> private static void readCover(XElement packageDocument, Book book) { List<String> coverHrefs = findCoverHrefs(packageDocument); foreach (String coverHref in coverHrefs) { Resource resource = book.getResources().getByHref(coverHref); if (resource == null) { //log.error("Cover resource " + coverHref + " not found"); continue; } if (resource.getMediaType() == MediatypeService.XHTML) { book.setCoverPage(resource); } else if (MediatypeService.isBitmapImage(resource.getMediaType())) { book.setCoverImage(resource); } } }