Changeset 7669 for branches/HeuristicLab.Hive.Azure/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs
- Timestamp:
- 03/28/12 15:47:26 (12 years ago)
- Location:
- branches/HeuristicLab.Hive.Azure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Hive.Azure
- Property svn:ignore
-
old new 3 3 *.resharper 4 4 *.suo 5 *.user 5 6 *.vsp 6 7 Doxygen 8 FxCopResults.txt 7 9 Google.ProtocolBuffers-0.9.1.dll 8 10 HeuristicLab 3.3.5.1.ReSharper.user
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HeuristicLab.Hive.Azure/HeuristicLab.PluginInfrastructure/3.3/SandboxApplicationManager.cs
r7270 r7669 235 235 PluginDescription pluginDesc = (PluginDescription)pluginDescription; 236 236 return from asm in AppDomain.CurrentDomain.GetAssemblies() 237 where ! IsDynamicAssembly(asm)237 where !asm.IsDynamic && !string.IsNullOrEmpty(asm.Location) 238 238 where pluginDesc.AssemblyLocations.Any(location => location.Equals(Path.GetFullPath(asm.Location), StringComparison.CurrentCultureIgnoreCase)) 239 239 from t in GetTypes(type, asm, onlyInstantiable, includeGenericTypeDefinitions) … … 249 249 } 250 250 return result; 251 }252 253 private static bool IsDynamicAssembly(Assembly asm) {254 return (asm is System.Reflection.Emit.AssemblyBuilder) || string.IsNullOrEmpty(asm.Location);255 251 } 256 252 … … 266 262 private static IEnumerable<Type> GetTypes(Type type, Assembly assembly, bool onlyInstantiable, bool includeGenericTypeDefinitions) { 267 263 var buildTypes = from t in assembly.GetTypes() 264 where CheckTypeCompatibility(type, t) 268 265 where !IsNonDiscoverableType(t) 269 where CheckTypeCompatibility(type, t)270 266 where onlyInstantiable == false || 271 267 (!t.IsAbstract && !t.IsInterface && !t.HasElementType) … … 286 282 return true; 287 283 if (type.IsGenericType && other.IsGenericType) { 284 var otherGenericArguments = other.GetGenericArguments(); 285 var typeGenericArguments = type.GetGenericArguments(); 286 287 //check type arguments count 288 if (otherGenericArguments.Length != typeGenericArguments.Length) 289 return false; 290 291 //check type arguments & constraints 292 int i = 0; 293 foreach (var genericArgument in typeGenericArguments) { 294 if (otherGenericArguments[i].IsGenericParameter) { 295 foreach (var constraint in otherGenericArguments[i].GetGenericParameterConstraints()) 296 if (!constraint.IsAssignableFrom(genericArgument)) return false; 297 } else if (genericArgument != otherGenericArguments[i]) return false; 298 i++; 299 } 300 //check types 288 301 try { 289 if (type.IsAssignableFrom(other.GetGenericTypeDefinition().MakeGenericType(type.GetGenericArguments()))) 302 var otherGenericTypeDefinition = other.GetGenericTypeDefinition(); 303 if (type.IsAssignableFrom(otherGenericTypeDefinition.MakeGenericType(typeGenericArguments))) 290 304 return true; 291 305 }
Note: See TracChangeset
for help on using the changeset viewer.