public void Load(List<string> pluginNames)
{
if (pluginNames.Count == 0) {
return;
}
string path;
path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
path = Path.Combine(path, "plugins");
path = Regex.Replace(path,@"^file\:(/|\\){1,2}", "");
Console.WriteLine(path);
if (!Directory.Exists(path)) {
Console.Error.WriteLine("No plugins folder found, no plugins will be loaded!");
return;
}
string[] files = Directory.GetFiles(path);
foreach (string file in files) {
if (file.ToLower().EndsWith(".dll")) {
LoadPluginTypes(pluginNames, file);
}
}
//Check for missing plugins...
foreach (string name in pluginNames) {
bool found = false;
foreach (ICompilerPlugin plugin in _loadedPlugins) {
if (plugin.Identifier == name) {
found = true;
}
}
if (!found) {
Console.Error.WriteLine("Failed to load plugin '{0}', it is not in any dll's in the plugins folder.", name);
}
}
}