0:   //  Plugin.cs
1:   //  Copyright (c) 2000 Mike Krueger
2:   //
3:   //  This program is free software; you can redistribute it and/or modify
4:   //  it under the terms of the GNU General Public License as published by
5:   //  the Free Software Foundation; either version 2 of the License, or
6:   //  (at your option) any later version.
7:   //
8:   //  This program is distributed in the hope that it will be useful,
9:   //  but WITHOUT ANY WARRANTY; without even the implied warranty of
10:   //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11:   //  GNU General Public License for more details.
12:   //
13:   //  You should have received a copy of the GNU General Public License
14:   //  along with this program; if not, write to the Free Software
15:   //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16:  
17:   using System;
18:   using System.Xml;
19:   using System.IO;
20:   using System.Collections;
21:   using System.Drawing;
22:   using System.Windows.Forms;
23:   using System.Reflection;
24:   using System.Runtime.Serialization.Formatters.Binary;
25:  
26:   using SharpDevelop.Gui;
27:   using SharpDevelop.Tool.Function;
28:   using SharpDevelop.Actions.Edit;
29:  
30:   namespace SharpDevelop.Internal.Plugin {
31:       
32:       public class Plugin 
33:       {
34:           string assemblyname;
35:           string name;
36:           string author;
37:           string version;
38:           string description "";
39:           string copyright   "";
40:           string url         "";
41:           
42:           Hashtable  editactions null;
43:           MenuItem[] menuitems   null;
44:           
45:           Assembly assembly;
46:           MainWindow window;
47:           
48:           public Hashtable  EditActions {
49:               get {
50:                   return editactions;
51:               }
52:           }
53:           
54:           public MenuItem[] MenuItems {
55:               get {
56:                   return menuitems;
57:               }
58:           }
59:           public string AssemblyName {
60:               get {
61:                   return assemblyname;
62:               }
63:           }
64:           
65:           public string Url {
66:               get {
67:                   return url;
68:               }
69:           }
70:           public string Copyright {
71:               get {
72:                   return copyright;
73:               }
74:           }
75:           
76:           public string Name {
77:               get {
78:                   return name;
79:               }
80:           }
81:           
82:           public string Description {
83:               get {
84:                   return description;
85:               }
86:           }
87:           
88:           public string Author {
89:               get {
90:                   return author;
91:               }
92:           }
93:           
94:           public string Version {
95:               get {
96:                   return version;
97:               }
98:           }
99:           
100:           public Plugin(MainWindow windowstring directoryXmlElement el)
101:           {
102:               this.window window;
103:               
104:               assemblyname el["Plugin"].Attributes["Assembly"].InnerText;
105:               name         el["Plugin"].Attributes["Name"].InnerText;
106:               version      el["Plugin"].Attributes["Version"].InnerText;
107:               
108:               author      el["Plugin"]["Author"].InnerText;
109:               copyright   el["Plugin"]["Copyright"].InnerText;
110:               url         el["Plugin"]["Url"].InnerText;
111:               description el["Plugin"]["Description"].InnerText;
112:               
113:               if (!directory.EndsWith(Path.DirectorySeparatorChar.ToString()))
114:                   directory += Path.DirectorySeparatorChar;
115:               
116:               try {
117:                   assembly Assembly.LoadFrom(directory assemblyname);
118:   //                messagehandler = 
119:               catch (Exception e) {
120:                   throw new Exception("Can't load Assembly error :\n " e.ToString());
121:               }
122:               
123:               if (el["MenuStructure"] != null) {
124:                   try {
125:                       menuitems MenuCreator.CreateMenu(windowassembly""el["MenuStructure"]);
126:                   catch (Exception e) {
127:                       throw new Exception("Can't create Menu error (check the XML) :\n " e.ToString());
128:                   }
129:               }
130:               
131:               if (el["EditorKeys"] != null) {
132:                   try {
133:                       editactions EditActionLoader.GenEditActions(assembly""el["EditorKeys"]);
134:                       foreach (DictionaryEntry entry in editactions) { // insert keys into EditActionLoader 
135:                           EditActionLoader.EditActions[entry.Key] = entry.Value;
136:                       }
137:                   catch (Exception e) {
138:                       throw new Exception("Can't create EditActions error (check the XML) :\n " e.ToString());
139:                   }
140:               }
141:           }
142:           
143:           public override string ToString()
144:           {
145:               return Name " " Version;
146:           }
147:           
148:       }
149:   }

This page was automatically generated by SharpDevelop.