public void AddSubNavPoint(IBaseXHTMLFile subcontent, string name) { if (subcontent.NavigationParent == null) { throw new ArgumentException(@"Can't add subpoint without a parent","subcontent"); } var newPoint = new NavPointV3 { Content = subcontent.PathInEPUB.GetRelativePath(NAVFilePath, subcontent.FlatStructure), Name = name, Id = subcontent.Id }; var parentPoint = _documentNavigationMap.Find(x => (x.Id == subcontent.NavigationParent.Id)); if (parentPoint != null) { parentPoint.SubPoints.Add(newPoint); } else { // iterate all top level content foreach (var element in _documentNavigationMap) { // here "AllContent) will return all the sub elements (any depth) of given top level element // so we look for parent in all this elements parentPoint = element.AllContent().Find(x => (x.Id == subcontent.NavigationParent.Id)); if (parentPoint != null) { parentPoint.SubPoints.Add(newPoint); return; } } throw new Exception("no such point to add sub point"); } }
public void AddSubNavPoint(IBaseXHTMLFile subcontent, string name) { if (subcontent.NavigationParent == null) { throw new ArgumentException(@"Can't add subpoint without a parent", "subcontent"); } var newPoint = new NavPointV3 { Content = subcontent.PathInEPUB.GetRelativePath(NAVFilePath, subcontent.FlatStructure), Name = name, Id = subcontent.Id }; var parentPoint = _documentNavigationMap.Find(x => (x.Id == subcontent.NavigationParent.Id)); if (parentPoint != null) { parentPoint.SubPoints.Add(newPoint); } else { // iterate all top level content foreach (var element in _documentNavigationMap) { // here "AllContent) will return all the sub elements (any depth) of given top level element // so we look for parent in all this elements parentPoint = element.AllContent().Find(x => (x.Id == subcontent.NavigationParent.Id)); if (parentPoint != null) { parentPoint.SubPoints.Add(newPoint); return; } } throw new Exception("no such point to add sub point"); } }
public void AddTOCNavPoint(IBaseXHTMLFile content, string name) { if (string.IsNullOrEmpty(name)) { return; } var bookPoint = new NavPointV3 { Content = content.PathInEPUB.GetRelativePath(NAVFilePath, content.FlatStructure), Name = name, Id = content.Id }; _documentNavigationMap.Add(bookPoint); }
public void AddTOCNavPoint(IBaseXHTMLFile content, string name) { if (string.IsNullOrEmpty(name)) { return; } var bookPoint = new NavPointV3 { Content = content.PathInEPUB.GetRelativePath(NAVFilePath, content.FlatStructure), Name = name, Id = content.Id}; _documentNavigationMap.Add(bookPoint); }