Exemple #1
0
 internal CommandParameterInfo(CompiledCommandParameter parameter, uint parameterSetFlag)
 {
     using (CommandParameterInfo.tracer.TraceConstructor((object)this))
     {
         this.name          = parameter != null ? parameter.Name : throw CommandParameterInfo.tracer.NewArgumentNullException(nameof(parameter));
         this.parameterType = parameter.Type;
         this.isDynamic     = parameter.IsDynamic;
         this.aliases       = new ReadOnlyCollection <string>((IList <string>)parameter.Aliases);
         this.SetAttributes((IList <CompiledCommandAttribute>)parameter.CompiledAttributes);
         this.SetParameterSetData(parameter.GetParameterSetData(parameterSetFlag));
     }
 }
 internal CommandParameterInfo(CompiledCommandParameter parameter, int parameterSetFlag)
 {
     if (parameter == null)
     {
         throw PSTraceSource.NewArgumentNullException("parameter");
     }
     this.name = parameter.Name;
     this.parameterType = parameter.Type;
     this.isDynamic = parameter.IsDynamic;
     this.aliases = new ReadOnlyCollection<string>(parameter.Aliases);
     this.SetAttributes(parameter.CompiledAttributes);
     this.SetParameterSetData(parameter.GetParameterSetData(parameterSetFlag));
 }
 internal CommandParameterInfo(CompiledCommandParameter parameter, int parameterSetFlag)
 {
     if (parameter == null)
     {
         throw PSTraceSource.NewArgumentNullException("parameter");
     }
     this.name          = parameter.Name;
     this.parameterType = parameter.Type;
     this.isDynamic     = parameter.IsDynamic;
     this.aliases       = new ReadOnlyCollection <string>(parameter.Aliases);
     this.SetAttributes(parameter.CompiledAttributes);
     this.SetParameterSetData(parameter.GetParameterSetData(parameterSetFlag));
 }
Exemple #4
0
        /// <summary>
        /// Constructs the parameter info using the specified aliases, attributes, and
        /// parameter set metadata.
        /// </summary>
        /// <param name="parameter">
        /// The parameter metadata to retrieve the parameter information from.
        /// </param>
        /// <param name="parameterSetFlag">
        /// The parameter set flag to get the parameter information from.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If <paramref name="parameter"/> is null.
        /// </exception>
        internal CommandParameterInfo(
            CompiledCommandParameter parameter,
            uint parameterSetFlag)
        {
            if (parameter is null)
            {
                throw PSTraceSource.NewArgumentNullException(nameof(parameter));
            }

            Name          = parameter.Name;
            ParameterType = parameter.Type;
            IsDynamic     = parameter.IsDynamic;
            Aliases       = new ReadOnlyCollection <string>(parameter.Aliases);

            SetAttributes(parameter.CompiledAttributes);
            SetParameterSetData(parameter.GetParameterSetData(parameterSetFlag));
        }
        private void BuildSyntaxForParameterSet(XmlElement command, XmlElement syntax, MergedCommandParameterMetadata parameterMetadata, int i)
        {
            XmlElement newChild = this.doc.CreateElement("command:syntaxItem", commandURI);
            XmlElement element2 = this.doc.CreateElement("maml:name", mamlURI);
            XmlText    text     = this.doc.CreateTextNode(this.commandName);

            newChild.AppendChild(element2).AppendChild(text);
            foreach (MergedCompiledCommandParameter parameter in parameterMetadata.GetParametersInParameterSet(((int)1) << i))
            {
                if (parameter.BinderAssociation != ParameterBinderAssociation.CommonParameters)
                {
                    CompiledCommandParameter     parameter2       = parameter.Parameter;
                    ParameterSetSpecificMetadata parameterSetData = parameter2.GetParameterSetData(((int)1) << i);
                    string parameterDescription = this.GetParameterDescription(parameter2.Name);
                    bool   supportsWildcards    = (from attribute in parameter2.CompiledAttributes
                                                   where attribute is SupportsWildcardsAttribute
                                                   select attribute).Any <System.Attribute>();
                    XmlElement element3 = this.BuildXmlForParameter(parameter2.Name, parameterSetData.IsMandatory, parameterSetData.ValueFromPipeline, parameterSetData.ValueFromPipelineByPropertyName, parameterSetData.IsPositional ? ((1 + parameterSetData.Position)).ToString(CultureInfo.InvariantCulture) : "named", parameter2.Type, parameterDescription, supportsWildcards, "", true);
                    newChild.AppendChild(element3);
                }
            }
            command.AppendChild(syntax).AppendChild(newChild);
        }
