Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        public void Register()
        {
            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, true));
                        register.RegisterPlugin(plugin.MatchingName, child.MatchingName);

                        if (String.Compare(plugin.Name, plugin.MatchingName) != 0)
                        {
                            PatchParentXmlNode(plugin.Name, plugin.MatchingName);
                        }
                        if (String.Compare(child.Name, child.MatchingName) != 0)
                        {
                            PatchChildXmlNode(plugin.Name, child.Name, child.MatchingName);
                        }
                    }

                    if (plugin.Merge)
                    {
                        OnNamespaceMerge(new MergingEventArgs(plugin.MatchingName));
                        MergeNamespace.CallMerge(plugin.MatchingName);
                    }
                }
            }
        }
Exemple #2
0
        /// <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);
                        }
                    }
                }
            }
        }