5using System.Collections.Generic;
8using System.Reflection;
10using System.Threading.Tasks;
17 public static Dictionary<string, IPlugin>
Plugins =
new Dictionary<string, IPlugin>();
28 void Paint(
object o, PaintEventArgs e);
29 void Render(
object o, PaintEventArgs e);
30 void MouseMove(
object o, PointD e, MouseEventArgs buts);
31 void MouseUp(
object o, PointD e, MouseEventArgs buts);
32 void MouseDown(
object o, PointD e, MouseEventArgs buts);
40 Directory.CreateDirectory(
"Plugins");
41 foreach (
string s
in Directory.GetFiles(
"Plugins"))
43 if (!s.EndsWith(
".dll") ||
Plugin.
Plugins.ContainsKey(Path.GetFileName(s)))
46 Assembly pluginAssembly = Assembly.LoadFile(Environment.CurrentDirectory +
"/" + s);
48 var pluginType = pluginAssembly.GetTypes().FirstOrDefault(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsInterface);
49 if (pluginType !=
null)
52 IPlugin pluginInstance = Activator.CreateInstance(pluginType) as IPlugin;
54 if (pluginInstance.ContextMenu)
61 Console.WriteLine(
"No plugin found in the assembly: " + s);
83 p.KeyPressEvent(o, e);
90 p.ScrollEvent(o, args);
93 public static void Paint(
object o, PaintEventArgs e)
100 public static void Render(
object o, PaintEventArgs e)
107 public static void MouseMove(
object o, PointD e, MouseEventArgs buts)
111 p.MouseMove(o, e, buts);
114 public static void MouseUp(
object o, PointD e, MouseEventArgs buts)
118 p.MouseUp(o, e, buts);
121 public static void MouseDown(
object o, PointD e, MouseEventArgs buts)
125 p.MouseDown(o, e, buts);
static void AddMenu(string menu)
static void AddContextMenu(string menu)
static Dictionary< string, IPlugin > Plugins
static void Render(object o, PaintEventArgs e)
static void MouseMove(object o, PointD e, MouseEventArgs buts)
static void MouseDown(object o, PointD e, MouseEventArgs buts)
static void Paint(object o, PaintEventArgs e)
static void KeyPressEvent(object o, KeyPressEventArgs e)
static void KeyDownEvent(object o, KeyEventArgs e)
static void KeyUpEvent(object o, KeyEventArgs e)
static void MouseUp(object o, PointD e, MouseEventArgs buts)
static void ScrollEvent(object o, MouseEventArgs args)
void ScrollEvent(object o, MouseEventArgs args)
void MouseUp(object o, PointD e, MouseEventArgs buts)
void KeyPressEvent(object o, KeyPressEventArgs e)
void MouseMove(object o, PointD e, MouseEventArgs buts)
void KeyUpEvent(object o, KeyEventArgs e)
void KeyDownEvent(object o, KeyEventArgs e)
void Render(object o, PaintEventArgs e)
void Paint(object o, PaintEventArgs e)
void MouseDown(object o, PointD e, MouseEventArgs buts)
void Execute(string[] args)