private void WriteObjectsOrShowOnlineHelp(HelpInfo helpInfo, bool showFullHelp) { if (helpInfo != null) { if (showFullHelp && this.showOnlineHelp) { bool flag = false; tracer.WriteLine("Preparing to show help online.", new object[0]); Uri uriForOnlineHelp = helpInfo.GetUriForOnlineHelp(); if (null != uriForOnlineHelp) { flag = true; this.LaunchOnlineHelp(uriForOnlineHelp); } else if (!flag) { throw PSTraceSource.NewInvalidOperationException("HelpErrors", "NoURIFound", new object[0]); } } else if (showFullHelp && (this.ShowWindow != 0)) { this.graphicalHostReflectionWrapper.CallStaticMethod("ShowHelpWindow", new object[] { helpInfo.FullHelp, this }); } else if (showFullHelp) { if (!string.IsNullOrEmpty(this._parameter)) { this.GetAndWriteParameterInfo(helpInfo); } else { PSObject sendToPipeline = this.TransformView(helpInfo.FullHelp); sendToPipeline.IsHelpObject = true; base.WriteObject(sendToPipeline); } } else { if (!string.IsNullOrEmpty(this._parameter)) { PSObject[] parameter = helpInfo.GetParameter(this._parameter); if ((parameter == null) || (parameter.Length == 0)) { return; } } base.WriteObject(helpInfo.ShortHelp); } } }
private void WriteObjectsOrShowOnlineHelp(HelpInfo helpInfo, bool showFullHelp) { if (helpInfo == null) { return; } if (showFullHelp && this.showOnlineHelp) { bool flag = false; GetHelpCommand.tracer.WriteLine("Preparing to show help online.", new object[0]); Uri uriForOnlineHelp = helpInfo.GetUriForOnlineHelp(); if ((Uri)null != uriForOnlineHelp) { this.LaunchOnlineHelp(uriForOnlineHelp); } else if (!flag) { throw GetHelpCommand.tracer.NewInvalidOperationException("HelpErrors", "NoURIFound"); } } else if (showFullHelp) { if (!string.IsNullOrEmpty(this._parameter)) { this.GetAndWriteParameterInfo(helpInfo); } else { this.WriteObject((object)this.TransformView(helpInfo.FullHelp)); } } else { if (!string.IsNullOrEmpty(this._parameter)) { PSObject[] parameter = helpInfo.GetParameter(this._parameter); if (parameter == null || parameter.Length == 0) { return; } } this.WriteObject((object)helpInfo.ShortHelp); } }
/// <summary> /// Helper method used to Write the help object onto the output /// stream or show online help (URI extracted from the HelpInfo) /// object. /// </summary> private void WriteObjectsOrShowOnlineHelp(HelpInfo helpInfo, bool showFullHelp) { if (helpInfo != null) { // online help can be showed only if showFullHelp is true.. // showFullHelp will be false when the help tries to display multiple help topics.. // -Online should not work when multiple help topics are displayed. if (showFullHelp && _showOnlineHelp) { bool onlineUriFound = false; // show online help s_tracer.WriteLine("Preparing to show help online."); Uri onlineUri = helpInfo.GetUriForOnlineHelp(); if (onlineUri != null) { onlineUriFound = true; LaunchOnlineHelp(onlineUri); return; } if (!onlineUriFound) { throw PSTraceSource.NewInvalidOperationException(HelpErrors.NoURIFound); } } #if !UNIX else if (showFullHelp && ShowWindow) { graphicalHostReflectionWrapper.CallStaticMethod("ShowHelpWindow", helpInfo.FullHelp, this); } #endif else { // show inline help if (showFullHelp) { if (Parameter != null) { GetAndWriteParameterInfo(helpInfo); } else { PSObject objectToReturn = TransformView(helpInfo.FullHelp); objectToReturn.IsHelpObject = true; WriteObject(objectToReturn); } } else { if (Parameter != null) { PSObject[] pInfos = GetParameterInfo(helpInfo); if ((pInfos == null) || (pInfos.Length == 0)) { return; } } WriteObject(helpInfo.ShortHelp); } } } }