Permalink
Browse files

Refactoring

- Do not make library user generate ids for navpoints
- Provide way to add non-linear xhtml items
  • Loading branch information...
1 parent b8c12b0 commit 963c5b018b511640612d4e148353828d70dd308e @gonzoua committed Jul 30, 2011
Showing with 20 additions and 5 deletions.
  1. +16 −4 dotNetEpub/EPUB.cs
  2. +4 −1 dotNetEpub/NavPoint.cs
View
@@ -283,8 +283,14 @@ public string AddStylesheetFile(string path, string epubPath)
public string AddXhtmlFile(string path, string epubPath)
{
+
+ return AddXhtmlFile(path, epubPath, false);
+ }
+
+ public string AddXhtmlFile(string path, string epubPath, bool linear)
+ {
CopyFile(path, epubPath);
- return AddXhtmlEntry(epubPath);
+ return AddXhtmlEntry(epubPath, linear);
}
public string AddFile(string path, string epubPath, string mediaType)
@@ -306,10 +312,15 @@ public string AddStylesheetData(string epubPath, string content)
return AddStylesheetEntry(epubPath);
}
- public string AddXhtmlData(string epubPath, string content)
+ public string AddXhtmlData(string epubPath, string content, bool linear)
{
WriteFile(epubPath, content);
- return AddXhtmlEntry(epubPath);
+ return AddXhtmlEntry(epubPath, linear);
+ }
+
+ public string AddXhtmlData(string epubPath, string content)
+ {
+ return AddXhtmlData(epubPath, content, false);
}
public string AddData(string epubPath, byte[] content, string mediaType)
@@ -346,8 +357,9 @@ private void WriteContainer()
e.Save(fullPath);
}
- public NavPoint AddNavPoint(string label, string id, string content, int playOrder)
+ public NavPoint AddNavPoint(string label, string content, int playOrder)
{
+ String id = GetNextId("navid");
return _ncx.AddNavPoint(label, id, content, playOrder);
}
}
View
@@ -22,6 +22,7 @@ public NavPoint(string label, string id, string content, int playOrder, string @
_content = content;
_playOrder = playOrder;
_class = @class;
+
_navpoints = new List<NavPoint>();
}
@@ -31,8 +32,10 @@ public NavPoint(string label, string id, string content, int playOrder)
}
- public NavPoint Add(string label, string id, string content, int playOrder)
+ public NavPoint Add(string label, string content, int playOrder)
{
+ string id = _id + "x" + (_navpoints.Count + 1).ToString();
+
NavPoint n = new NavPoint(label, id, content, playOrder);
_navpoints.Add(n);
return n;

0 comments on commit 963c5b0

Please sign in to comment.