/// <summary> /// The load stf plugins. /// </summary> /// <param name="stfPluginPath"> /// The stf plugin path. /// </param> /// <param name="pluginPatterns"> /// The plugin Patterns. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public int LoadStfPlugins(string stfPluginPath, string pluginPatterns = "*stf.*.dll") { if (!Directory.Exists(stfPluginPath)) { return(0); } PluginLogger.LogHeader("looking for plugins at [{0}]", stfPluginPath); var patterns = pluginPatterns.Split(';'); foreach (var pattern in patterns) { var stfPluginDllFileNames = Directory.GetFiles(stfPluginPath, pattern); var assemblies = new List <Assembly>(stfPluginDllFileNames.Length); foreach (var stfPluginDllFileName in stfPluginDllFileNames) { var stfPluginDllAssemblyName = AssemblyName.GetAssemblyName(stfPluginDllFileName); var assembly = Assembly.Load(stfPluginDllAssemblyName); assemblies.Add(assembly); } foreach (var assembly in assemblies) { if (assembly == null) { continue; } var types = assembly.GetTypes(); foreach (var type in types) { if (type.IsInterface || type.IsAbstract) { continue; } if (type.GetInterface(typeof(IStfPlugin).FullName) != null) { RegisterPlugin(type); PluginAssemblies.Add(assembly); } } } } OverlayPluginSettings(stfPluginPath); PluginLogger.LogInfo("Done looking for plugins"); return(container.Registrations.Count()); }