Last change
on this file since 16859 was
16859,
checked in by dpiringe, 5 years ago
|
#2924:
- migrated PluginInfrastructure to .NET Standard
- created a new .NET Core project HeuristicLab.PluginInfrastructure.Runner, which contains the logic to load and isolate assemblies, based on the new interfaces from HeuristicLab.PluginInfrastructure
- recycled old plugin validation code
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.IO;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.PluginInfrastructure.Runner {
|
---|
5 | class Program
|
---|
6 | {
|
---|
7 | static void Main(string[] args)
|
---|
8 | {
|
---|
9 | string basePath = Directory.GetCurrentDirectory();
|
---|
10 | string[] activatorArgs = null;
|
---|
11 |
|
---|
12 | for(int i = 0; i < args.Length; ++i) {
|
---|
13 | switch(args[i]) {
|
---|
14 | case "--basePath":
|
---|
15 | basePath = args[++i];
|
---|
16 | break;
|
---|
17 | case "--":
|
---|
18 | activatorArgs = new string[args.Length - i - 1];
|
---|
19 | for(int j = 0; j < activatorArgs.Length; ++j) {
|
---|
20 | activatorArgs[j] = args[(i+1) + j];
|
---|
21 | }
|
---|
22 | break;
|
---|
23 | }
|
---|
24 | }
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | IPluginLoader loader = PluginLoaderFactory.Create(basePath);
|
---|
29 |
|
---|
30 | Console.WriteLine($"{typeof(Program).FullName} --> basePath: {basePath}, activatorArgs: {activatorArgs.Length}, plugins: {loader.Plugins.Count}, activators: {loader.Activators.Count}");
|
---|
31 |
|
---|
32 | foreach (IActivator activator in loader.Activators)
|
---|
33 | activator.Activate(new ActivatorContext(loader), activatorArgs);
|
---|
34 | }
|
---|
35 | }
|
---|
36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.