Exemple #6
0
        private void BuildSyntaxForParameterSet(
            XmlElement command,
            XmlElement syntax,
            MergedCommandParameterMetadata parameterMetadata,
            int i)
        {
            XmlElement element1 = this.doc.CreateElement("command:syntaxItem", HelpCommentsParser.commandURI);
            XmlElement element2 = this.doc.CreateElement("maml:name", HelpCommentsParser.mamlURI);
            XmlText    textNode = this.doc.CreateTextNode(this.commandName);

            element1.AppendChild((XmlNode)element2).AppendChild((XmlNode)textNode);
            foreach (MergedCompiledCommandParameter parametersInParameter in parameterMetadata.GetParametersInParameterSet((uint)(1 << i)))
            {
                if (parametersInParameter.BinderAssociation != ParameterBinderAssociation.CommonParameters)
                {
                    CompiledCommandParameter     parameter        = parametersInParameter.Parameter;
                    ParameterSetSpecificMetadata parameterSetData = parameter.GetParameterSetData((uint)(1 << i));
                    string     parameterDescription = this.GetParameterDescription(parameter.Name);
                    XmlElement xmlElement           = this.BuildXmlForParameter(parameter.Name, parameterSetData.IsMandatory, parameterSetData.ValueFromPipeline, parameterSetData.ValueFromPipelineByPropertyName, parameterSetData.IsPositional ? (1 + parameterSetData.Position).ToString((IFormatProvider)CultureInfo.InvariantCulture) : "named", parameter.Type, parameterDescription, true);
                    element1.AppendChild((XmlNode)xmlElement);
                }
            }
            command.AppendChild((XmlNode)syntax).AppendChild((XmlNode)element1);
        }
