private IEnumerable <HelpInfo> ForwardHelp(HelpInfo helpInfo, HelpRequest helpRequest) { new Collection <HelpInfo>(); if ((helpInfo.ForwardHelpCategory == HelpCategory.None) && string.IsNullOrEmpty(helpInfo.ForwardTarget)) { yield return(helpInfo); } else { HelpCategory forwardHelpCategory = helpInfo.ForwardHelpCategory; bool iteratorVariable1 = false; for (int i = 0; i < this.HelpProviders.Count; i++) { HelpProvider iteratorVariable3 = (HelpProvider)this.HelpProviders[i]; if ((iteratorVariable3.HelpCategory & forwardHelpCategory) != HelpCategory.None) { iteratorVariable1 = true; foreach (HelpInfo iteratorVariable4 in iteratorVariable3.ProcessForwardedHelp(helpInfo, helpRequest)) { foreach (HelpInfo iteratorVariable5 in this.ForwardHelp(iteratorVariable4, helpRequest)) { yield return(iteratorVariable5); } goto Label_01FB; } } } if (!iteratorVariable1) { yield return(helpInfo); } } Label_01FB: yield break; }
/// <summary> /// Forward help to the help provider with type forwardHelpCategory. /// /// This is used in the following known scenarios so far /// 1. Alias: helpInfo returned by Alias is not what end user needed. /// The real help can be retrieved from Command help provider. /// </summary> /// <param name="helpInfo"></param> /// <param name="helpRequest">Help request object</param> /// <returns>Never returns null.</returns> /// <remarks>helpInfos is not null or empty.</remarks> private IEnumerable <HelpInfo> ForwardHelp(HelpInfo helpInfo, HelpRequest helpRequest) { Collection <HelpInfo> result = new Collection <HelpInfo>(); // findout if this helpInfo needs to be processed further.. if (helpInfo.ForwardHelpCategory == HelpCategory.None && string.IsNullOrEmpty(helpInfo.ForwardTarget)) { // this helpInfo is final...so store this in result // and move on.. yield return(helpInfo); } else { // Find out a capable provider to process this request... HelpCategory forwardHelpCategory = helpInfo.ForwardHelpCategory; bool isHelpInfoProcessed = false; for (int i = 0; i < this.HelpProviders.Count; i++) { HelpProvider helpProvider = (HelpProvider)this.HelpProviders[i]; if ((helpProvider.HelpCategory & forwardHelpCategory) != HelpCategory.None) { isHelpInfoProcessed = true; // If this help info is processed by this provider already, break // out of the provider loop... foreach (HelpInfo fwdResult in helpProvider.ProcessForwardedHelp(helpInfo, helpRequest)) { // Add each helpinfo to our repository foreach (HelpInfo fHelpInfo in ForwardHelp(fwdResult, helpRequest)) { yield return(fHelpInfo); } // get out of the provider loop.. yield break; } } } if (!isHelpInfoProcessed) { // we are here because no help provider processed the helpinfo.. // so add this to our repository.. yield return(helpInfo); } } }
private IEnumerable <HelpInfo> ForwardHelp( HelpInfo helpInfo, HelpRequest helpRequest) { Collection <HelpInfo> collection = new Collection <HelpInfo>(); if (helpInfo.ForwardHelpCategory == HelpCategory.None && string.IsNullOrEmpty(helpInfo.ForwardTarget)) { yield return(helpInfo); } else { HelpCategory forwardHelpCategory = helpInfo.ForwardHelpCategory; bool isHelpInfoProcessed = false; for (int i = 0; i < this.HelpProviders.Count; ++i) { HelpProvider helpProvider = (HelpProvider)this.HelpProviders[i]; if ((helpProvider.HelpCategory & forwardHelpCategory) == forwardHelpCategory) { isHelpInfoProcessed = true; using (IEnumerator <HelpInfo> enumerator = helpProvider.ProcessForwardedHelp(helpInfo, helpRequest).GetEnumerator()) { if (enumerator.MoveNext()) { HelpInfo fwdResult = enumerator.Current; foreach (HelpInfo helpInfo1 in this.ForwardHelp(fwdResult, helpRequest)) { yield return(helpInfo1); } yield break; } } } } if (!isHelpInfoProcessed) { yield return(helpInfo); } } }