- Timestamp:
- 01/15/15 20:27:59 (10 years ago)
- Location:
- trunk/sources/HeuristicLab.PluginInfrastructure/3.3
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/Interfaces/IApplicationManager.cs
r11171 r11771 22 22 using System; 23 23 using System.Collections.Generic; 24 using System.Reflection; 24 25 25 26 namespace HeuristicLab.PluginInfrastructure { … … 70 71 71 72 /// <summary> 72 /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are decla ed in any assembly of <paramref name="plugin"/>.73 /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are declared in any assembly of <paramref name="plugin"/>. 73 74 /// </summary> 74 75 /// <param name="type">The type to discover.</param> … … 79 80 80 81 /// <summary> 81 /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are decla ed in any assembly of <paramref name="plugin"/>.82 /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declared in any assembly of <paramref name="plugin"/>. 82 83 /// </summary> 83 84 /// <param name="types">The types to discover.</param> … … 87 88 /// <returns>An enumerable of discovered types.</returns> 88 89 IEnumerable<Type> GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true); 90 91 92 /// <summary> 93 /// Discovers all types implementing or inheriting <paramref name="type"/> (directly and indirectly) that are declared in the<paramref name="assembly"/>. 94 /// </summary> 95 /// <param name="type">The type to discover.</param> 96 /// <param name="assembly">The declaring assembly.</param> 97 /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param> 98 /// <returns>An enumerable of discovered types.</returns> 99 IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false); 100 101 /// <summary> 102 /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declaed in any assembly of <paramref name="plugin"/>. 103 /// </summary> 104 /// <param name="types">The types to discover.</param> 105 /// <param name="assembly">The declaring assembly.</param> 106 /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param> 107 /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param> 108 /// <returns>An enumerable of discovered types.</returns> 109 IEnumerable<Type> GetTypes(IEnumerable<Type> types, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true); 89 110 90 111 /// <summary> -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/LightweightApplicationManager.cs
r11171 r11771 122 122 /// (interfaces, abstract classes... are not returned)</param> 123 123 /// <returns>Enumerable of the discovered types.</returns> 124 p rivate static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false) {124 public IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false) { 125 125 try { 126 126 // necessary to make sure the exception is immediately thrown … … 148 148 149 149 /// <summary> 150 /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declaed in any assembly of <paramref name="plugin"/>. 151 /// </summary> 152 /// <param name="types">The types to discover.</param> 153 /// <param name="assembly">The declaring assembly.</param> 154 /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param> 155 /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param> 156 /// <returns>An enumerable of discovered types.</returns> 157 public IEnumerable<Type> GetTypes(IEnumerable<Type> types, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true) { 158 IEnumerable<Type> result = GetTypes(types.First(), assembly, onlyInstantiable, includeGenericTypeDefinitions); 159 foreach (Type type in types.Skip(1)) { 160 IEnumerable<Type> discoveredTypes = GetTypes(type, assembly, onlyInstantiable, includeGenericTypeDefinitions); 161 if (assignableToAllTypes) result = result.Intersect(discoveredTypes); 162 else result = result.Union(discoveredTypes); 163 } 164 return result; 165 } 166 167 /// <summary> 150 168 /// Not supported by the LightweightApplicationManager 151 169 /// </summary> -
trunk/sources/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs
r11171 r11771 260 260 /// <param name="includeGenericTypeDefinitions">Specifies if generic type definitions shall be included</param> 261 261 /// <returns>Enumerable of the discovered types.</returns> 262 privatestatic IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) {262 internal static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) { 263 263 var matchingTypes = from assemblyType in assembly.GetTypes() 264 264 let t = assemblyType.BuildType(type) … … 273 273 } 274 274 275 /// <summary> 276 /// Discovers all types implementing or inheriting all or any type in <paramref name="types"/> (directly and indirectly) that are declaed in any assembly of <paramref name="plugin"/>. 277 /// </summary> 278 /// <param name="types">The types to discover.</param> 279 /// <param name="assembly">The declaring assembly.</param> 280 /// <param name="onlyInstantiable">Return only types that are instantiable (instance, abstract... are not returned)</param> 281 /// /// <param name="assignableToAllTypes">Specifies if discovered types must implement or inherit all given <paramref name="types"/>.</param> 282 /// <returns>An enumerable of discovered types.</returns> 283 internal static IEnumerable<Type> GetTypes(IEnumerable<Type> types, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true) { 284 IEnumerable<Type> result = GetTypes(types.First(), assembly, onlyInstantiable, includeGenericTypeDefinitions); 285 foreach (Type type in types.Skip(1)) { 286 IEnumerable<Type> discoveredTypes = GetTypes(type, assembly, onlyInstantiable, includeGenericTypeDefinitions); 287 if (assignableToAllTypes) result = result.Intersect(discoveredTypes); 288 else result = result.Union(discoveredTypes); 289 } 290 return result; 291 } 292 275 293 private void OnPluginLoaded(PluginInfrastructureEventArgs e) { 276 294 if (PluginLoaded != null) PluginLoaded(this, e); … … 303 321 IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, IPluginDescription plugin, bool onlyInstantiable, bool includeGenericTypeDefinitions, bool assignableToAllTypes) { 304 322 return GetTypes(types, plugin, onlyInstantiable, includeGenericTypeDefinitions, assignableToAllTypes); 323 } 324 325 IEnumerable<Type> IApplicationManager.GetTypes(Type type, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false) { 326 return GetTypes(type, assembly, onlyInstantiable, includeGenericTypeDefinitions); 327 } 328 IEnumerable<Type> IApplicationManager.GetTypes(IEnumerable<Type> types, Assembly assembly, bool onlyInstantiable = true, bool includeGenericTypeDefinitions = false, bool assignableToAllTypes = true) { 329 return GetTypes(types, assembly, onlyInstantiable, includeGenericTypeDefinitions); 305 330 } 306 331
Note: See TracChangeset
for help on using the changeset viewer.