getContents() public method

All Resources of the Book that can be reached via the Spine, the TableOfContents or the Guide.

Consists of a list of "reachable" resources:

  • The coverpage
  • The resources of the Spine that are not already in the result
  • The resources of the Table of Contents that are not already in the result
  • The resources of the Guide that are not already in the result
To get all html files that make up the epub file use
public getContents ( ) : List
return List
コード例 #1
0
ファイル: BookTest.cs プロジェクト: lanfengqi/EpubLib-Sharp
 public void testGetContents1()
 {
     Book book = new Book();
     Resource resource1 = new Resource("id1", System.Text.Encoding.UTF8.GetBytes("Hello, world !"), "chapter1.html", MediatypeService.XHTML);
     book.getSpine().addResource(resource1);
     book.getTableOfContents().addSection(resource1, "My first chapter");
     Assert.AreEqual(1, book.getContents().Count);
 }
コード例 #2
0
ファイル: BookTest.cs プロジェクト: lanfengqi/EpubLib-Sharp
 public void testGetContents3()
 {
     Book book = new Book();
     Resource resource1 = new Resource("id1", System.Text.Encoding.UTF8.GetBytes("Hello, world !"), "chapter1.html", MediatypeService.XHTML);
     book.getSpine().addResource(resource1);
     Resource resource2 = new Resource("id1", System.Text.Encoding.UTF8.GetBytes("Hello, world !"), "chapter2.html", MediatypeService.XHTML);
     book.getTableOfContents().addSection(resource2, "My first chapter");
     book.getGuide().addReference(new GuideReference(resource2, GuideReference.FOREWORD, "The Foreword"));
     Assert.AreEqual(2, book.getContents().Count);
 }