/// <summary> /// /// </summary> public void Unregister() { foreach (PluginParentItem plugin in _parentPlugins) { if (String.IsNullOrEmpty(plugin.MatchingName)) { continue; } using (HelpRegistrar register = new HelpRegistrar()) { foreach (PluginChildItem child in plugin) { if (String.IsNullOrEmpty(child.MatchingName)) { continue; } OnRegisterOrRemovePlugin(new PluginEventArgs( plugin.MatchingName, child.MatchingName, false)); register.RemovePlugin(plugin.MatchingName, child.MatchingName); } if (plugin.Merge) { OnNamespaceMerge(new MergingEventArgs(plugin.MatchingName)); MergeNamespace.CallMerge(plugin.MatchingName); } } } }
/// <summary> /// /// </summary> public void Unregister() { foreach (NamespaceItem helpNamespace in _helpNamespaces) { if (String.IsNullOrEmpty(helpNamespace.Name)) { continue; } using (HelpRegistrar register = new HelpRegistrar()) { // remove this Help 2.0 namespace, if it is a plug-in foreach (string connectedNamespace in helpNamespace.ConnectedNamespaces) { OnRegisterOrRemovePlugin(new PluginEventArgs( connectedNamespace, helpNamespace.Name, false)); register.RemovePlugin(connectedNamespace, helpNamespace.Name); OnNamespaceMerge(new MergingEventArgs( connectedNamespace)); MergeNamespace.CallMerge(connectedNamespace); } // remove this namespace's child plug-ins foreach (PluginChildItem plugin in helpNamespace.Plugins) { OnLogProgress(new LoggingEventArgs(plugin.ToString())); OnRegisterOrRemovePlugin(new PluginEventArgs( helpNamespace.Name, plugin.MatchingName, false)); register.RemovePlugin(helpNamespace.Name, plugin.MatchingName); } // remove this namespace's filters foreach (FilterItem filter in helpNamespace.Filters) { OnLogProgress(new LoggingEventArgs(filter.ToString())); OnRegisterOrRemoveFilter(new NamespaceEventArgs( filter.Name, false)); register.RemoveFilter(helpNamespace.Name, filter.Name); } // remove this namespace's documents foreach (DocumentItem document in helpNamespace.Documents) { OnLogProgress(new LoggingEventArgs(document.ToString())); OnRegisterOrRemoveHelpDocument(new NamespaceEventArgs( document.Id, false)); register.RemoveHelpFile(helpNamespace.Name, document.Id, document.LanguageId); } // remove this namespace, ... if (helpNamespace.Remove) { OnRegisterOrRemoveNamespace(new NamespaceEventArgs( helpNamespace.Name, false)); register.RemoveNamespace(helpNamespace.Name); } // ... or just (re)merge it else { OnNamespaceMerge(new MergingEventArgs( helpNamespace.Name)); MergeNamespace.CallMerge(helpNamespace.Name); } } } }
/// <summary> /// /// </summary> public void Register() { foreach (NamespaceItem helpNamespace in _helpNamespaces) { if (String.IsNullOrEmpty(helpNamespace.Name) || String.IsNullOrEmpty(helpNamespace.CollectionLevelFile) || !File.Exists(helpNamespace.CollectionLevelFile)) { continue; } using (HelpRegistrar register = new HelpRegistrar()) { // force Help 2.0 namespace creation if (helpNamespace.ForceCreation) { OnLogProgress(new LoggingEventArgs(helpNamespace.ToString())); OnRegisterOrRemoveNamespace(new NamespaceEventArgs(helpNamespace.Name, true)); register.RegisterNamespace(helpNamespace.Name, helpNamespace.CollectionLevelFile, helpNamespace.Description); } // register Help 2.0 documents foreach (DocumentItem document in helpNamespace.Documents) { if (String.IsNullOrEmpty(document.Id) || String.IsNullOrEmpty(document.Hxs) || !File.Exists(document.Hxs)) { continue; } OnLogProgress(new LoggingEventArgs(document.ToString())); OnRegisterOrRemoveHelpDocument(new NamespaceEventArgs(document.Id, true)); register.RegisterHelpFile(helpNamespace.Name, document.Id, document.LanguageId, document.Hxs, document.Hxi, document.Hxq, document.Hxr, document.HxsMediaId, document.HxqMediaId, document.HxrMediaId, document.SampleMediaId); } // register Help 2.0 filters foreach (FilterItem filter in helpNamespace.Filters) { if (String.IsNullOrEmpty(filter.Name)) { continue; } OnLogProgress(new LoggingEventArgs(filter.ToString())); OnRegisterOrRemoveFilter(new NamespaceEventArgs(filter.Name, true)); register.RegisterFilter(helpNamespace.Name, filter.Name, filter.Query); } // register Help 2.0 child plug-ins foreach (PluginChildItem plugin in helpNamespace.Plugins) { if (String.IsNullOrEmpty(plugin.MatchingName)) { continue; } OnLogProgress(new LoggingEventArgs(plugin.ToString())); OnRegisterOrRemovePlugin(new PluginEventArgs( helpNamespace.Name, plugin.MatchingName, true)); register.RegisterPlugin(helpNamespace.Name, plugin.MatchingName); if (String.Compare(plugin.Name, plugin.MatchingName) != 0) { PatchXmlNode(helpNamespace.Name, plugin.Name, plugin.MatchingName); } } // merge Help 2.0 namespace if (helpNamespace.Merge) { OnLogProgress(new LoggingEventArgs(String.Format( CultureInfo.InvariantCulture, "[merging {0}]", helpNamespace.Name))); OnNamespaceMerge(new MergingEventArgs(helpNamespace.Name)); MergeNamespace.CallMerge(helpNamespace.Name); IList <string> connectedNamespaces = helpNamespace.ConnectedNamespaces; int itemCount = connectedNamespaces.Count; for (int i = 0; i < itemCount; i++) { string connectedNamespace = connectedNamespaces[i]; OnLogProgress(new LoggingEventArgs(String.Format( CultureInfo.InvariantCulture, "[merging {0}]", connectedNamespace))); OnNamespaceMerge(new MergingEventArgs( connectedNamespace)); MergeNamespace.CallMerge(connectedNamespace); } } } } }