Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization/HeuristicLab.MetaOptimization.Test/PluginLoader.cs @ 5740

Last change on this file since 5740 was 5110, checked in by cneumuel, 14 years ago

#1215

  • optional parameter values now can be null
  • problem type can now be set specifically
  • values are constrained to the encoding of the Problem
  • moved repetitions parameter to MetaOptimizationProblem
File size: 885 bytes
Line 
1
2using System;
3using System.Collections.Generic;
4using System.IO;
5using System.Linq;
6using System.Reflection;
7using HeuristicLab.PluginInfrastructure;
8
9namespace HeuristicLab.MetaOptimization.Test {
10  internal static class PluginLoader {
11    public const string AssemblyExtension = ".dll";
12    public static List<Assembly> pluginAssemblies;
13
14    static PluginLoader() {
15      foreach (string path in Directory.GetFiles(Environment.CurrentDirectory)
16        .Where(s => s.EndsWith(AssemblyExtension)))
17        Assembly.LoadFrom(path);
18
19      pluginAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(IsPluginAssembly).ToList();
20    }
21
22    private static bool IsPluginAssembly(Assembly assembly) {
23      return assembly.GetExportedTypes()
24        .Where(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsAbstract && !t.IsInterface).Any();
25    }
26  }
27}
Note: See TracBrowser for help on using the repository browser.