2 using System.Reflection;
3 using System.Collections.Generic;
6 namespace bytex64.WebThing {
7 public class PluginManager {
8 public Dictionary<string,WebThingPlugin> Plugins;
12 public PluginManager(WebThing wt) {
13 Plugins = new Dictionary<string,WebThingPlugin>();
18 foreach (string plugin in Config.Plugins) {
23 public void LoadPlugin(string assemblyname) {
24 Assembly a = Assembly.LoadFile(Environment.GetEnvironmentVariable("WEBTHING_HOME") + "/plugins/" + assemblyname + ".dll");
25 Type[] types = a.GetTypes();
26 foreach (Type t in types) {
27 if (t.IsSubclassOf(typeof(WebThingPlugin))) {
28 WebThingPlugin p = (WebThingPlugin) a.CreateInstance(t.FullName, false, BindingFlags.ExactBinding, null, null, null, null);
30 Plugins[t.FullName] = p;
31 Console.WriteLine("Successfully loaded {0}", t.FullName);
36 public void WebViewSetup(WebView view) {
37 foreach (string key in Plugins.Keys) {
38 Plugins[key].InitWebView(view);