예제 #1
0
 private static void Search(List <Assembly> assemblies, List <Type> entries, List <ClassCreator> impls)
 {
     foreach (var assembly in assemblies)
     {
         try
         {
             foreach (var type in assembly.GetTypes())
             {
                 var entry = type.GetAttribute <DependenceEntryAttribute>(false);
                 if (entry != null)
                 {
                     entries.Add(type);
                 }
                 var impl = type.GetAttribute <ImplementationAttribute>(false);
                 if (impl != null)
                 {
                     impls.Add(ClassCreator.New(type, impl.Index, impl.Name));
                 }
             }
         }
         catch (ReflectionTypeLoadException ex)
         {
             throw new SystemException("Loading assembly error: " + assembly.FullName, ex);
         }
     }
 }
예제 #2
0
        public static void Register(Type entryType, Type implType, int index, string name)
        {
            var cc = ClassCreator.New(implType, index, name);

            Register(entryType, cc);
        }