corrade-vassal – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | vero | 1 | using System; |
2 | using System.Windows.Forms; |
||
3 | using GridProxy; |
||
4 | using System.Reflection; |
||
5 | using System.IO; |
||
6 | |||
7 | namespace WinGridProxy |
||
8 | { |
||
9 | public partial class FormPluginManager : Form |
||
10 | { |
||
11 | private ProxyFrame _Frame; |
||
12 | public FormPluginManager(ProxyFrame frame) |
||
13 | { |
||
14 | InitializeComponent(); |
||
15 | _Frame = frame; |
||
16 | } |
||
17 | |||
18 | private void buttonLoadPlugin_Click(object sender, EventArgs e) |
||
19 | { |
||
20 | if(openFileDialog1.ShowDialog() == DialogResult.OK) |
||
21 | { |
||
22 | LoadPlugin(openFileDialog1.FileName); |
||
23 | } |
||
24 | } |
||
25 | public void LoadPlugin(string name) |
||
26 | { |
||
27 | |||
28 | Assembly assembly = Assembly.LoadFile(Path.GetFullPath(name)); |
||
29 | foreach (Type t in assembly.GetTypes()) |
||
30 | { |
||
31 | try |
||
32 | { |
||
33 | if (t.IsSubclassOf(typeof(ProxyPlugin))) |
||
34 | { |
||
35 | ConstructorInfo info = t.GetConstructor(new Type[] { typeof(ProxyFrame) }); |
||
36 | ProxyPlugin plugin = (ProxyPlugin)info.Invoke(new object[] { _Frame }); |
||
37 | plugin.Init(); |
||
38 | listView1.Items.Add(new ListViewItem(new []{assembly.ManifestModule.Name, Path.GetFullPath(name)})); |
||
39 | } |
||
40 | } |
||
41 | catch (Exception e) |
||
42 | { |
||
43 | Console.WriteLine(e.ToString()); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | } |
||
48 | |||
49 | private void buttonClose_Click(object sender, EventArgs e) |
||
50 | { |
||
51 | this.Close(); |
||
52 | } |
||
53 | |||
54 | } |
||
55 | } |