private bool PluginAction(string parentNamespace, string childNamespace, bool registerIt) { if (register == null || plugins == null || string.IsNullOrEmpty(parentNamespace) || string.IsNullOrEmpty(childNamespace) || !register.IsNamespace(parentNamespace) || !register.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)) { plugins.RemoveHelpPlugIn(parentNamespace, "", childNamespace, "", ""); return(true); } } // (re)register plug-in string path1 = 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 parentToc = GetXmlContent(register.GetCollection(parentNamespace), "TOCDef"); string childToc = GetXmlContent(register.GetCollection(childNamespace), "TOCDef"); string attr = GetXmlContent(register.GetCollection(childNamespace), "AttributeDef"); if (!string.IsNullOrEmpty(attr)) { path1 = Path.Combine(Path.GetDirectoryName(register.GetCollection(childNamespace)), attr); } if (registerIt && !string.IsNullOrEmpty(parentToc) && !string.IsNullOrEmpty(childToc)) { plugins.RegisterHelpPlugIn(parentNamespace, parentToc, childNamespace, childToc, path1, 0); return(true); } else { return(false); } } catch (System.Runtime.InteropServices.COMException) { } return(false); }
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); }