Beispiel #1
0
        internal MamlCommandHelpInfo Copy(HelpCategory newCategoryToUse)
        {
            MamlCommandHelpInfo result = new MamlCommandHelpInfo(_fullHelpObject.Copy(), newCategoryToUse);

            result.FullHelp.Properties["Category"].Value = newCategoryToUse;
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Merge the provider specific help with current command help.
        ///
        /// The cmdletHelp and dynamicParameterHelp is normally retrieved from ProviderHelpProvider.
        /// </summary>
        /// <remarks>
        /// A new MamlCommandHelpInfo is created to avoid polluting the provider help cache.
        /// </remarks>
        /// <param name="cmdletHelp">Provider-specific cmdletHelp to merge into current MamlCommandHelpInfo object.</param>
        /// <param name="dynamicParameterHelp">Provider-specific dynamic parameter help to merge into current MamlCommandHelpInfo object.</param>
        /// <returns>Merged command help info object.</returns>
        internal MamlCommandHelpInfo MergeProviderSpecificHelp(PSObject cmdletHelp, PSObject[] dynamicParameterHelp)
        {
            if (this._fullHelpObject == null)
            {
                return(null);
            }

            MamlCommandHelpInfo result = (MamlCommandHelpInfo)this.MemberwiseClone();

            // We will need to use a deep clone of _fullHelpObject
            // to avoid _fullHelpObject being get terminated.
            result._fullHelpObject = this._fullHelpObject.Copy();

            if (cmdletHelp != null)
            {
                result._fullHelpObject.Properties.Add(new PSNoteProperty("PS_Cmdlet", cmdletHelp));
            }

            if (dynamicParameterHelp != null)
            {
                result._fullHelpObject.Properties.Add(new PSNoteProperty("PS_DynamicParameters", dynamicParameterHelp));
            }

            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Create a MamlCommandHelpInfo object from an XmlNode.
        /// </summary>
        /// <param name="xmlNode">XmlNode that contains help info.</param>
        /// <param name="helpCategory">Help category this maml object fits into.</param>
        /// <returns>MamlCommandHelpInfo object created.</returns>
        internal static MamlCommandHelpInfo Load(XmlNode xmlNode, HelpCategory helpCategory)
        {
            MamlCommandHelpInfo mamlCommandHelpInfo = new MamlCommandHelpInfo(xmlNode, helpCategory);

            if (string.IsNullOrEmpty(mamlCommandHelpInfo.Name))
            {
                return(null);
            }

            mamlCommandHelpInfo.AddCommonHelpProperties();

            return(mamlCommandHelpInfo);
        }
        internal ProviderCommandHelpInfo(HelpInfo genericHelpInfo, ProviderContext providerContext)
        {
            this.ForwardHelpCategory = HelpCategory.None;
            MamlCommandHelpInfo specificHelpInfo = providerContext.GetProviderSpecificHelpInfo(genericHelpInfo.Name);

            if (specificHelpInfo == null)
            {
                this._helpInfo = genericHelpInfo;
            }
            else
            {
                specificHelpInfo.OverrideProviderSpecificHelpWithGenericHelp(genericHelpInfo);
                this._helpInfo = (HelpInfo)specificHelpInfo;
            }
        }
Beispiel #5
0
        internal MamlCommandHelpInfo Copy()
        {
            MamlCommandHelpInfo result = new MamlCommandHelpInfo(_fullHelpObject.Copy(), this.HelpCategory);

            return(result);
        }