Ignore:
Timestamp:
01/04/11 06:29:53 (3 years ago)
Author:
lowjoel
Message:

Rename the PluginInstance? class to be the PluginInfo? class.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/eraser6/pluginsRewrite/Eraser.Plugins/PluginInfo.cs

    r2292 r2293  
    2929using System.Security.Cryptography; 
    3030using System.Security.Cryptography.X509Certificates; 
     31using System.IO; 
    3132 
    3233using Eraser.Util; 
     
    3839    /// Structure holding the instance values of the plugin like handle and path. 
    3940    /// </summary> 
    40     public class PluginInstance 
     41    public class PluginInfo 
    4142    { 
    4243        /// <summary> 
     
    4647        /// <param name="path">The path to the ass</param> 
    4748        /// <param name="plugin"></param> 
    48         internal PluginInstance(Assembly assembly, IPlugin plugin) 
     49        internal PluginInfo(Assembly assembly, IPlugin plugin) 
    4950        { 
    5051            Assembly = assembly; 
     
    6162 
    6263        /// <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> 
    6392        /// Gets the Assembly this plugin instance came from. 
    6493        /// </summary> 
     
    6998                return assembly; 
    7099            } 
    71             internal set 
     100            private set 
    72101            { 
    73102                assembly = value; 
     
    106135        /// therefore cannot be disabled.) 
    107136        /// </summary> 
    108         public LoadingPolicy LoadingPolicy { get; internal set; } 
     137        public LoadingPolicy LoadingPolicy { get; private set; } 
    109138 
    110139        /// <summary> 
     
    112141        /// if the plugin was not loaded. 
    113142        /// </summary> 
    114         public IPlugin Plugin { get; internal set; } 
     143        public IPlugin Plugin { get; private set; } 
    115144 
    116145        /// <summary> 
Note: See TracChangeset for help on using the changeset viewer.