- Timestamp:
- 11/16/09 14:25:50 (15 years ago)
- Location:
- branches/PluginInfrastructure Refactoring
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure.Manager/ApplicationManager.cs
r2489 r2495 28 28 using System.Security; 29 29 using System.Linq; 30 using System.IO; 30 31 31 32 namespace HeuristicLab.PluginInfrastructure.Manager { … … 75 76 // load all loadable plugins (all dependencies available) into the execution context 76 77 foreach (var desc in PluginDescriptionIterator.IterateInDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) { 77 foreach (var plugin in GetInstances<IPlugin>(desc)) { 78 plugin.OnLoad(); 79 FirePluginLoaded(plugin.Name); 78 foreach (string assembly in desc.Assemblies) { 79 var asm = Assembly.LoadFrom(assembly); 80 81 // instantiate and load all plugins in this assembly 82 foreach (var plugin in GetInstances<IPlugin>(asm)) { 83 plugin.OnLoad(); 84 FirePluginLoaded(plugin.Name); 85 } 80 86 } 81 87 desc.Load(); 82 88 } 89 83 90 } 84 91 … … 128 135 } 129 136 /// <summary> 137 /// Creates an instance of all types declared in assembly <param name="asm"/> that are subtypes or the same type of the specified type and declared in <paramref name="plugin"/> 138 /// </summary> 139 /// <typeparam name="T">Most general type.</typeparam> 140 /// <param name="asm">Declaring assembly.</param> 141 /// <returns>Enumerable of the created instances.</returns> 142 public IEnumerable<T> GetInstances<T>(Assembly asm) where T : class { 143 return from t in GetTypes(typeof(T), asm) 144 where !t.IsAbstract && !t.IsInterface && !t.HasElementType 145 select (T)Activator.CreateInstance(t); 146 } 147 /// <summary> 130 148 /// Creates an instance of all types that are subtypes or the same type of the specified type 131 149 /// </summary> … … 167 185 /// <returns>Enumerable of the discovered types.</returns> 168 186 public IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) { 169 throw new NotImplementedException(); 170 //return from asm in AppDomain.CurrentDomain.GetAssemblies() 171 // where pluginDescription.Assemblies.Contains(asm.Location) 172 // from t in GetTypes(type, asm) 173 // select t; 187 return from asm in AppDomain.CurrentDomain.GetAssemblies() 188 where pluginDescription.Assemblies.Any(asmPath => Path.GetFullPath(asmPath) == Path.GetFullPath(asm.Location)) 189 from t in GetTypes(type, asm) 190 select t; 174 191 } 175 192 -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure.Manager/Loader.cs
r2489 r2495 195 195 string pluginFileName = (string)attributeData.ConstructorArguments[0].Value; 196 196 PluginFileType fileType = (PluginFileType)attributeData.ConstructorArguments[1].Value; 197 pluginFiles.Add(P luginDir + "/" + pluginFileName);197 pluginFiles.Add(Path.Combine(PluginDir, pluginFileName)); 198 198 if (fileType == PluginFileType.Assembly) { 199 pluginAssemblies.Add(P luginDir + "/" + pluginFileName);199 pluginAssemblies.Add(Path.Combine(PluginDir, pluginFileName)); 200 200 } 201 201 } -
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/ApplicationManager.cs
r2488 r2495 38 38 39 39 public static void RegisterApplicationManager(IApplicationManager manager) { 40 if (appManager != null) throw new InvalidOperationException(" An controlmanager has already been set.");40 if (appManager != null) throw new InvalidOperationException("The application manager has already been set."); 41 41 appManager = manager; 42 42 } -
branches/PluginInfrastructure Refactoring/HeuristicLab/MainForm.cs
r2488 r2495 31 31 using System.Threading; 32 32 using HeuristicLab.PluginInfrastructure.Manager; 33 using System.IO; 33 34 34 35 namespace HeuristicLab { … … 44 45 45 46 abortRequested = false; 46 pluginManager = new PluginManager(HeuristicLab.PluginInfrastructure.Properties.Settings.Default.PluginDir); 47 string pluginPath = Path.GetFullPath(HeuristicLab.PluginInfrastructure.Properties.Settings.Default.PluginDir); 48 pluginManager = new PluginManager(pluginPath); 47 49 SplashScreen splashScreen = new SplashScreen(pluginManager, 1000, "Loading HeuristicLab..."); 48 50 splashScreen.Owner = this;
Note: See TracChangeset
for help on using the changeset viewer.