示例#1
0
 public static AssemblyType CreateAssemblyType(AssemblyImporter importer, System.Type systemType)
 {
     AssemblyType assemblyType = null;
     if (systemType.IsEnum)
     {
         assemblyType = new AssemblyEnumeration (importer, systemType);
         assemblyType.Begin ();
     }
     else if (systemType.IsInterface)
     {
         assemblyType = new AssemblyInterface (importer, systemType);
         assemblyType.Begin ();
     }
     else if (systemType.IsClass)
     {
         assemblyType = new AssemblyClass (importer, systemType);
         assemblyType.Begin ();
     }
     else if (systemType.IsPrimitive)
     {
         assemblyType = new AssemblyDataType (importer, systemType);
         assemblyType.Begin ();
     }
     else if (systemType.IsValueType)
     {
         if (systemType.GetMembers (AssemblyHelper.BINDING_FLAGS).Length == 1)
         {
             assemblyType = new AssemblyDataType (importer, systemType);
             assemblyType.Begin ();
         }
         else
         {
             assemblyType = new AssemblyStruct (importer, systemType);
             assemblyType.Begin ();
         }
     }
     else
     {
         System.Console.WriteLine ("System.FullName: "+systemType.FullName+" sealed: "+systemType.IsSealed );
     }
     return assemblyType;
 }
示例#2
0
 private void BeginWithType(System.Type type)
 {
     if (type.IsEnum)
     {
         if (Elements [type.FullName] == null && ImportEnumerations)
         {
             AssemblyEnumeration enm = new AssemblyEnumeration (this, type);
             enm.Begin ();
         }
     }
     else if (type.IsInterface)
     {
         if (Elements [type.FullName] == null && ImportInterfaces)
         {
             AssemblyInterface intrface = new AssemblyInterface (this, type);
             intrface.Begin ();
         }
     }
     else if (type.IsClass)
     {
         if (Elements [type.FullName] == null && ImportClasses)
         {
             AssemblyClass cls = new AssemblyClass (this, type);
             cls.Begin ();
         }
     }
     else if (type.IsPrimitive)
     {
         if (Elements [type.FullName] == null)
         {
             AssemblyDataType dataType = new AssemblyDataType (this, type);
             dataType.Begin ();
         }
     }
     else if (type.IsValueType)
     {
         if (Elements [type.FullName] == null)
         {
             if (type.GetMembers (AssemblyHelper.BINDING_FLAGS).Length == 1)
             {
                 AssemblyDataType dataType = new AssemblyDataType (this, type);
                 dataType.Begin ();
             }
             else if (ImportStructs)
             {
                 AssemblyStruct structure = new AssemblyStruct (this, type);
                 structure.Begin ();
             }
         }
     }
 }