Exemplo n.º 1
0
        private void ParseTypes()
        {
            var pi = 0;

            for (int i = 0; i < _solution.Projects.Count; i++)
            {
                pi = i;
                var types = _solution.Projects[i].Compilation.MainAssembly.TopLevelTypeDefinitions.ToList();
                for (int j = 0; j < types.Count; j++)
                {
                    if (types[j].Kind != TypeKind.Delegate)
                    {
                        PostProgress(_sdBuildStrings.ParsingClass + ": " + string.Format("{0}.{1}", types[j].Namespace, types[j].Name), j, types.Count, pi, _solution.Projects.Count);

                        var sdType = CreateSDType(types[j]);

                        EventParser.ParseMinimalFields(sdType, types[j]);
                        PropertyParser.ParseMinimalProperties(sdType, types[j]);
                        FieldParser.ParseMinimalFields(sdType, types[j]);
                        MethodParser.ParseMinimalConstructors(sdType, types[j]);
                        MethodParser.ParseMinimalMethods(sdType, types[j]);

                        _repository.AddNamespaceTypeRelation(types[j].Namespace, sdType.Identifier);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void StructureParseTypes(CSharpProject project, SDRepository sdRepository)
        {
            var types = project.Compilation.MainAssembly.TopLevelTypeDefinitions.ToList();

            for (int j = 0; j < types.Count; j++)
            {
                var type = types[j];
                if (types[j].Kind != TypeKind.Delegate)
                {
                    PostParseMessage(_parserStrings.ParsingClass + ": " + string.Format("{0}.{1}", types[j].Namespace, types[j].Name));

                    var nameSpace    = sdRepository.GetNamespaceByIdentifier(type.Namespace);
                    var namespaceRef = nameSpace ?? new SDNamespace(type.Namespace)
                    {
                        IsProjectStranger = true
                    };

                    var sdType = new SDType(type.GetIdentifier(), type.Name, namespaceRef)
                    {
                        Accessibility = type.GetDefinition().Accessibility.ToString().ToLower()
                    };

                    sdRepository.AddType(sdType);

                    EventParser.ParseMinimalFields(sdType, types[j]);
                    PropertyParser.ParseMinimalProperties(sdType, types[j]);
                    FieldParser.ParseMinimalFields(sdType, types[j]);
                    MethodParser.ParseMinimalConstructors(sdType, types[j]);
                    MethodParser.ParseMinimalMethods(sdType, types[j]);

                    sdRepository.AddNamespaceTypeRelation(types[j].Namespace, sdType.Identifier);
                }
            }
        }