4using System.Collections.Generic;
7using System.Reflection;
9using System.Threading.Tasks;
16 public static Dictionary<string, IPlugin>
Plugins =
new Dictionary<string, IPlugin>();
27 void Paint(
object o, PaintEventArgs e);
28 void Render(
object o, PaintEventArgs e);
39 Directory.CreateDirectory(
"Plugins");
40 foreach (
string s
in Directory.GetFiles(
"Plugins"))
42 if (!s.EndsWith(
".dll") ||
Plugin.
Plugins.ContainsKey(Path.GetFileName(s)))
45 Assembly pluginAssembly = Assembly.LoadFile(Environment.CurrentDirectory +
"/" + s);
47 var pluginType = pluginAssembly.GetTypes().FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsInterface);
48 if (pluginType !=
null)
51 IPlugin pluginInstance = Activator.CreateInstance(pluginType) as IPlugin;
53 if (pluginInstance.ContextMenu)
60 Console.WriteLine(
"No plugin found in the assembly: " + s);
82 p.KeyPressEvent(o, e);
89 p.ScrollEvent(o, args);
92 public static void Paint(
object o, PaintEventArgs e)
99 public static void Render(
object o, PaintEventArgs e)
110 p.MouseMove(o, e, buts);
117 p.MouseUp(o, e, buts);
124 p.MouseDown(o, e, buts);
static void AddMenu(string menu, Function f)
static void AddContextMenu(string menu, Function f)
static Dictionary< string, IPlugin > Plugins
static void KeyDownEvent(object o, KeyEventArgs e)
static void ScrollEvent(object o, MouseEventArgs args)
static void Paint(object o, PaintEventArgs e)
static void MouseDown(object o, PointD e, MouseEventArgs buts)
static void MouseMove(object o, PointD e, MouseEventArgs buts)
static void KeyUpEvent(object o, KeyEventArgs e)
static void KeyPressEvent(object o, KeyPressEventArgs e)
static void MouseUp(object o, PointD e, MouseEventArgs buts)
static void Render(object o, PaintEventArgs e)
void Execute(string[] args)
void MouseMove(object o, PointD e, MouseEventArgs buts)
void KeyPressEvent(object o, KeyPressEventArgs e)
void Paint(object o, PaintEventArgs e)
void MouseUp(object o, PointD e, MouseEventArgs buts)
void MouseDown(object o, PointD e, MouseEventArgs buts)
void ScrollEvent(object o, MouseEventArgs args)
void KeyDownEvent(object o, KeyEventArgs e)
void KeyUpEvent(object o, KeyEventArgs e)
void Render(object o, PaintEventArgs e)