Changeset 2517 for branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/DefaultApplicationManager.cs
- Timestamp:
- 11/20/09 16:35:13 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PluginInfrastructure Refactoring/HeuristicLab.PluginInfrastructure/Manager/DefaultApplicationManager.cs
r2504 r2517 80 80 private void LoadPlugins(IEnumerable<PluginDescription> plugins) { 81 81 // load all loadable plugins (all dependencies available) into the execution context 82 foreach (var desc in PluginDescriptionIterator.Iterate InDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) {82 foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) { 83 83 foreach (string assembly in desc.Assemblies) { 84 84 var asm = Assembly.LoadFrom(assembly); … … 105 105 plugin.OnUnload(); 106 106 } 107 foreach (var desc in PluginDescriptionIterator.Iterate InDependencyOrder(plugins.Where(x => x.PluginState != PluginState.Disabled))) {107 foreach (var desc in PluginDescriptionIterator.IterateDependenciesBottomUp(plugins.Where(x => x.PluginState != PluginState.Disabled))) { 108 108 desc.Unload(); 109 109 OnPluginUnloaded(new PluginInfrastructureEventArgs("Plugin unloaded", desc)); … … 134 134 /// <typeparam name="T">Most general type.</typeparam> 135 135 /// <returns>Enumerable of the created instances.</returns> 136 public IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class {136 public static IEnumerable<T> GetInstances<T>(IPluginDescription plugin) where T : class { 137 137 return from t in GetTypes(typeof(T), plugin) 138 138 where !t.IsAbstract && !t.IsInterface && !t.HasElementType … … 155 155 /// <typeparam name="T">Most general type.</typeparam> 156 156 /// <returns>Enumerable of the created instances.</returns> 157 public IEnumerable<T> GetInstances<T>() where T : class {157 public static IEnumerable<T> GetInstances<T>() where T : class { 158 158 return from i in GetInstances(typeof(T)) 159 159 select (T)i; … … 165 165 /// <typeparam name="type">Most general type.</typeparam> 166 166 /// <returns>Enumerable of the created instances.</returns> 167 public IEnumerable<object> GetInstances(Type type) {167 public static IEnumerable<object> GetInstances(Type type) { 168 168 return from t in GetTypes(type) 169 169 where !t.IsAbstract && !t.IsInterface && !t.HasElementType … … 176 176 /// <param name="type">Most general type for which to find matching types.</param> 177 177 /// <returns>Enumerable of the discovered types.</returns> 178 public IEnumerable<Type> GetTypes(Type type) {178 public static IEnumerable<Type> GetTypes(Type type) { 179 179 return from asm in AppDomain.CurrentDomain.GetAssemblies() 180 180 from t in GetTypes(type, asm) … … 189 189 /// <param name="plugin">The plugin the subtypes must be part of.</param> 190 190 /// <returns>Enumerable of the discovered types.</returns> 191 public IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) {191 public static IEnumerable<Type> GetTypes(Type type, IPluginDescription pluginDescription) { 192 192 PluginDescription pluginDesc = (PluginDescription)pluginDescription; 193 193 return from asm in AppDomain.CurrentDomain.GetAssemblies() … … 225 225 return null; 226 226 } 227 228 #region IApplicationManager Members 229 230 231 IEnumerable<T> IApplicationManager.GetInstances<T>(IPluginDescription plugin) { 232 return GetInstances<T>(plugin); 233 } 234 235 IEnumerable<T> IApplicationManager.GetInstances<T>() { 236 return GetInstances<T>(); 237 } 238 239 IEnumerable<Type> IApplicationManager.GetTypes(Type type) { 240 return GetTypes(type); 241 } 242 243 IEnumerable<Type> IApplicationManager.GetTypes(Type type, IPluginDescription plugin) { 244 return GetTypes(type, plugin); 245 } 246 247 #endregion 227 248 } 228 249 }
Note: See TracChangeset
for help on using the changeset viewer.