Exemple #7
0
        internal XmlDocument BuildXmlFromComments()
        {
            this.doc = new XmlDocument();
            XmlElement element1 = this.doc.CreateElement("command:command", HelpCommentsParser.commandURI);

            element1.SetAttribute("xmlns:maml", HelpCommentsParser.mamlURI);
            element1.SetAttribute("xmlns:command", HelpCommentsParser.commandURI);
            element1.SetAttribute("xmlns:dev", HelpCommentsParser.devURI);
            this.doc.AppendChild((XmlNode)element1);
            XmlElement element2 = this.doc.CreateElement("command:details", HelpCommentsParser.commandURI);

            element1.AppendChild((XmlNode)element2);
            XmlElement element3  = this.doc.CreateElement("command:name", HelpCommentsParser.commandURI);
            XmlText    textNode1 = this.doc.CreateTextNode(this.commandName);

            element2.AppendChild((XmlNode)element3).AppendChild((XmlNode)textNode1);
            if (!string.IsNullOrEmpty(this.sections.synopsis))
            {
                XmlElement element4  = this.doc.CreateElement("maml:description", HelpCommentsParser.mamlURI);
                XmlElement element5  = this.doc.CreateElement("maml:para", HelpCommentsParser.mamlURI);
                XmlText    textNode2 = this.doc.CreateTextNode(this.sections.synopsis);
                element2.AppendChild((XmlNode)element4).AppendChild((XmlNode)element5).AppendChild((XmlNode)textNode2);
            }
            this.DetermineParameterDescriptions();
            XmlElement element6 = this.doc.CreateElement("command:syntax", HelpCommentsParser.commandURI);
            MergedCommandParameterMetadata parameterMetadata = this.commandMetadata.StaticCommandParameterMetadata;

            if (parameterMetadata.ParameterSetCount > 0)
            {
                for (int i = 0; i < parameterMetadata.ParameterSetCount; ++i)
                {
                    this.BuildSyntaxForParameterSet(element1, element6, parameterMetadata, i);
                }
            }
            else
            {
                this.BuildSyntaxForParameterSet(element1, element6, parameterMetadata, int.MaxValue);
            }
            XmlElement element7 = this.doc.CreateElement("command:parameters", HelpCommentsParser.commandURI);

            foreach (KeyValuePair <string, MergedCompiledCommandParameter> bindableParameter in parameterMetadata.BindableParameters)
            {
                MergedCompiledCommandParameter commandParameter = bindableParameter.Value;
                if (commandParameter.BinderAssociation != ParameterBinderAssociation.CommonParameters)
                {
                    string key = bindableParameter.Key;
                    string parameterDescription = this.GetParameterDescription(key);
                    ParameterSetSpecificMetadata specificMetadata = (ParameterSetSpecificMetadata)null;
                    bool   isMandatory       = false;
                    bool   valueFromPipeline = false;
                    bool   valueFromPipelineByPropertyName = false;
                    string position = "named";
                    int    num      = 0;
                    CompiledCommandParameter parameter = commandParameter.Parameter;
                    parameter.ParameterSetData.TryGetValue("__AllParameterSets", out specificMetadata);
                    while (specificMetadata == null && num < 32)
                    {
                        specificMetadata = parameter.GetParameterSetData((uint)(1 << num++));
                    }
                    if (specificMetadata != null)
                    {
                        isMandatory       = specificMetadata.IsMandatory;
                        valueFromPipeline = specificMetadata.ValueFromPipeline;
                        valueFromPipelineByPropertyName = specificMetadata.ValueFromPipelineByPropertyName;
                        position = specificMetadata.IsPositional ? (1 + specificMetadata.Position).ToString((IFormatProvider)CultureInfo.InvariantCulture) : "named";
                    }
                    XmlElement xmlElement = this.BuildXmlForParameter(key, isMandatory, valueFromPipeline, valueFromPipelineByPropertyName, position, parameter.Type, parameterDescription, false);
                    element7.AppendChild((XmlNode)xmlElement);
                }
            }
            element1.AppendChild((XmlNode)element7);
            if (!string.IsNullOrEmpty(this.sections.description))
            {
                XmlElement element4  = this.doc.CreateElement("maml:description", HelpCommentsParser.mamlURI);
                XmlElement element5  = this.doc.CreateElement("maml:para", HelpCommentsParser.mamlURI);
                XmlText    textNode2 = this.doc.CreateTextNode(this.sections.description);
                element1.AppendChild((XmlNode)element4).AppendChild((XmlNode)element5).AppendChild((XmlNode)textNode2);
            }
            if (!string.IsNullOrEmpty(this.sections.notes))
            {
                XmlElement element4  = this.doc.CreateElement("maml:alertSet", HelpCommentsParser.mamlURI);
                XmlElement element5  = this.doc.CreateElement("maml:alert", HelpCommentsParser.mamlURI);
                XmlElement element8  = this.doc.CreateElement("maml:para", HelpCommentsParser.mamlURI);
                XmlText    textNode2 = this.doc.CreateTextNode(this.sections.notes);
                element1.AppendChild((XmlNode)element4).AppendChild((XmlNode)element5).AppendChild((XmlNode)element8).AppendChild((XmlNode)textNode2);
            }
            if (this.sections.examples.Count > 0)
            {
                XmlElement element4 = this.doc.CreateElement("command:examples", HelpCommentsParser.commandURI);
                int        num      = 1;
                foreach (string example in this.sections.examples)
                {
                    XmlElement element5  = this.doc.CreateElement("command:example", HelpCommentsParser.commandURI);
                    XmlElement element8  = this.doc.CreateElement("maml:title", HelpCommentsParser.mamlURI);
                    XmlText    textNode2 = this.doc.CreateTextNode(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "\t\t\t\t-------------------------- {0} {1} --------------------------", (object)ResourceManagerCache.GetResourceString("HelpDisplayStrings", "ExampleUpperCase"), (object)num++));
                    element5.AppendChild((XmlNode)element8).AppendChild((XmlNode)textNode2);
                    string prompt_str;
                    string code_str;
                    string remarks_str;
                    this.GetExampleSections(example, out prompt_str, out code_str, out remarks_str);
                    XmlElement element9  = this.doc.CreateElement("maml:introduction", HelpCommentsParser.mamlURI);
                    XmlElement element10 = this.doc.CreateElement("maml:para", HelpCommentsParser.mamlURI);
                    XmlText    textNode3 = this.doc.CreateTextNode(prompt_str);
                    element5.AppendChild((XmlNode)element9).AppendChild((XmlNode)element10).AppendChild((XmlNode)textNode3);
                    XmlElement element11 = this.doc.CreateElement("dev:code", HelpCommentsParser.devURI);
                    XmlText    textNode4 = this.doc.CreateTextNode(code_str);
                    element5.AppendChild((XmlNode)element11).AppendChild((XmlNode)textNode4);
                    XmlElement element12 = this.doc.CreateElement("dev:remarks", HelpCommentsParser.devURI);
                    XmlElement element13 = this.doc.CreateElement("maml:para", HelpCommentsParser.mamlURI);
                    XmlText    textNode5 = this.doc.CreateTextNode(remarks_str);
                    element5.AppendChild((XmlNode)element12).AppendChild((XmlNode)element13).AppendChild((XmlNode)textNode5);
                    for (int index = 0; index < 4; ++index)
                    {
                        element12.AppendChild((XmlNode)this.doc.CreateElement("maml:para", HelpCommentsParser.mamlURI));
                    }
                    element4.AppendChild((XmlNode)element5);
                }
                element1.AppendChild((XmlNode)element4);
            }
            if (this.sections.inputs.Count > 0)
            {
                XmlElement element4 = this.doc.CreateElement("command:inputTypes", HelpCommentsParser.commandURI);
                foreach (string input in this.sections.inputs)
                {
                    XmlElement element5  = this.doc.CreateElement("command:inputType", HelpCommentsParser.commandURI);
                    XmlElement element8  = this.doc.CreateElement("dev:type", HelpCommentsParser.devURI);
                    XmlElement element9  = this.doc.CreateElement("maml:name", HelpCommentsParser.mamlURI);
                    XmlText    textNode2 = this.doc.CreateTextNode(input);
                    element4.AppendChild((XmlNode)element5).AppendChild((XmlNode)element8).AppendChild((XmlNode)element9).AppendChild((XmlNode)textNode2);
                }
                element1.AppendChild((XmlNode)element4);
            }
            IEnumerable enumerable = (IEnumerable)null;

            if (this.sections.outputs.Count > 0)
            {
                enumerable = (IEnumerable)this.sections.outputs;
            }
            else if (this.scriptBlock.OutputType.Count > 0)
            {
                enumerable = (IEnumerable)this.scriptBlock.OutputType;
            }
            if (enumerable != null)
            {
                XmlElement element4 = this.doc.CreateElement("command:returnValues", HelpCommentsParser.commandURI);
                foreach (object obj in enumerable)
                {
                    XmlElement element5 = this.doc.CreateElement("command:returnValue", HelpCommentsParser.commandURI);
                    XmlElement element8 = this.doc.CreateElement("dev:type", HelpCommentsParser.devURI);
                    XmlElement element9 = this.doc.CreateElement("maml:name", HelpCommentsParser.mamlURI);
                    if (!(obj is string text))
                    {
                        text = ((PSTypeName)obj).Name;
                    }
                    XmlText textNode2 = this.doc.CreateTextNode(text);
                    element4.AppendChild((XmlNode)element5).AppendChild((XmlNode)element8).AppendChild((XmlNode)element9).AppendChild((XmlNode)textNode2);
                }
                element1.AppendChild((XmlNode)element4);
            }
            if (this.sections.links.Count > 0)
            {
                XmlElement element4 = this.doc.CreateElement("maml:relatedLinks", HelpCommentsParser.mamlURI);
                foreach (string link in this.sections.links)
                {
                    XmlElement element5  = this.doc.CreateElement("maml:navigationLink", HelpCommentsParser.mamlURI);
                    XmlElement element8  = this.doc.CreateElement(Uri.IsWellFormedUriString(Uri.EscapeUriString(link), UriKind.Absolute) ? "maml:uri" : "maml:linkText", HelpCommentsParser.mamlURI);
                    XmlText    textNode2 = this.doc.CreateTextNode(link);
                    element4.AppendChild((XmlNode)element5).AppendChild((XmlNode)element8).AppendChild((XmlNode)textNode2);
                }
                element1.AppendChild((XmlNode)element4);
            }
            return(this.doc);
        }
        internal XmlDocument BuildXmlFromComments()
        {
            this.doc = new XmlDocument();
            XmlElement newChild = this.doc.CreateElement("command:command", commandURI);

            newChild.SetAttribute("xmlns:maml", mamlURI);
            newChild.SetAttribute("xmlns:command", commandURI);
            newChild.SetAttribute("xmlns:dev", devURI);
            this.doc.AppendChild(newChild);
            XmlElement element2 = this.doc.CreateElement("command:details", commandURI);

            newChild.AppendChild(element2);
            XmlElement element3 = this.doc.CreateElement("command:name", commandURI);
            XmlText    text     = this.doc.CreateTextNode(this.commandName);

            element2.AppendChild(element3).AppendChild(text);
            if (!string.IsNullOrEmpty(this._sections.Synopsis))
            {
                XmlElement element4 = this.doc.CreateElement("maml:description", mamlURI);
                XmlElement element5 = this.doc.CreateElement("maml:para", mamlURI);
                XmlText    text2    = this.doc.CreateTextNode(this._sections.Synopsis);
                element2.AppendChild(element4).AppendChild(element5).AppendChild(text2);
            }
            this.DetermineParameterDescriptions();
            XmlElement syntax = this.doc.CreateElement("command:syntax", commandURI);
            MergedCommandParameterMetadata staticCommandParameterMetadata = this.commandMetadata.StaticCommandParameterMetadata;

            if (staticCommandParameterMetadata.ParameterSetCount > 0)
            {
                for (int i = 0; i < staticCommandParameterMetadata.ParameterSetCount; i++)
                {
                    this.BuildSyntaxForParameterSet(newChild, syntax, staticCommandParameterMetadata, i);
                }
            }
            else
            {
                this.BuildSyntaxForParameterSet(newChild, syntax, staticCommandParameterMetadata, 0x7fffffff);
            }
            XmlElement element7 = this.doc.CreateElement("command:parameters", commandURI);

            foreach (KeyValuePair <string, MergedCompiledCommandParameter> pair in staticCommandParameterMetadata.BindableParameters)
            {
                MergedCompiledCommandParameter parameter = pair.Value;
                if (parameter.BinderAssociation != ParameterBinderAssociation.CommonParameters)
                {
                    ParameterSetSpecificMetadata parameterSetData;
                    string key = pair.Key;
                    string parameterDescription            = this.GetParameterDescription(key);
                    bool   isMandatory                     = false;
                    bool   valueFromPipeline               = false;
                    bool   valueFromPipelineByPropertyName = false;
                    string position = "named";
                    int    num2     = 0;
                    CompiledCommandParameter parameter2 = parameter.Parameter;
                    parameter2.ParameterSetData.TryGetValue("__AllParameterSets", out parameterSetData);
                    while ((parameterSetData == null) && (num2 < 0x20))
                    {
                        parameterSetData = parameter2.GetParameterSetData(((int)1) << num2++);
                    }
                    if (parameterSetData != null)
                    {
                        isMandatory       = parameterSetData.IsMandatory;
                        valueFromPipeline = parameterSetData.ValueFromPipeline;
                        valueFromPipelineByPropertyName = parameterSetData.ValueFromPipelineByPropertyName;
                        position = parameterSetData.IsPositional ? ((1 + parameterSetData.Position)).ToString(CultureInfo.InvariantCulture) : "named";
                    }
                    Collection <System.Attribute> compiledAttributes = parameter2.CompiledAttributes;
                    bool   supportsWildcards = compiledAttributes.OfType <SupportsWildcardsAttribute>().Any <SupportsWildcardsAttribute>();
                    string help = "";
                    object obj2 = null;
                    PSDefaultValueAttribute attribute = compiledAttributes.OfType <PSDefaultValueAttribute>().FirstOrDefault <PSDefaultValueAttribute>();
                    if (attribute != null)
                    {
                        help = attribute.Help;
                        if (string.IsNullOrEmpty(help))
                        {
                            obj2 = attribute.Value;
                        }
                    }
                    if (string.IsNullOrEmpty(help))
                    {
                        RuntimeDefinedParameter parameter3;
                        if ((obj2 == null) && this.scriptBlock.RuntimeDefinedParameters.TryGetValue(key, out parameter3))
                        {
                            obj2 = parameter3.Value;
                        }
                        Compiler.DefaultValueExpressionWrapper wrapper = obj2 as Compiler.DefaultValueExpressionWrapper;
                        if (wrapper != null)
                        {
                            help = wrapper.Expression.Extent.Text;
                        }
                        else if (obj2 != null)
                        {
                            help = PSObject.ToStringParser(null, obj2);
                        }
                    }
                    XmlElement element8 = this.BuildXmlForParameter(key, isMandatory, valueFromPipeline, valueFromPipelineByPropertyName, position, parameter2.Type, parameterDescription, supportsWildcards, help, false);
                    element7.AppendChild(element8);
                }
            }
            newChild.AppendChild(element7);
            if (!string.IsNullOrEmpty(this._sections.Description))
            {
                XmlElement element9  = this.doc.CreateElement("maml:description", mamlURI);
                XmlElement element10 = this.doc.CreateElement("maml:para", mamlURI);
                XmlText    text3     = this.doc.CreateTextNode(this._sections.Description);
                newChild.AppendChild(element9).AppendChild(element10).AppendChild(text3);
            }
            if (!string.IsNullOrEmpty(this._sections.Notes))
            {
                XmlElement element11 = this.doc.CreateElement("maml:alertSet", mamlURI);
                XmlElement element12 = this.doc.CreateElement("maml:alert", mamlURI);
                XmlElement element13 = this.doc.CreateElement("maml:para", mamlURI);
                XmlText    text4     = this.doc.CreateTextNode(this._sections.Notes);
                newChild.AppendChild(element11).AppendChild(element12).AppendChild(element13).AppendChild(text4);
            }
            if (this._examples.Count > 0)
            {
                XmlElement element14 = this.doc.CreateElement("command:examples", commandURI);
                int        num3      = 1;
                foreach (string str5 in this._examples)
                {
                    string     str7;
                    string     str8;
                    string     str9;
                    XmlElement element15 = this.doc.CreateElement("command:example", commandURI);
                    XmlElement element16 = this.doc.CreateElement("maml:title", mamlURI);
                    string     str6      = string.Format(CultureInfo.InvariantCulture, "\t\t\t\t-------------------------- {0} {1} --------------------------", new object[] { HelpDisplayStrings.ExampleUpperCase, num3++ });
                    XmlText    text5     = this.doc.CreateTextNode(str6);
                    element15.AppendChild(element16).AppendChild(text5);
                    GetExampleSections(str5, out str7, out str8, out str9);
                    XmlElement element17 = this.doc.CreateElement("maml:introduction", mamlURI);
                    XmlElement element18 = this.doc.CreateElement("maml:para", mamlURI);
                    XmlText    text6     = this.doc.CreateTextNode(str7);
                    element15.AppendChild(element17).AppendChild(element18).AppendChild(text6);
                    XmlElement element19 = this.doc.CreateElement("dev:code", devURI);
                    XmlText    text7     = this.doc.CreateTextNode(str8);
                    element15.AppendChild(element19).AppendChild(text7);
                    XmlElement element20 = this.doc.CreateElement("dev:remarks", devURI);
                    XmlElement element21 = this.doc.CreateElement("maml:para", mamlURI);
                    XmlText    text8     = this.doc.CreateTextNode(str9);
                    element15.AppendChild(element20).AppendChild(element21).AppendChild(text8);
                    for (int j = 0; j < 4; j++)
                    {
                        element20.AppendChild(this.doc.CreateElement("maml:para", mamlURI));
                    }
                    element14.AppendChild(element15);
                }
                newChild.AppendChild(element14);
            }
            if (this._inputs.Count > 0)
            {
                XmlElement element22 = this.doc.CreateElement("command:inputTypes", commandURI);
                foreach (string str10 in this._inputs)
                {
                    XmlElement element23 = this.doc.CreateElement("command:inputType", commandURI);
                    XmlElement element24 = this.doc.CreateElement("dev:type", devURI);
                    XmlElement element25 = this.doc.CreateElement("maml:name", mamlURI);
                    XmlText    text9     = this.doc.CreateTextNode(str10);
                    element22.AppendChild(element23).AppendChild(element24).AppendChild(element25).AppendChild(text9);
                }
                newChild.AppendChild(element22);
            }
            IEnumerable outputType = null;

            if (this._outputs.Count > 0)
            {
                outputType = this._outputs;
            }
            else if (this.scriptBlock.OutputType.Count > 0)
            {
                outputType = this.scriptBlock.OutputType;
            }
            if (outputType != null)
            {
                XmlElement element26 = this.doc.CreateElement("command:returnValues", commandURI);
                foreach (object obj3 in outputType)
                {
                    XmlElement element27 = this.doc.CreateElement("command:returnValue", commandURI);
                    XmlElement element28 = this.doc.CreateElement("dev:type", devURI);
                    XmlElement element29 = this.doc.CreateElement("maml:name", mamlURI);
                    string     str11     = (obj3 as string) ?? ((PSTypeName)obj3).Name;
                    XmlText    text10    = this.doc.CreateTextNode(str11);
                    element26.AppendChild(element27).AppendChild(element28).AppendChild(element29).AppendChild(text10);
                }
                newChild.AppendChild(element26);
            }
            if (this._links.Count > 0)
            {
                XmlElement element30 = this.doc.CreateElement("maml:relatedLinks", mamlURI);
                foreach (string str12 in this._links)
                {
                    XmlElement element31     = this.doc.CreateElement("maml:navigationLink", mamlURI);
                    string     qualifiedName = Uri.IsWellFormedUriString(Uri.EscapeUriString(str12), UriKind.Absolute) ? "maml:uri" : "maml:linkText";
                    XmlElement element32     = this.doc.CreateElement(qualifiedName, mamlURI);
                    XmlText    text11        = this.doc.CreateTextNode(str12);
                    element30.AppendChild(element31).AppendChild(element32).AppendChild(text11);
                }
                newChild.AppendChild(element30);
            }
            return(this.doc);
        }