Changeset 8958 for branches/OaaS/HeuristicLab.PluginInfrastructure
- Timestamp:
- 11/28/12 10:02:01 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.PluginInfrastructure/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/Manager/PluginValidator.cs
r8200 r8958 488 488 } 489 489 490 private string AssemblyDirectory(Assembly assem) { 491 string codeBase = assem.CodeBase; 492 UriBuilder uri = new UriBuilder(codeBase); 493 string path = Uri.UnescapeDataString(uri.Path); 494 return Path.GetFullPath(path); 495 } 496 490 497 491 498 private bool IsAnyDependencyDisabled(PluginDescription descr, List<PluginDescription> disabledPlugins) { … … 512 519 try { 513 520 string assemblyName = (from assembly in AppDomain.CurrentDomain.ReflectionOnlyGetAssemblies() 514 where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase) 521 where string.Equals(Path.GetFullPath(assembly.Location), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase) || 522 string.Equals(AssemblyDirectory(assembly), Path.GetFullPath(assemblyLocation), StringComparison.CurrentCultureIgnoreCase) 515 523 select assembly.FullName).Single(); 516 524 // now load the assemblies into the execution context -
branches/OaaS/HeuristicLab.PluginInfrastructure/3.3/WebApplicationManager.cs
r8506 r8958 88 88 } 89 89 90 static private string AssemblyDirectory { 91 get { 92 string codeBase = Assembly.GetExecutingAssembly().CodeBase; 93 UriBuilder uri = new UriBuilder(codeBase); 94 string path = Uri.UnescapeDataString(uri.Path); 95 return Path.GetDirectoryName(path); 96 } 97 } 90 98 // find all types implementing IPlugin in the reflectionOnlyAssemblies and create a list of plugin descriptions 91 99 // the dependencies in the plugin descriptions are not yet set correctly because we need to create … … 93 101 private List<PluginDescription> GatherPluginDescriptions() 94 102 { 95 List<PluginDescription> pluginDescriptions = new List<PluginDescription>(); 96 foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) 103 /*List<PluginDescription> pluginDescriptions = new List<PluginDescription>(); 104 105 // load all assemblies that are available in the project folders 106 var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies().ToList(); 107 IList<string> loadedPaths = new List<string>(); 108 foreach (var asm in loadedAssemblies) { 109 try { 110 loadedPaths.Add(asm.Location); 111 } 112 catch (Exception ex) { 113 } 114 }*/ 115 /*var assembliePaths = from location in loadedAssemblies 116 select location.Location; 117 118 var loadedPaths = loadedAssemblies.Select(a => a.Location).ToArray();*/ 119 var pv = new PluginValidator() { PluginDir = AssemblyDirectory }; 120 pv.DiscoverAndCheckPlugins(); 121 return pv.Plugins.ToList(); 122 /*var pluginManager = new PluginManager(AssemblyDirectory); 123 pluginManager.DiscoverAndCheckPlugins(); 124 return pluginManager.Plugins.ToList();*/ 125 126 /*var referencedPaths = Directory.GetFiles(AssemblyDirectory, "*.dll"); 127 var toLoad = referencedPaths.Where(r => !loadedPaths.Contains(r, StringComparer.InvariantCultureIgnoreCase)).ToList(); 128 toLoad.ForEach(path => loadedAssemblies.Add(AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(path)))); 129 130 foreach (Assembly assembly in loadedAssemblies) 97 131 { 98 132 // GetExportedTypes throws FileNotFoundException when a referenced assembly … … 106 140 where !t.IsAbstract && t.GetInterfaces().Any(x => x.AssemblyQualifiedName == typeof(IPlugin).AssemblyQualifiedName) 107 141 select GetPluginDescription(t); 142 143 // TODO: Also load all plugin descriptors from assemblies liying in the app domain folder!!!!! 108 144 pluginDescriptions.AddRange(assemblyPluginDescriptions); 109 145 } … … 122 158 } 123 159 } 124 return pluginDescriptions; 160 return pluginDescriptions;*/ 125 161 } 126 162
Note: See TracChangeset
for help on using the changeset viewer.