Ejemplo n.º 1
0
        void LoadPluginTypes(Assembly assembly)
        {
            Type modelImporterType = typeof(ModelImporter);

            foreach (Type t in assembly.GetTypes().Where(t => t.IsSubclassOf(modelImporterType)))
            {
                ModelInfoAttribute mia = t.GetCustomAttribute <ModelInfoAttribute>();
                if (mia == null)
                {
                    throw new Exception("Error: ModelImporter " + t.ToString() + " from importer " + assembly.Location + " is missing a ModelInfoAttribute");
                }

                modelImporters.Add(mia.Extension, new ModelInstantationHelper(Activator.CreateInstance(t) as ModelImporter, mia));
            }
        }
Ejemplo n.º 2
0
 public ModelInstantationHelper(ModelImporter importer, ModelInfoAttribute mia)
 {
     ModelImporter = importer;
     ModelInfo     = mia;
 }