Here are the examples of the csharp api System.Collections.Generic.List.Add(iConfigurablePlugin) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
View Source File : Plugins.cs
License : Creative Commons Zero v1.0 Universal
Project Creator : Touhma
License : Creative Commons Zero v1.0 Universal
Project Creator : Touhma
public static void LoadPlugins()
{
Log("Start");
if (!Directory.Exists(Path.Combine(DataDir, "Plugins")))
Directory.CreateDirectory(Path.Combine(DataDir, "Plugins"));
foreach (var filePath in Directory.GetFiles(Path.Combine(DataDir, "Plugins")))
{
Log(filePath);
replacedembly a;
try
{
a = replacedembly.LoadFrom(filePath);
foreach (var type in a.GetTypes())
foreach (var t in type.GetInterfaces())
if (t.Name == "iConfigurablePlugin" && !type.IsAbstract && !type.IsInterface)
{
Warn($"Loading Plugin: {a.GetName().Name}");
var plugin = (iConfigurablePlugin)Activator.CreateInstance(type);
Plugins.Add(plugin);
plugin.Init();
}
}
catch (Exception e)
{
Warn("Failed to load plugin:" + e.Message);
updateMessage += $"Failed to load plugin:{filePath}\r\nIf you have recently upgraded GS2, Please check to see if an updated build of the plugin is available, or downgrade GS2 to continue using it";
}
}
foreach (var g in Generators)
{
Log("GalacticScale2|LoadPlugins|Loading Generator:" + g.Name);
g.Init();
}
Log("End");
}