internal void OverrideProviderSpecificHelpWithGenericHelp(HelpInfo genericHelpInfo)
        {
            PSObject fullHelp = genericHelpInfo.FullHelp;

            MamlUtil.OverrideName(this._fullHelpObject, fullHelp);
            MamlUtil.PrependSyntax(this._fullHelpObject, fullHelp);
            MamlUtil.PrependDetailedDescription(this._fullHelpObject, fullHelp);
            MamlUtil.OverrideParameters(this._fullHelpObject, fullHelp);
            MamlUtil.PrependNotes(this._fullHelpObject, fullHelp);
        }
示例#2
0
        /// <summary>
        /// Override the FullHelp PSObject of this provider-specific HelpInfo with generic help.
        /// </summary>
        internal void OverrideProviderSpecificHelpWithGenericHelp(HelpInfo genericHelpInfo)
        {
            PSObject genericHelpMaml = genericHelpInfo.FullHelp;

            MamlUtil.OverrideName(_fullHelpObject, genericHelpMaml);
            MamlUtil.OverridePSTypeNames(_fullHelpObject, genericHelpMaml);
            MamlUtil.PrependSyntax(_fullHelpObject, genericHelpMaml);
            MamlUtil.PrependDetailedDescription(_fullHelpObject, genericHelpMaml);
            MamlUtil.OverrideParameters(_fullHelpObject, genericHelpMaml);
            MamlUtil.PrependNotes(_fullHelpObject, genericHelpMaml);
            MamlUtil.AddCommonProperties(_fullHelpObject, genericHelpMaml);
        }
示例#3
0
 internal static void OverrideName(PSObject maml1, PSObject maml2)
 {
     MamlUtil.PrependPropertyValue(maml1, maml2, new string[1]
     {
         "Name"
     }, true);
     MamlUtil.PrependPropertyValue(maml1, maml2, new string[2]
     {
         "Details",
         "Name"
     }, true);
 }
示例#4
0
        internal static void PrependPropertyValue(
            PSObject maml1,
            PSObject maml2,
            string[] path,
            bool shouldOverride)
        {
            List <object>  objectList   = new List <object>();
            PSPropertyInfo properyInfo1 = MamlUtil.GetProperyInfo(maml2, path);

            if (properyInfo1.Value is PSObject[])
            {
                objectList.AddRange((IEnumerable <object>)(PSObject[]) properyInfo1.Value);
            }
            else
            {
                objectList.Add(properyInfo1.Value);
            }
            MamlUtil.EnsurePropertyInfoPathExists(maml1, path);
            PSPropertyInfo properyInfo2 = MamlUtil.GetProperyInfo(maml1, path);

            if (!shouldOverride)
            {
                if (properyInfo2.Value is PSObject[])
                {
                    objectList.AddRange((IEnumerable <object>)(PSObject[]) properyInfo2.Value);
                }
                else
                {
                    objectList.Add(properyInfo2.Value);
                }
            }
            if (objectList.Count == 1)
            {
                properyInfo2.Value = objectList[0];
            }
            else
            {
                if (objectList.Count < 2)
                {
                    return;
                }
                properyInfo2.Value = (object)objectList.ToArray();
            }
        }
示例#5
0
        internal static void OverrideParameters(PSObject maml1, PSObject maml2)
        {
            string[] path = new string[2]
            {
                "Parameters",
                "Parameter"
            };
            List <PSObject> psObjectList1 = new List <PSObject>();
            PSPropertyInfo  properyInfo1  = MamlUtil.GetProperyInfo(maml2, path);

            if (properyInfo1.Value is PSObject[])
            {
                psObjectList1.AddRange((IEnumerable <PSObject>)(PSObject[]) properyInfo1.Value);
            }
            else
            {
                psObjectList1.Add(PSObject.AsPSObject(properyInfo1.Value));
            }
            MamlUtil.EnsurePropertyInfoPathExists(maml1, path);
            PSPropertyInfo  properyInfo2  = MamlUtil.GetProperyInfo(maml1, path);
            List <PSObject> psObjectList2 = new List <PSObject>();

            if (properyInfo2.Value is PSObject[])
            {
                psObjectList2.AddRange((IEnumerable <PSObject>)(PSObject[]) properyInfo2.Value);
            }
            else
            {
                psObjectList2.Add(PSObject.AsPSObject(properyInfo2.Value));
            }
            for (int index = 0; index < psObjectList1.Count; ++index)
            {
                string result1;
                if (LanguagePrimitives.TryConvertTo <string>(psObjectList1[index].Properties["Name"].Value, out result1))
                {
                    bool flag = false;
                    foreach (PSObject psObject in psObjectList2)
                    {
                        string result2;
                        if (LanguagePrimitives.TryConvertTo <string>(psObject.Properties["Name"].Value, out result2) && result2.Equals(result1, StringComparison.OrdinalIgnoreCase))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        psObjectList2.Add(psObjectList1[index]);
                    }
                }
            }
            if (psObjectList2.Count == 1)
            {
                properyInfo2.Value = (object)psObjectList2[0];
            }
            else
            {
                if (psObjectList2.Count < 2)
                {
                    return;
                }
                properyInfo2.Value = (object)psObjectList2.ToArray();
            }
        }
示例#6
0
 internal static void PrependDetailedDescription(PSObject maml1, PSObject maml2) => MamlUtil.PrependPropertyValue(maml1, maml2, new string[1]
 {
     "Description"
 }, false);
示例#7
0
 internal static void PrependSyntax(PSObject maml1, PSObject maml2) => MamlUtil.PrependPropertyValue(maml1, maml2, new string[2]
 {
     "Syntax",
     "SyntaxItem"
 }, false);
示例#8
0
 internal static void PrependNotes(PSObject maml1, PSObject maml2) => MamlUtil.PrependPropertyValue(maml1, maml2, new string[2]
 {
     "AlertSet",
     "Alert"
 }, false);