Changeset 413
- Timestamp:
- 9/27/2008 9:02:36 AM (5 years ago)
- File:
-
- 1 edited
-
branches/eraser6/Manager/Plugins.cs (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Manager/Plugins.cs
r384 r413 107 107 public DefaultHost() 108 108 { 109 AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(AssemblyResolve); 109 110 foreach (string fileName in Directory.GetFiles(PLUGINSFOLDER)) 110 111 { … … 149 150 if (typeInterface != null) 150 151 { 152 //Create the PluginInstance structure 153 PluginInstance instance = new PluginInstance(assembly, filePath, null); 154 155 //Add the plugin to the list of loaded plugins 156 lock (plugins) 157 plugins.Add(instance); 158 151 159 //Initialize the plugin 152 160 IPlugin pluginInterface = (IPlugin)Activator.CreateInstance( 153 161 assembly.GetType(type.ToString())); 154 162 pluginInterface.Initialize(this); 155 156 //Create the PluginInstance structure 157 PluginInstance instance = new PluginInstance(assembly, filePath, pluginInterface); 158 159 //Add the plugin to the list of loaded plugins 160 lock (plugins) 161 plugins.Add(instance); 163 instance.Plugin = pluginInterface; 164 165 //And broadcast the plugin load event 162 166 OnPluginLoad(instance); 163 167 } … … 165 169 } 166 170 171 Assembly AssemblyResolve(object sender, ResolveEventArgs args) 172 { 173 lock (plugins) 174 foreach (PluginInstance instance in plugins) 175 if (instance.Assembly.FullName == args.Name) 176 return instance.Assembly; 177 return null; 178 } 179 167 180 public override void RegisterErasureMethod(ErasureMethod method) 168 181 { … … 181 194 /// Structure holding the instance values of the plugin like handle and path. 182 195 /// </summary> 183 public structPluginInstance196 public class PluginInstance 184 197 { 185 198 internal PluginInstance(Assembly assembly, string path, IPlugin plugin)
Note: See TracChangeset
for help on using the changeset viewer.
