//// N: = Namespace //// T: = Type i.e. class, interface, struct, enum or delegate //// F: = Field //// P: Property //// E: Event //// I: error unresolved construct public DocumentationHelper(string path) { var documentation = XDocument.Load(path); var typeDocs = new List<TypeDoc>(); var methodDocs = new List<MethodDoc>(); var fieldDocs = new List<FieldDoc>(); foreach (XElement element in documentation.Descendants("member")) { var name = element.Attribute("name") != null ? element.Attribute("name").Value : string.Empty; if (name.StartsWith("T:")) { var newType = new TypeDoc(element); typeDocs.Add(newType); methodDocs.AddRange(newType.Methods); fieldDocs.AddRange(newType.Fields); } } this.Types = typeDocs; this.Methods = methodDocs; this.Fields = fieldDocs; }
//// N: = Namespace //// T: = Type i.e. class, interface, struct, enum or delegate //// F: = Field //// P: Property //// E: Event //// I: error unresolved construct public DocumentationHelper(string path) { var documentation = XDocument.Load(path); var typeDocs = new List <TypeDoc>(); var methodDocs = new List <MethodDoc>(); var fieldDocs = new List <FieldDoc>(); foreach (XElement element in documentation.Descendants("member")) { var name = element.Attribute("name") != null?element.Attribute("name").Value : string.Empty; if (name.StartsWith("T:")) { var newType = new TypeDoc(element); typeDocs.Add(newType); methodDocs.AddRange(newType.Methods); fieldDocs.AddRange(newType.Fields); } } this.Types = typeDocs; this.Methods = methodDocs; this.Fields = fieldDocs; }
//// N: = Namespace //// T: = Type i.e. class, interface, struct, enum or delegate //// F: = Field //// P: Property //// E: Event //// I: error unresolved construct public DocumentationHelper(string path) { var _documentation = XDocument.Load(path); var _typeDocs = new List <TypeDoc>(); var _methodDocs = new List <MethodDoc>(); var _fieldDocs = new List <FieldDoc>(); foreach (XElement _element in _documentation.Descendants("member")) { var _name = _element.Attribute("name")?.Value ?? string.Empty; if (_name.StartsWith("T:")) { var _newType = new TypeDoc(_element); _typeDocs.Add(_newType); _methodDocs.AddRange(_newType.Methods); _fieldDocs.AddRange(_newType.Fields); } } this.Types = _typeDocs; this.Methods = _methodDocs; this.Fields = _fieldDocs; }
public MethodDoc(TypeDoc parent, XElement element) : this() { Parent = parent; var _attribute = element.Attribute("name")?.Value ?? string.Empty; FullName = _attribute.Replace("M:", string.Empty); var _firstParentesis = _attribute.IndexOf('('); if (_firstParentesis < 0) { _firstParentesis = _attribute.Length - 1; } var _lastDot = _attribute.LastIndexOf('.', _firstParentesis); Name = _attribute.Substring(_lastDot + 1, _firstParentesis - _lastDot - 1); FullyQuantifiedName = _attribute.Substring(0, _firstParentesis).Replace("M:", string.Empty); IsConstructor = Name.StartsWith("#"); var _xmlSummary = element.Descendants("summary").FirstOrDefault(); if (_xmlSummary != null) { Summary = _xmlSummary.Value; } var _xmlRemarks = element.Descendants("remarks").FirstOrDefault(); if (_xmlRemarks != null) { Remarks = _xmlRemarks.Value; } var _xmlExample = element.Descendants("example").FirstOrDefault(); if (_xmlExample != null) { Example = _xmlExample.Value; } var _xmlPermission = element.Descendants("permission").FirstOrDefault(); if (_xmlPermission != null) { Permission = _xmlPermission.Value; } var _xmlReturns = element.Descendants("returns").FirstOrDefault(); if (_xmlReturns != null) { Returns = _xmlReturns.Value; } //foreach (var seealso in element.Descendants("seealso")) //{ // var crefAttribute = seealso.Attribute("cref"); // if (crefAttribute != null) // { // this.SeeAlso.Add(crefAttribute.Value.Contains("Proxy") ? DocumentationHelper.ApiProxyInstance.GetTypeDocumentation(crefAttribute.Value) : DocumentationHelper.InterfaceInstance.GetTypeDocumentation(crefAttribute.Value)); // } //} //foreach (var seealso in element.Descendants("see")) //{ // var crefAttribute = seealso.Attribute("cref"); // if (crefAttribute != null) // { // this.SeeAlso.Add(crefAttribute.Value.Contains("Proxy") ? DocumentationHelper.ApiProxyInstance.GetTypeDocumentation(crefAttribute.Value) : DocumentationHelper.InterfaceInstance.GetTypeDocumentation(crefAttribute.Value)); // } //} _firstParentesis = FullName.IndexOf('('); var _parameterTypeList = _firstParentesis > 0 ? FullName.Substring( _firstParentesis + 1, FullName.LastIndexOf(")", StringComparison.Ordinal) - _firstParentesis - 1).Split(',') : new string[] { }; var _parameterIndex = 0; foreach (var _param in element.Descendants("param")) { var _nameAttribute = _param.Attribute("name"); if (_nameAttribute != null) { Params.Add(new MethodParam(_nameAttribute.Value, _param.Value, _parameterTypeList[_parameterIndex])); } _parameterIndex++; } foreach (var _exc in element.Descendants("exception")) { var _crefAttribute = _exc.Attribute("cref"); if (_crefAttribute != null) { Exceptions.Add(new MethodException(_crefAttribute.Value, _exc.Value)); } } }
public MethodDoc(TypeDoc parent, XElement element) : this() { this.Parent = parent; var attribute = element.Attribute("name"); this.FullName = attribute.Value.Replace("M:", string.Empty); var firstParentesis = attribute.Value.IndexOf('('); if (firstParentesis < 0) { firstParentesis = attribute.Value.Length - 1; } var lastDot = attribute.Value.LastIndexOf('.', firstParentesis); this.Name = attribute.Value.Substring(lastDot + 1, firstParentesis - lastDot - 1); this.FullyQuantifiedName = attribute.Value.Substring(0, firstParentesis).Replace("M:", string.Empty); this.IsConstructor = this.Name.StartsWith("#"); var xmlSummary = element.Descendants("summary").FirstOrDefault(); if (xmlSummary != null) { this.Summary = xmlSummary.Value; } var xmlRemarks = element.Descendants("remarks").FirstOrDefault(); if (xmlRemarks != null) { this.Remarks = xmlRemarks.Value; } var xmlExample = element.Descendants("example").FirstOrDefault(); if (xmlExample != null) { this.Example = xmlExample.Value; } var xmlPermission = element.Descendants("permission").FirstOrDefault(); if (xmlPermission != null) { this.Permission = xmlPermission.Value; } var xmlReturns = element.Descendants("returns").FirstOrDefault(); if (xmlReturns != null) { this.Returns = xmlReturns.Value; } //foreach (var seealso in element.Descendants("seealso")) //{ // var crefAttribute = seealso.Attribute("cref"); // if (crefAttribute != null) // { // this.SeeAlso.Add(crefAttribute.Value.Contains("Proxy") ? DocumentationHelper.ApiProxyInstance.GetTypeDocumentation(crefAttribute.Value) : DocumentationHelper.InterfaceInstance.GetTypeDocumentation(crefAttribute.Value)); // } //} //foreach (var seealso in element.Descendants("see")) //{ // var crefAttribute = seealso.Attribute("cref"); // if (crefAttribute != null) // { // this.SeeAlso.Add(crefAttribute.Value.Contains("Proxy") ? DocumentationHelper.ApiProxyInstance.GetTypeDocumentation(crefAttribute.Value) : DocumentationHelper.InterfaceInstance.GetTypeDocumentation(crefAttribute.Value)); // } //} firstParentesis = this.FullName.IndexOf('('); var parameterTypeList = firstParentesis > 0 ? this.FullName.Substring( firstParentesis + 1, this.FullName.LastIndexOf(")", StringComparison.Ordinal) - firstParentesis - 1).Split(',') : new string[] {}; var parameterIndex = 0; foreach (var param in element.Descendants("param")) { var nameAttribute = param.Attribute("name"); if (nameAttribute != null) { this.Params.Add(new MethodParam(nameAttribute.Value, param.Value, parameterTypeList[parameterIndex])); } parameterIndex++; } foreach (var exc in element.Descendants("exception")) { var crefAttribute = exc.Attribute("cref"); if (crefAttribute != null) { this.Exceptions.Add(new MethodException(crefAttribute.Value, exc.Value)); } } }
public MethodDoc(TypeDoc parent, XElement element) : this() { this.Parent = parent; var attribute = element.Attribute("name"); this.FullName = attribute.Value.Replace("M:", string.Empty); var firstParentesis = attribute.Value.IndexOf('('); if (firstParentesis < 0) { firstParentesis = attribute.Value.Length - 1; } var lastDot = attribute.Value.LastIndexOf('.', firstParentesis); this.Name = attribute.Value.Substring(lastDot + 1, firstParentesis - lastDot - 1); this.FullyQuantifiedName = attribute.Value.Substring(0, firstParentesis).Replace("M:", string.Empty); this.IsConstructor = this.Name.StartsWith("#"); var xmlSummary = element.Descendants("summary").FirstOrDefault(); if (xmlSummary != null) { this.Summary = xmlSummary.Value; } var xmlRemarks = element.Descendants("remarks").FirstOrDefault(); if (xmlRemarks != null) { this.Remarks = xmlRemarks.Value; } var xmlExample = element.Descendants("example").FirstOrDefault(); if (xmlExample != null) { this.Example = xmlExample.Value; } var xmlPermission = element.Descendants("permission").FirstOrDefault(); if (xmlPermission != null) { this.Permission = xmlPermission.Value; } var xmlReturns = element.Descendants("returns").FirstOrDefault(); if (xmlReturns != null) { this.Returns = xmlReturns.Value; } //foreach (var seealso in element.Descendants("seealso")) //{ // var crefAttribute = seealso.Attribute("cref"); // if (crefAttribute != null) // { // this.SeeAlso.Add(crefAttribute.Value.Contains("Proxy") ? DocumentationHelper.ApiProxyInstance.GetTypeDocumentation(crefAttribute.Value) : DocumentationHelper.InterfaceInstance.GetTypeDocumentation(crefAttribute.Value)); // } //} //foreach (var seealso in element.Descendants("see")) //{ // var crefAttribute = seealso.Attribute("cref"); // if (crefAttribute != null) // { // this.SeeAlso.Add(crefAttribute.Value.Contains("Proxy") ? DocumentationHelper.ApiProxyInstance.GetTypeDocumentation(crefAttribute.Value) : DocumentationHelper.InterfaceInstance.GetTypeDocumentation(crefAttribute.Value)); // } //} firstParentesis = this.FullName.IndexOf('('); var parameterTypeList = firstParentesis > 0 ? this.FullName.Substring( firstParentesis + 1, this.FullName.LastIndexOf(")", StringComparison.Ordinal) - firstParentesis - 1).Split(',') : new string[] {}; var parameterIndex = 0; foreach (var param in element.Descendants("param")) { var nameAttribute = param.Attribute("name"); if (nameAttribute != null) { this.Params.Add(new MethodParam(nameAttribute.Value, param.Value, parameterTypeList[parameterIndex])); } parameterIndex++; } foreach (var exc in element.Descendants("exception")) { var crefAttribute = exc.Attribute("cref"); if (crefAttribute != null) { this.Exceptions.Add(new MethodException(crefAttribute.Value, exc.Value)); } } }