/// <summary> /// Adds the help text to the paragraph /// </summary> internal void AddTextToParagraphBuilder() { this.ResetAllText(); string strCategory = (HelpParagraphBuilder.GetProperty(this.psObj, "Category")).Value.ToString(); HelpCategory category = HelpCategory.Default; if (String.Compare(strCategory, "DscResource", StringComparison.OrdinalIgnoreCase) == 0) { category = HelpCategory.DscResource; } else if (String.Compare(strCategory, "Class", StringComparison.OrdinalIgnoreCase) == 0) { category = HelpCategory.Class; } if (HelpParagraphBuilder.GetProperty(this.psObj, "Syntax") == null) { if (category == HelpCategory.Default) { // if there is no syntax, this is not the standard help // it might be an about page this.AddText(this.psObj.ToString(), false); return; } } switch (category) { case HelpCategory.Class: this.AddDescription(HelpWindowSettings.Default.HelpSynopsysDisplayed, HelpWindowResources.SynopsisTitle, "Introduction"); this.AddMembers(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.PropertiesTitle); this.AddMembers(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.MethodsTitle); break; case HelpCategory.DscResource: this.AddStringSection(HelpWindowSettings.Default.HelpSynopsysDisplayed, "Synopsis", HelpWindowResources.SynopsisTitle); this.AddDescription(HelpWindowSettings.Default.HelpDescriptionDisplayed, HelpWindowResources.DescriptionTitle, "Description"); this.AddParameters(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.PropertiesTitle, "Properties", HelpCategory.DscResource); break; default: this.AddStringSection(HelpWindowSettings.Default.HelpSynopsysDisplayed, "Synopsis", HelpWindowResources.SynopsisTitle); this.AddDescription(HelpWindowSettings.Default.HelpDescriptionDisplayed, HelpWindowResources.DescriptionTitle, "Description"); this.AddParameters(HelpWindowSettings.Default.HelpParametersDisplayed, HelpWindowResources.ParametersTitle, "Parameters", HelpCategory.Default); this.AddSyntax(HelpWindowSettings.Default.HelpSyntaxDisplayed, HelpWindowResources.SyntaxTitle); break; } this.AddInputOrOutputEntries(HelpWindowSettings.Default.HelpInputsDisplayed, HelpWindowResources.InputsTitle, "inputTypes", "inputType"); this.AddInputOrOutputEntries(HelpWindowSettings.Default.HelpOutputsDisplayed, HelpWindowResources.OutputsTitle, "returnValues", "returnValue"); this.AddNotes(HelpWindowSettings.Default.HelpNotesDisplayed, HelpWindowResources.NotesTitle); this.AddExamples(HelpWindowSettings.Default.HelpExamplesDisplayed, HelpWindowResources.ExamplesTitle); this.AddNavigationLink(HelpWindowSettings.Default.HelpRelatedLinksDisplayed, HelpWindowResources.RelatedLinksTitle); this.AddStringSection(HelpWindowSettings.Default.HelpRemarksDisplayed, "Remarks", HelpWindowResources.RemarksTitle); }
/// <summary> /// Gets the value of a property or null if the value could not be retrieved /// </summary> /// <param name="psObj">object with the property</param> /// <param name="propertyName">property name</param> /// <returns>the value of a property or null if the value could not be retrieved</returns> private static object GetPropertyObject(PSObject psObj, string propertyName) { Debug.Assert(psObj != null, "ensured by caller"); PSPropertyInfo property = HelpParagraphBuilder.GetProperty(psObj, propertyName); if (property == null) { return(null); } object value = null; try { value = property.Value; } catch (ExtendedTypeSystemException) { } return(value); }