public PluginParentItem(XPathNavigator pluginRootnode) : this() { if (pluginRootnode == null) { throw new ArgumentNullException("pluginRootnode"); } _realName = XmlHelper.GetXmlStringValue(pluginRootnode, "parent"); _matchingName = PluginSearch.GetFirstMatchingNamespaceName(_realName); _merge = XmlHelper.GetXmlBoolValue(pluginRootnode, "merge", true); string childName = XmlHelper.GetXmlStringValue(pluginRootnode, "child"); if (!String.IsNullOrEmpty(childName)) { _children.Add(new PluginChildItem(childName)); } else { XPathNodeIterator pChild = pluginRootnode.SelectChildren("child", String.Empty); while (pChild.MoveNext()) { _children.Add(new PluginChildItem(pChild.Current)); } } }
/// <summary> /// /// </summary> /// <param name="childName"></param> public PluginChildItem(string childName) { if (String.IsNullOrEmpty(childName)) { throw new ArgumentNullException("childName"); } _realName = childName; _matchingName = PluginSearch.GetFirstMatchingNamespaceName(_realName); }
/// <summary> /// /// </summary> /// <param name="pluginRootnode"></param> public PluginChildItem(XPathNavigator pluginRootnode) { if (pluginRootnode == null) { throw new ArgumentNullException("pluginRootnode"); } _realName = XmlHelper.GetXmlStringValue(pluginRootnode, "name"); _matchingName = PluginSearch.GetFirstMatchingNamespaceName(_realName); }
/// <summary> /// /// </summary> /// <param name="rootNode"></param> public NamespaceItem(XPathNavigator rootNode) : this() { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } _name = XmlHelper.GetXmlStringValue(rootNode, "name"); _description = XmlHelper.GetXmlStringValue(rootNode, "description"); _collection = XmlHelper.GetXmlStringValue(rootNode, "file"); _update = XmlHelper.GetXmlBoolValue(rootNode, "update"); _merge = XmlHelper.GetXmlBoolValue(rootNode, "merge", true); _noremove = XmlHelper.GetXmlBoolValue(rootNode, "noremove"); _connections = PluginSearch.FindPluginAsGenericList(_name); Initialize(rootNode); }
private bool PluginAction(string parentNamespace, string childNamespace, bool registerIt) { if (_hxRegister == null || _hxPlugins == null || String.IsNullOrEmpty(parentNamespace) || String.IsNullOrEmpty(childNamespace) || !_hxRegister.IsNamespace(parentNamespace) || !_hxRegister.IsNamespace(childNamespace)) { return(false); } // if you want to remove a plug-in, at least it should be there if (!registerIt && !PluginSearch.PluginDoesExist(parentNamespace, childNamespace)) { return(false); } try { // unregister plug-in if (!registerIt) { if (PluginSearch.PluginDoesExist(parentNamespace, childNamespace)) { _hxPlugins.RemoveHelpPlugIn(parentNamespace, "", childNamespace, "", ""); return(true); } } // (re)register plug-in string path1 = String.Empty; string parentToc = String.Empty; string childToc = String.Empty; string attr = String.Empty; // The function requires the names of the TOC files. I can take them from // the collection level files (*.HxC) of the collections. string parentHxC = _hxRegister.GetCollection(parentNamespace); if (!String.IsNullOrEmpty(parentHxC) && String.Equals(Path.GetExtension(parentHxC), ".HxC", StringComparison.CurrentCultureIgnoreCase)) { parentToc = GetXmlContent(parentHxC, "TOCDef"); } string childHxC = _hxRegister.GetCollection(childNamespace); if (!String.IsNullOrEmpty(childHxC) && String.Equals(Path.GetExtension(childHxC), ".HxC", StringComparison.CurrentCultureIgnoreCase)) { childToc = GetXmlContent(childHxC, "TOCDef"); attr = GetXmlContent(childHxC, "AttributeDef"); } if (!String.IsNullOrEmpty(attr)) { path1 = Path.Combine(Path.GetDirectoryName(_hxRegister.GetCollection(childNamespace)), attr); } if (registerIt && !String.IsNullOrEmpty(parentToc) && !String.IsNullOrEmpty(childToc)) { _hxPlugins.RegisterHelpPlugIn(parentNamespace, parentToc, childNamespace, childToc, path1, 0); return(true); } else { return(false); } } catch (COMException) { } return(false); }