- Timestamp:
- 1/4/2011 6:29:53 AM (2 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/pluginsRewrite/Eraser.Plugins/PluginInfo.cs
r2292 r2293 29 29 using System.Security.Cryptography; 30 30 using System.Security.Cryptography.X509Certificates; 31 using System.IO; 31 32 32 33 using Eraser.Util; … … 38 39 /// Structure holding the instance values of the plugin like handle and path. 39 40 /// </summary> 40 public class PluginIn stance41 public class PluginInfo 41 42 { 42 43 /// <summary> … … 46 47 /// <param name="path">The path to the ass</param> 47 48 /// <param name="plugin"></param> 48 internal PluginIn stance(Assembly assembly, IPlugin plugin)49 internal PluginInfo(Assembly assembly, IPlugin plugin) 49 50 { 50 51 Assembly = assembly; … … 61 62 62 63 /// <summary> 64 /// Executes the plugin's initialisation routine. 65 /// </summary> 66 /// <param name="host">The host for the plugin</param> 67 internal void Load(Host host) 68 { 69 Assembly = Assembly.Load(Assembly.GetName()); 70 71 try 72 { 73 //Iterate over every exported type, checking for the IPlugin implementation 74 Type typePlugin = Assembly.GetExportedTypes().First( 75 type => type.GetInterface("Eraser.Manager.Plugin.IPlugin", true) != null); 76 if (typePlugin == null) 77 throw new FileLoadException(S._("Could not load the plugin."), 78 Assembly.Location); 79 80 //Initialize the plugin 81 Plugin = (IPlugin)Activator.CreateInstance(Assembly.GetType(typePlugin.ToString())); 82 Plugin.Initialize(host); 83 } 84 catch (System.Security.SecurityException e) 85 { 86 throw new FileLoadException(S._("Could not load the plugin."), 87 Assembly.Location, e); 88 } 89 } 90 91 /// <summary> 63 92 /// Gets the Assembly this plugin instance came from. 64 93 /// </summary> … … 69 98 return assembly; 70 99 } 71 internalset100 private set 72 101 { 73 102 assembly = value; … … 106 135 /// therefore cannot be disabled.) 107 136 /// </summary> 108 public LoadingPolicy LoadingPolicy { get; internalset; }137 public LoadingPolicy LoadingPolicy { get; private set; } 109 138 110 139 /// <summary> … … 112 141 /// if the plugin was not loaded. 113 142 /// </summary> 114 public IPlugin Plugin { get; internalset; }143 public IPlugin Plugin { get; private set; } 115 144 116 145 /// <summary>
Note: See TracChangeset
for help on using the changeset viewer.
