/// <summary> /// Constructor /// </summary> /// <param name="component">The component creating the instance</param> /// <param name="assemblyName">The assembly name</param> /// <param name="memberName">The member name</param> /// <param name="comments">The XPath navigator from which to extract the comments information</param> public CommentsInfo(IntelliSenseComponent component, string assemblyName, string memberName, XPathNavigator comments) { this.AssemblyName = assemblyName; this.MemberName = memberName; this.Summary = comments.SelectSingleNode(component.summaryExpression); this.Params = comments.Select(component.paramExpression); this.TypeParams = comments.Select(component.typeparamExpression); this.Returns = comments.SelectSingleNode(component.returnsExpression); this.Value = comments.SelectSingleNode(component.valueExpression); this.Exceptions = comments.Select(component.exceptionExpression); this.CodeContracts = comments.Select(component.codeContractsExpression); if ((string)comments.Evaluate(component.subgroupExpression) == "enumeration") { var enums = new List <KeyValuePair <string, XPathNavigator> >(); this.EnumElements = enums; foreach (XPathNavigator nav in (XPathNodeIterator)comments.Evaluate(component.elementsExpression)) { string enumName = nav.GetAttribute("api", String.Empty); var summaryComments = nav.SelectSingleNode(component.summaryExpression); if (!String.IsNullOrWhiteSpace(enumName) && summaryComments != null) { enums.Add(new KeyValuePair <string, XPathNavigator>(enumName, summaryComments)); } } } }
/// <summary> /// Constructor /// </summary> /// <param name="component">The component creating the instance</param> /// <param name="assemblyName">The assembly name</param> /// <param name="memberName">The member name</param> /// <param name="comments">The XPath navigator from which to extract the comments information</param> public CommentsInfo(IntelliSenseComponent component, string assemblyName, string memberName, XPathNavigator comments) { this.AssemblyName = assemblyName; this.MemberName = memberName; this.Summary = comments.SelectSingleNode(component.summaryExpression); this.Params = comments.Select(component.paramExpression); this.TypeParams = comments.Select(component.typeparamExpression); this.Returns = comments.SelectSingleNode(component.returnsExpression); this.Exceptions = comments.Select(component.exceptionExpression); this.CodeContracts = comments.Select(component.codeContractsExpression); if((string)comments.Evaluate(component.subgroupExpression) == "enumeration") { var enums = new List<KeyValuePair<string, XPathNavigator>>(); this.EnumElements = enums; foreach(XPathNavigator nav in (XPathNodeIterator)comments.Evaluate(component.elementsExpression)) { string enumName = nav.GetAttribute("api", String.Empty); var summaryComments = nav.SelectSingleNode(component.summaryExpression); if(!String.IsNullOrWhiteSpace(enumName) && summaryComments != null) enums.Add(new KeyValuePair<string, XPathNavigator>(enumName, summaryComments)); } } }