Example #1
0
        private SDMethod GetParsedMethod(IMethod method, bool isCtor)
        {
            var sdMethod = _repository.GetMethodByIdentifier(method.GetIdentifier());

            if (sdMethod != null)
            {
                return(sdMethod);
            }

            var returnType = _typeParser.GetParsedType(method.ReturnType);

            sdMethod = new SDMethod(method.GetIdentifier(), isCtor ? method.DeclaringType.Name : method.Name)
            {
                Namespace      = method.Namespace,
                DeclaringType  = _typeParser.GetParsedType(method.DeclaringType),
                ReturnType     = returnType,
                IsCtor         = isCtor,
                Accessibility  = method.Accessibility.ToString().ToLower(),
                IsAbstract     = method.IsAbstract,
                IsShadowing    = method.IsShadowing,
                IsOverride     = method.IsOverride,
                IsPrivate      = method.IsPrivate,
                IsProtected    = method.IsProtected,
                IsPublic       = method.IsPublic,
                IsSealed       = method.IsSealed,
                IsVirtual      = method.IsVirtual,
                IsStatic       = method.IsStatic,
                Documentations = _documentationParser.ParseDocumentation(method),
                Region         = new SDRegion
                {
                    BeginColumn = method.Region.BeginColumn,
                    BeginLine   = method.Region.BeginLine,
                    EndColumn   = method.Region.EndColumn,
                    EndLine     = method.Region.EndLine,
                    Filename    = method.Region.FileName
                }
            };

            foreach (ITypeParameter typeParameter in method.TypeParameters)
            {
                sdMethod.TypeParameters.Add(_typeParser.GetParsedType(typeParameter));
            }

            foreach (IParameter parameter in method.Parameters)
            {
                sdMethod.Parameters.Add(new SDParameter
                {
                    Name          = parameter.Name,
                    ParamType     = _typeParser.GetParsedType(parameter.Type),
                    IsOptional    = parameter.IsOptional,
                    IsConst       = parameter.IsConst,
                    ConstantValue = parameter.ConstantValue,
                    IsRef         = parameter.IsRef,
                    IsOut         = parameter.IsOut
                });
            }

            _repository.AddMethod(sdMethod);
            return(sdMethod);
        }
Example #2
0
        private SDField GetParsedField(IField field)
        {
            var sdField = new SDField(field.GetIdentifier())
            {
                Name          = field.Name,
                DeclaringType = _typeParser.GetParsedType(field.DeclaringType),
                Accessibility = field.Accessibility.ToString().ToLower(),
                ReturnType    = _typeParser.GetParsedType(field.ReturnType),
                ConstantValue = field.ConstantValue != null?field.ConstantValue.ToString() : string.Empty,
                                    IsConst        = field.IsConst,
                                    IsReadonly     = field.IsReadOnly,
                                    Documentations = _documentationParser.ParseDocumentation(field)
            };

            _repository.AddMember(sdField);
            return(sdField);
        }
Example #3
0
        private SDProperty GetParsedProperty(IProperty property)
        {
            var sdProperty = new SDProperty(property.GetIdentifier())
            {
                Name           = property.Name,
                DeclaringType  = _typeParser.GetParsedType(property.DeclaringType),
                Accessibility  = property.Accessibility.ToString().ToLower(),
                ReturnType     = _typeParser.GetParsedType(property.ReturnType),
                CanGet         = property.CanGet,
                CanSet         = property.CanSet,
                IsAbstract     = property.IsAbstract,
                IsVirtual      = property.IsVirtual,
                IsOverride     = property.IsOverride,
                Documentations = _documentationParser.ParseDocumentation(property)
            };

            _repository.AddMember(sdProperty);
            return(sdProperty);
        }
Example #4
0
        private SDEvent GetParsedEvent(IEvent eve)
        {
            var sdEvent = new SDEvent(eve.GetIdentifier())
            {
                Name           = eve.Name,
                DeclaringType  = _typeParser.GetParsedType(eve.DeclaringType),
                Accessibility  = eve.Accessibility.ToString().ToLower(),
                Documentations = _documentationParser.ParseDocumentation(eve)
            };

            _repository.AddMember(sdEvent);
            return(sdEvent);
        }