4 using System.Collections.Generic;
7 using System.Reflection;
9 using System.Threading.Tasks;
10 using SiliconStudio.Core.Diagnostics;
12 namespace SiliconStudio.BuildEngine
18 private readonly List<string> pluginAssemblyLocations =
new List<string>();
20 private readonly
Logger logger;
29 AppDomain.CurrentDomain.AssemblyResolve += (sender, e) => LoadAssembly(
new AssemblyName(e.Name));
34 return LoadAssembly(assemblyName.Name);
39 foreach (
string pluginLocation
in pluginAssemblyLocations)
41 if (pluginLocation != assemblyName)
43 string fileName = Path.GetFileNameWithoutExtension(pluginLocation);
44 if (fileName != assemblyName)
49 logger.Debug(
"Loading plugin: {0}", pluginLocation);
50 return Assembly.LoadFrom(pluginLocation);
57 foreach (
string pluginLocation
in pluginAssemblyLocations)
59 if (pluginLocation != assemblyFileName)
61 string fileName = Path.GetFileName(pluginLocation);
62 if (fileName != assemblyFileName)
67 logger.Debug(
"Loading plugin: {0}", pluginLocation);
68 return pluginLocation;
75 pluginAssemblyLocations.Add(filePath);
80 if (!Directory.Exists(folder))
83 foreach (
string filePath
in Directory.EnumerateFiles(folder,
"*.dll"))
86 logger.Debug(
"Detected plugin: {0}", Path.GetFileNameWithoutExtension(filePath));
87 pluginAssemblyLocations.Add(filePath);
void AddPlugin(string filePath)
Assembly LoadAssembly(AssemblyName assemblyName)
Base implementation for ILogger.
string FindAssembly(string assemblyFileName)
void AddPluginFolder(string folder)
PluginResolver(Logger logger=null)
Assembly LoadAssembly(string assemblyName)