private ParseDocumentation ( IEnumerable |
||
docElements | IEnumerable |
|
multilang | bool | |
Résultat | SharpDox.Model.Documentation.SDDocumentation |
private SDMethod GetParsedMethod(IMethodSymbol method, bool isCtor) { var sdMethod = ParserOptions.SDRepository.GetMethodByIdentifier(method.GetIdentifier()); if (sdMethod != null) { return(sdMethod); } var returnType = _typeRefParser.GetParsedTypeReference(method.ReturnType); var syntaxReference = method.DeclaringSyntaxReferences.Any() ? method.DeclaringSyntaxReferences.Single() : null; sdMethod = new SDMethod(method.GetIdentifier(), isCtor ? method.ContainingType.Name : method.Name) { Namespace = method.ContainingNamespace.GetIdentifier(), DeclaringType = _typeRefParser.GetParsedTypeReference(method.ContainingType), ReturnType = returnType, IsCtor = isCtor, Accessibility = method.DeclaredAccessibility.ToString().ToLower(), IsAbstract = method.IsAbstract, IsOverride = method.IsOverride, IsPrivate = method.DeclaredAccessibility == Accessibility.Private, IsProtected = method.DeclaredAccessibility == Accessibility.Protected, IsPublic = method.DeclaredAccessibility == Accessibility.Public, IsSealed = method.IsSealed, IsVirtual = method.IsVirtual, IsStatic = method.IsStatic, Documentations = DocumentationParser.ParseDocumentation(method), Region = syntaxReference != null ? new SDRegion { Start = syntaxReference.Span.Start, End = syntaxReference.Span.End, Filename = syntaxReference.SyntaxTree.FilePath } : null }; foreach (var typeParameter in method.TypeParameters) { sdMethod.TypeParameters.Add(_typeRefParser.GetParsedTypeReference(typeParameter)); } foreach (var parameter in method.Parameters) { sdMethod.Parameters.Add(new SDParameter { Name = parameter.Name, ParamType = _typeRefParser.GetParsedTypeReference(parameter.Type), IsOptional = parameter.IsOptional, IsConst = parameter.HasExplicitDefaultValue, ConstantValue = parameter.HasExplicitDefaultValue ? parameter.ExplicitDefaultValue?.ToString() ?? "null" : null, IsRef = parameter.RefKind == RefKind.Ref, IsOut = parameter.RefKind == RefKind.Out }); } ParserOptions.SDRepository.AddMethod(sdMethod); return(sdMethod); }
private SDEvent GetParsedEvent(IEventSymbol eve) { var sdEvent = new SDEvent(eve.GetIdentifier()) { Name = eve.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(eve.ContainingType), Accessibility = eve.DeclaredAccessibility.ToString().ToLower(), Documentations = DocumentationParser.ParseDocumentation(eve) }; ParserOptions.SDRepository.AddMember(sdEvent); return(sdEvent); }
private void ParseTypeToModel(SDType sdType, ITypeSymbol typeSymbol) { var type = typeSymbol as INamedTypeSymbol; if (type != null) { sdType.IsProjectStranger = false; sdType.Documentations = DocumentationParser.ParseDocumentation(typeSymbol); AddParsedNestedTypes(sdType, type.GetTypeMembers()); AddParsedTypeArguments(sdType, type.TypeArguments); AddParsedTypeParameters(sdType, type.TypeParameters); AddParsedProperties(sdType, type); AddParsedFields(sdType, type); AddParsedConstructorsAndMethods(sdType, type); AddParsedEvents(sdType, type); } }
private SDField GetParsedField(IFieldSymbol field) { var sdField = new SDField(field.GetIdentifier()) { Name = field.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(field.ContainingType), Accessibility = field.DeclaredAccessibility.ToString().ToLower(), ReturnType = _typeRefParser.GetParsedTypeReference(field.Type), ConstantValue = field.ConstantValue != null?field.ConstantValue.ToString() : string.Empty, IsConst = field.IsConst, IsReadonly = field.IsReadOnly, Documentations = DocumentationParser.ParseDocumentation(field) }; ParserOptions.SDRepository.AddMember(sdField); return(sdField); }
private SDProperty GetParsedProperty(IPropertySymbol property) { var sdProperty = new SDProperty(property.GetIdentifier()) { Name = property.Name, DeclaringType = _typeRefParser.GetParsedTypeReference(property.ContainingType), Accessibility = property.DeclaredAccessibility.ToString().ToLower(), ReturnType = _typeRefParser.GetParsedTypeReference(property.Type), CanGet = property.GetMethod != null, CanSet = property.SetMethod != null, IsAbstract = property.IsAbstract, IsVirtual = property.IsVirtual, IsOverride = property.IsOverride, Documentations = DocumentationParser.ParseDocumentation(property) }; ParserOptions.SDRepository.AddMember(sdProperty); return(sdProperty); }