2 using System.Collections.Generic;
5 namespace bytex64.WebThing {
6 public abstract class WebThingPlugin {
7 protected Dictionary<string,string> Options;
9 public WebThingPlugin() {
10 string classname = this.GetType().FullName;
12 if (Config.PluginOptions.ContainsKey(classname)) {
13 Options = Config.PluginOptions[classname];
15 Options = new Dictionary<string,string>();
16 Config.PluginOptions[classname] = Options;
20 // Convenience function to easily save plugin configuration
21 protected void SaveConfig() {
22 if (Config.ConfigPathOut == null) return;
24 string plugin_name = this.GetType().FullName;
25 Config.SaveFile(plugin_name, String.Format("{0}/{1}.conf", Config.ConfigPathOut, plugin_name));
29 public virtual void Init(WebThing wt) {}
30 public virtual void Deinit(WebThing wt) {}
33 public virtual void InitWebView(WebView wv) {}
34 public virtual void DeinitWebView(WebView wv) {}
37 // An interface implemented by plugins that handle search queries
38 // (a search query is anything that doesn't look like a URI)
39 public interface ISearchPlugin {
40 // Convert a search query into a URI. If this plugin cannot
41 // handle the search, it should return null.
42 string SearchTransform(string search);