private void AddPluginsFromDirectory(List<string> pluginsToIgnore, AggregateCatalog returnValue, string plugin)
{
try
{
bool shouldProcessPlugin = true;
// GlueView is a special case, so we should skip that
string pluginToLower = plugin.ToLower().Replace("\\", "/");
if (pluginToLower.EndsWith("/glueview") || pluginToLower.EndsWith("/glueview/"))
{
shouldProcessPlugin = false;
}
if (shouldProcessPlugin)
{
var compileResult = CompilePlugin(plugin);
// We had a && false here, so I don't think we use this ignored check, do we?
bool isIgnored = pluginsToIgnore != null && pluginsToIgnore.Any(item =>
FileManager.Standardize(item.ToLowerInvariant()) == FileManager.Standardize(plugin.ToLowerInvariant()));
if (!isIgnored)
{
bool wasCompiledFromCSharpCode = compileResult != null;
if (wasCompiledFromCSharpCode)
{
HandleAddingDynamicallyCompiledPlugin(returnValue, plugin, compileResult);
}
// If nothing was compiled check for any dlls to load
else
{
HandleAddingPreCompiledPluginInDirectory(returnValue, plugin);
}
}
}
}
catch (Exception ex)
{
CompileErrors.Add("Error loading plugin at " + plugin + "\r\n\r\n" + ex);
}
}