LIBOMV-509 Loading saved filters will prompt to apply to current session list LIBOMV-519 Adds initial support for loading GridProxy plugins (not well tested yet) git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2705 52acb1d6-8a22-11de-b505-999d5b087335
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using GridProxy;
|
|
using System.Reflection;
|
|
using System.IO;
|
|
|
|
namespace WinGridProxy
|
|
{
|
|
public partial class FormPluginManager : Form
|
|
{
|
|
private ProxyFrame _Frame;
|
|
public FormPluginManager(ProxyFrame frame)
|
|
{
|
|
InitializeComponent();
|
|
_Frame = frame;
|
|
}
|
|
|
|
private void buttonLoadPlugin_Click(object sender, EventArgs e)
|
|
{
|
|
if(openFileDialog1.ShowDialog() == DialogResult.OK)
|
|
{
|
|
LoadPlugin(openFileDialog1.FileName);
|
|
}
|
|
}
|
|
public void LoadPlugin(string name)
|
|
{
|
|
|
|
Assembly assembly = Assembly.LoadFile(Path.GetFullPath(name));
|
|
foreach (Type t in assembly.GetTypes())
|
|
{
|
|
try
|
|
{
|
|
if (t.IsSubclassOf(typeof(ProxyPlugin)))
|
|
{
|
|
ConstructorInfo info = t.GetConstructor(new Type[] { typeof(ProxyFrame) });
|
|
ProxyPlugin plugin = (ProxyPlugin)info.Invoke(new object[] { _Frame });
|
|
plugin.Init();
|
|
listView1.Items.Add(new ListViewItem(new []{assembly.ManifestModule.Name, Path.GetFullPath(name)}));
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
Console.WriteLine(e.ToString());
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void buttonClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
}
|
|
}
|