2
// Help 2.0 Registration Utility
3
// Copyright (c) 2005 Mathias Simmack. All rights reserved.
5
namespace HtmlHelp2Registration.ItemClasses
8
using System.Collections.Generic;
9
using System.Collections.ObjectModel;
10
using System.Globalization;
13
using System.Xml.XPath;
14
using System.Xml.Serialization;
15
using HtmlHelp2Registration.HelperClasses;
17
public class NamespaceItemClass
20
private string description;
21
private string collection;
23
private bool merge = true;
24
private bool noremove = true;
25
private List<DocumentItemClass> documents = new List<DocumentItemClass>();
26
private List<FilterItemClass> filters = new List<FilterItemClass>();
27
private List<PluginChildItem> plugins = new List<PluginChildItem>();
28
private ReadOnlyCollection<string> connections = null;
30
public NamespaceItemClass(XPathNavigator rootNode)
34
throw new ArgumentNullException("rootNode");
37
this.name = XmlHelperClass.GetXmlStringValue(rootNode, "@name");
38
this.description = XmlHelperClass.GetXmlStringValue(rootNode, "@description");
39
this.collection = XmlHelperClass.GetXmlStringValue(rootNode, "@file");
40
this.update = XmlHelperClass.GetXmlBoolValue(rootNode, "@update");
41
this.merge = XmlHelperClass.GetXmlBoolValue(rootNode, "@merge", true);
42
this.noremove = XmlHelperClass.GetXmlBoolValue(rootNode, "@noremove");
43
this.connections = PluginSearch.FindPluginAsGenericList(this.name);
45
this.Initialize(rootNode);
48
void Initialize(XPathNavigator rootNode)
50
// get all related documents
51
XPathNodeIterator files =
52
rootNode.SelectChildren("file", ApplicationHelpers.Help2NamespaceUri);
53
while (files.MoveNext())
55
this.documents.Add(new DocumentItemClass(files.Current));
58
// get all related filters
59
XPathNodeIterator filters =
60
rootNode.SelectChildren("filter", ApplicationHelpers.Help2NamespaceUri);
61
while (filters.MoveNext())
63
this.filters.Add(new FilterItemClass(filters.Current));
66
// get all related plugins
68
rootNode.SelectChildren("plugin", ApplicationHelpers.Help2NamespaceUri);
71
XPathNodeIterator child =
72
p.Current.SelectChildren("child", ApplicationHelpers.Help2NamespaceUri);
73
while (child.MoveNext())
75
this.plugins.Add(new PluginChildItem(child.Current));
83
get { return this.name; }
86
public string Description
88
get { return this.description; }
91
public string CollectionLevelFile
93
get { return this.collection; }
96
public bool ForceCreation
98
get { return !this.update; }
103
get { return this.merge; }
108
get { return !this.noremove; }
111
public ReadOnlyCollection<DocumentItemClass> Documents
115
ReadOnlyCollection<DocumentItemClass> roDocuments =
116
new ReadOnlyCollection<DocumentItemClass>(this.documents);
121
public ReadOnlyCollection<FilterItemClass> Filters
125
ReadOnlyCollection<FilterItemClass> roFilters =
126
new ReadOnlyCollection<FilterItemClass>(this.filters);
131
public ReadOnlyCollection<PluginChildItem> Plugins
135
ReadOnlyCollection<PluginChildItem> roPlugins =
136
new ReadOnlyCollection<PluginChildItem>(this.plugins);
141
public ReadOnlyCollection<string> ConnectedNamespaces
143
get { return this.connections; }
147
public override string ToString()
149
return string.Format(CultureInfo.InvariantCulture, "[Help 2.0 Namespace; {0}, {1}]", this.name, this.description);