Ejemplo n.º 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)
         {
             System.Diagnostics.Debug.WriteLine("Loading assembly error: " + assembly.FullName + ex);
         }
     }
 }
Ejemplo n.º 2
0
        public static void Register(Type entryType, Type implType, int index, string name)
        {
            var cc = ClassCreator.New(implType, index, name);

            Register(entryType, cc);
        }