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); } } }
private SDType CreateSDType(IType type) { var nameSpace = _repository.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() }; _repository.AddType(sdType); return(sdType); }
public static void AddKnownTypes(SDRepository sdRepository) { var systemNamespace = sdRepository.GetNamespaceByIdentifier("System"); if (systemNamespace != null) { sdRepository.AddType(new SDType("dynamic", "Dynamic", systemNamespace) { IsProjectStranger = true, CSharpName = "dynamic" }); sdRepository.AddType(new SDType("System.Object", "Object", systemNamespace) { IsProjectStranger = true, CSharpName = "object" }); sdRepository.AddType(new SDType("System.Boolean", "Boolean", systemNamespace) { IsProjectStranger = true, CSharpName = "bool" }); sdRepository.AddType(new SDType("System.Char", "Char", systemNamespace) { IsProjectStranger = true, CSharpName = "char" }); sdRepository.AddType(new SDType("System.SByte", "SByte", systemNamespace) { IsProjectStranger = true, CSharpName = "sbyte" }); sdRepository.AddType(new SDType("System.Byte", "Byte", systemNamespace) { IsProjectStranger = true, CSharpName = "byte" }); sdRepository.AddType(new SDType("System.Int16", "Int16", systemNamespace) { IsProjectStranger = true, CSharpName = "short" }); sdRepository.AddType(new SDType("System.UInt16", "UInt16", systemNamespace) { IsProjectStranger = true, CSharpName = "ushort" }); sdRepository.AddType(new SDType("System.Int32", "Int32", systemNamespace) { IsProjectStranger = true, CSharpName = "int" }); sdRepository.AddType(new SDType("System.UInt32", "UInt32", systemNamespace) { IsProjectStranger = true, CSharpName = "uint" }); sdRepository.AddType(new SDType("System.Int64", "Int64", systemNamespace) { IsProjectStranger = true, CSharpName = "long" }); sdRepository.AddType(new SDType("System.UInt64", "UInt64", systemNamespace) { IsProjectStranger = true, CSharpName = "ulong" }); sdRepository.AddType(new SDType("System.Single", "Single", systemNamespace) { IsProjectStranger = true, CSharpName = "float" }); sdRepository.AddType(new SDType("System.Double", "Double", systemNamespace) { IsProjectStranger = true, CSharpName = "double" }); sdRepository.AddType(new SDType("System.Decimal", "Decimal", systemNamespace) { IsProjectStranger = true, CSharpName = "decimal" }); sdRepository.AddType(new SDType("System.String", "String", systemNamespace) { IsProjectStranger = true, CSharpName = "string" }); sdRepository.AddType(new SDType("System.Void", "Void", systemNamespace) { IsProjectStranger = true, CSharpName = "void" }); } }