public addSpineReference ( |
||
spineReference | ||
Результат |
/// <summary> /// Adds the resource to the table of contents of the book as a child section of /// the given parentSection /// </summary> /// <param name="parentSection"></param> /// <param name="sectionTitle"></param> /// <param name="resource"></param> public TOCReference addSection(TOCReference parentSection, string sectionTitle, Resource resource) { getResources().add(resource); if (spine.findFirstResourceById(resource.getId()) < 0) { spine.addSpineReference(new SpineReference(resource)); } return parentSection.addChildSection(new TOCReference(sectionTitle, resource)); }
/// <summary> /// Creates a spine out of all resources in the resources. The generated spine /// consists of all XHTML pages in order of their href. /// </summary> /// <param name="resources"></param> private static Spine generateSpineFromResources(Resources resources) { Spine result = new Spine(); List<String> resourceHrefs = new List<String>(resources.getAllHrefs()); foreach (String resourceHref in resourceHrefs) { Resource resource = resources.getByHref(resourceHref); if (resource.getMediaType() == MediatypeService.NCX) { result.setTocResource(resource); } else if (resource.getMediaType() == MediatypeService.XHTML) { result.addSpineReference(new SpineReference(resource)); } } return result; }