public void Add(List <Namespace> namespaces, DocumentedMethod association) { if (association.Method == null) { return; } DeclaredType type = FindType(association, namespaces); DeclaredType methodReturnType = null; if (association.Method.MemberType == MemberTypes.Method) { methodReturnType = DeclaredType.Unresolved( IdentifierFor.Type(((MethodInfo)association.Method).ReturnType), ((MethodInfo)association.Method).ReturnType, Namespace.Unresolved(IdentifierFor.Namespace(((MethodInfo)association.Method).ReturnType.Namespace))); } Method doc = Method.Unresolved( IdentifierFor.Method(association.Method, association.TargetType), type, association.Method, methodReturnType); ParseSummary(association, doc); ParseRemarks(association, doc); ParseValue(association, doc); ParseReturns(association, doc); ParseExample(association, doc); foreach (ParameterInfo parameter in association.Method.GetParameters()) { DeclaredType reference = DeclaredType.Unresolved( IdentifierFor.Type(parameter.ParameterType), parameter.ParameterType, Namespace.Unresolved(IdentifierFor.Namespace(parameter.ParameterType.Namespace))); var docParam = new MethodParameter(parameter.Name, parameter.IsOptional, parameter.DefaultValue, reference); ParseParamSummary(association, docParam); doc.AddParameter(docParam); } if (_matchedAssociations.ContainsKey(association.Name)) { return; // weird case when a type has the same method declared twice } _matchedAssociations.Add(association.Name, doc); if (type == null) { return; } type.AddMethod(doc); }
public void Add(List <Namespace> namespaces, DocumentedMethod association) { if (association.Method == null) { return; } var ns = FindNamespace(association, namespaces); var type = FindType(ns, association); try { var methodReturnType = DeclaredType.Unresolved( Identifier.FromType(association.Method.ReturnType), association.Method.ReturnType, Namespace.Unresolved(Identifier.FromNamespace(association.Method.ReturnType.Namespace))); var doc = Method.Unresolved( Identifier.FromMethod(association.Method, association.TargetType), type, association.Method, methodReturnType); ParseSummary(association, doc); ParseRemarks(association, doc); ParseValue(association, doc); ParseReturns(association, doc); ParseExample(association, doc); foreach (var parameter in association.Method.GetParameters()) { var reference = DeclaredType.Unresolved( Identifier.FromType(parameter.ParameterType), parameter.ParameterType, Namespace.Unresolved(Identifier.FromNamespace(parameter.ParameterType.Namespace))); var docParam = new MethodParameter(parameter.Name, reference); ParseParamSummary(association, docParam); doc.AddParameter(docParam); } if (matchedAssociations.ContainsKey(association.Name)) { return; // weird case when a type has the same method declared twice } matchedAssociations.Add(association.Name, doc); if (type == null) { return; } type.AddMethod(doc); } catch (IOException ex) { var doc = Method.Unresolved( Identifier.FromMethod(association.Method, association.TargetType), type, association.Method, new NullReference()); type.AddMethod(doc); } }
public void Add(List <Namespace> namespaces, DocumentedType association) { Namespace ns = FindNamespace(association, namespaces); DeclaredType doc = DeclaredType.Unresolved((TypeIdentifier)association.Name, association.TargetType, ns); ParseSummary(association, doc); ParseRemarks(association, doc); ParseValue(association, doc); ParseExample(association, doc); if (matchedAssociations.ContainsKey(association.Name)) { return; } matchedAssociations.Add(association.Name, doc); ns.AddType(doc); }
public void Add(List <Namespace> namespaces, DocumentedProperty association) { if (association.Property == null) { return; } DeclaredType type = FindType(association, namespaces); var isStatic = association.Property.GetGetMethod().IsStatic; DeclaredType propertyReturnType = DeclaredType.Unresolved( IdentifierFor.Type(association.Property.PropertyType), association.Property.PropertyType, Namespace.Unresolved(IdentifierFor.Namespace(association.Property.PropertyType.Namespace))); Property doc = Property.Unresolved( IdentifierFor.Property(association.Property, association.TargetType, isStatic), type, association.Property, propertyReturnType); ParseSummary(association, doc); ParseValue(association, doc); ParseRemarks(association, doc); ParseExample(association, doc); if (_matchedAssociations.ContainsKey(association.Name)) { return; } _matchedAssociations.Add(association.Name, doc); if (type == null) { return; } type.AddProperty(doc); }
public void Add(List <Namespace> namespaces, DocumentedField association) { if (association.Field == null) { return; } var ns = FindNamespace(association, namespaces); var type = FindType(ns, association); var returnType = DeclaredType.Unresolved(Identifier.FromType(association.Field.FieldType), association.Field.FieldType, Namespace.Unresolved( Identifier.FromNamespace(association.Field.FieldType.Namespace))); var doc = Field.Unresolved(Identifier.FromField(association.Field, association.TargetType), type, returnType); ParseSummary(association, doc); ParseRemarks(association, doc); ParseExample(association, doc); matchedAssociations[association.Name] = doc; type.AddField(doc); }
public void Add(List <Namespace> namespaces, DocumentedField association) { if (association.Field == null) { return; } DeclaredType type = FindType(association, namespaces); DeclaredType returnType = DeclaredType.Unresolved( IdentifierFor.Type(association.Field.FieldType), association.Field.FieldType, Namespace.Unresolved(IdentifierFor.Namespace(association.Field.FieldType.Namespace))); Field doc = Field.Unresolved( IdentifierFor.Field(association.Field, association.TargetType), type, returnType); ParseSummary(association, doc); ParseRemarks(association, doc); ParseExample(association, doc); _matchedAssociations.Add(association.Name, doc); type.AddField(doc); }
public IComment Parse(ICommentParser parser, XmlNode node, bool first, bool last, ParseOptions options) { IReferencable reference = new NullReference(); if (node.Attributes["cref"] == null) { return(new See(reference)); } var referenceTarget = Identifier.FromString(node.Attributes["cref"].Value); if (referenceTarget is NamespaceIdentifier) { reference = Namespace.Unresolved((NamespaceIdentifier)referenceTarget); } else if (referenceTarget is TypeIdentifier) { reference = DeclaredType.Unresolved((TypeIdentifier)referenceTarget, Namespace.Unresolved(referenceTarget.CloneAsNamespace())); } else if (referenceTarget is MethodIdentifier) { reference = Method.Unresolved( (MethodIdentifier)referenceTarget, DeclaredType.Unresolved( referenceTarget.CloneAsType(), Namespace.Unresolved(referenceTarget.CloneAsNamespace()) ) ); } else if (referenceTarget is PropertyIdentifier) { reference = Property.Unresolved( (PropertyIdentifier)referenceTarget, DeclaredType.Unresolved( referenceTarget.CloneAsType(), Namespace.Unresolved(referenceTarget.CloneAsNamespace()) ) ); } else if (referenceTarget is EventIdentifier) { reference = Event.Unresolved( (EventIdentifier)referenceTarget, DeclaredType.Unresolved( referenceTarget.CloneAsType(), Namespace.Unresolved(referenceTarget.CloneAsNamespace()) ) ); } else if (referenceTarget is FieldIdentifier) { reference = Field.Unresolved( (FieldIdentifier)referenceTarget, DeclaredType.Unresolved( referenceTarget.CloneAsType(), Namespace.Unresolved(referenceTarget.CloneAsNamespace()) ) ); } return(new See(reference)); }