Changeset 2293
- Timestamp:
- 1/4/2011 6:29:53 AM (2 years ago)
- Location:
- branches/eraser6/pluginsRewrite
- Files:
-
- 5 edited
- 1 moved
-
Eraser.Manager/Settings.cs (modified) (1 diff)
-
Eraser.Plugins/Eraser.Plugins.csproj (modified) (1 diff)
-
Eraser.Plugins/PluginInfo.cs (moved) (moved from branches/eraser6/pluginsRewrite/Eraser.Plugins/PluginInstance.cs) (7 diffs)
-
Eraser.Plugins/PluginLoadEventArgs.cs (modified) (2 diffs)
-
Eraser.Plugins/PluginLoadedEventArgs.cs (modified) (2 diffs)
-
Eraser/SettingsPanel.cs (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/pluginsRewrite/Eraser.Manager/Settings.cs
r2288 r2293 376 376 377 377 //We have not computed the value. Compute the default. 378 Host pluginHost = Host.Instance; 379 IList<PluginInstance> plugins = pluginHost.Plugins; 378 IList<PluginInfo> plugins = Host.Instance.Plugins; 380 379 SortedList<int, Guid> priorities = new SortedList<int, Guid>(); 381 380 382 foreach (PluginIn stanceplugin in plugins)381 foreach (PluginInfo plugin in plugins) 383 382 { 384 383 //Check whether the plugin is signed by us. -
branches/eraser6/pluginsRewrite/Eraser.Plugins/Eraser.Plugins.csproj
r2292 r2293 54 54 <Compile Include="IRegistrar.cs" /> 55 55 <Compile Include="LoadingPolicy.cs" /> 56 <Compile Include="PluginIn stance.cs" />56 <Compile Include="PluginInfo.cs" /> 57 57 <Compile Include="PluginLoadedEventArgs.cs" /> 58 58 <Compile Include="PluginLoadEventArgs.cs" /> -
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> -
branches/eraser6/pluginsRewrite/Eraser.Plugins/PluginLoadEventArgs.cs
r2289 r2293 38 38 /// <param name="info">The plugin information to be passed to the approving 39 39 /// delegate.</param> 40 internal PluginLoadEventArgs(PluginIn stanceinfo)40 internal PluginLoadEventArgs(PluginInfo info) 41 41 { 42 42 Plugin = info; … … 47 47 /// Gets the plugin associated with this event. 48 48 /// </summary> 49 public PluginIn stancePlugin { get; private set; }49 public PluginInfo Plugin { get; private set; } 50 50 51 51 /// <summary> -
branches/eraser6/pluginsRewrite/Eraser.Plugins/PluginLoadedEventArgs.cs
r2289 r2293 36 36 /// </summary> 37 37 /// <param name="instance">The plugin instance of the recently loaded plugin.</param> 38 public PluginLoadedEventArgs(PluginIn stance instance)38 public PluginLoadedEventArgs(PluginInfo info) 39 39 { 40 Instance = instance;40 Plugin = info; 41 41 } 42 42 … … 44 44 /// The <see cref="PluginInstance"/> object representing the newly loaded plugin. 45 45 /// </summary> 46 public PluginIn stance Instance{ get; private set; }46 public PluginInfo Plugin { get; private set; } 47 47 } 48 48 } -
branches/eraser6/pluginsRewrite/Eraser/SettingsPanel.cs
r2209 r2293 34 34 35 35 using Eraser.Manager; 36 using Eraser. Manager.Plugin;36 using Eraser.Plugins; 37 37 using Eraser.Util; 38 38 using Eraser.Util.ExtensionMethods; … … 59 59 { 60 60 ListViewItem item = new ListViewItem(); 61 if (e. Instance.Plugin == null)62 { 63 item.Text = System.IO.Path.GetFileNameWithoutExtension(e.Instance.Assembly.Location);64 item.SubItems.Add(e. Instance.AssemblyInfo.Author);61 if (e.Plugin.Loaded) 62 { 63 item.Text = e.Plugin.Plugin.Name; 64 item.SubItems.Add(e.Plugin.Plugin.Author); 65 65 } 66 66 else 67 67 { 68 item.Text = e.Instance.Plugin.Name;69 item.SubItems.Add(e. Instance.Plugin.Author);70 } 71 68 item.Text = System.IO.Path.GetFileNameWithoutExtension(e.Plugin.Assembly.Location); 69 item.SubItems.Add(e.Plugin.AssemblyInfo.Author); 70 } 71 72 72 //The item is checked if the plugin was given the green light to load 73 item.Checked = e. Instance.Plugin != null ||73 item.Checked = e.Plugin.Plugin != null || 74 74 (Manager.ManagerLibrary.Settings.PluginApprovals.ContainsKey( 75 e. Instance.AssemblyInfo.Guid) && Manager.ManagerLibrary.76 Settings.PluginApprovals[e. Instance.AssemblyInfo.Guid]75 e.Plugin.AssemblyInfo.Guid) && Manager.ManagerLibrary. 76 Settings.PluginApprovals[e.Plugin.AssemblyInfo.Guid] 77 77 ); 78 78 79 79 //Visually display the other metadata associated with the assembly 80 item.ImageIndex = e. Instance.AssemblyAuthenticode == null ? -1 : 0;81 item.Group = e. Instance.LoadingPolicy == LoadingPolicy.Core ?80 item.ImageIndex = e.Plugin.AssemblyAuthenticode == null ? -1 : 0; 81 item.Group = e.Plugin.LoadingPolicy == LoadingPolicy.Core ? 82 82 pluginsManager.Groups[0] : pluginsManager.Groups[1]; 83 item.SubItems.Add(e. Instance.Assembly.GetFileVersion().ToString());84 item.SubItems.Add(e. Instance.Assembly.Location);85 item.Tag = e. Instance;83 item.SubItems.Add(e.Plugin.Assembly.GetFileVersion().ToString()); 84 item.SubItems.Add(e.Plugin.Assembly.Location); 85 item.Tag = e.Plugin; 86 86 pluginsManager.Items.Add(item); 87 87 } … … 122 122 //Load the list of plugins 123 123 Host instance = Host.Instance; 124 IEnumerator<PluginIn stance> i = instance.Plugins.GetEnumerator();124 IEnumerator<PluginInfo> i = instance.Plugins.GetEnumerator(); 125 125 while (i.MoveNext()) 126 126 OnNewPluginLoaded(this, new PluginLoadedEventArgs(i.Current)); … … 309 309 { 310 310 ListViewItem item = pluginsManager.Items[e.Index]; 311 PluginIn stance instance = (PluginInstance)item.Tag;312 if ( instance.LoadingPolicy == LoadingPolicy.Core)311 PluginInfo plugin = (PluginInfo)item.Tag; 312 if (plugin.LoadingPolicy == LoadingPolicy.Core) 313 313 e.NewValue = CheckState.Checked; 314 314 } … … 318 318 if (pluginsManager.SelectedItems.Count == 1) 319 319 { 320 PluginIn stance instance = (PluginInstance)pluginsManager.SelectedItems[0].Tag;321 e.Cancel = instance.Plugin == null || !instance.Plugin.Configurable;320 PluginInfo plugin = (PluginInfo)pluginsManager.SelectedItems[0].Tag; 321 e.Cancel = !(plugin.Loaded && plugin.Plugin.Configurable); 322 322 } 323 323 else … … 330 330 return; 331 331 332 PluginIn stance instance = (PluginInstance)pluginsManager.SelectedItems[0].Tag;333 instance.Plugin.DisplaySettings(this);332 PluginInfo plugin = (PluginInfo)pluginsManager.SelectedItems[0].Tag; 333 plugin.Plugin.DisplaySettings(this); 334 334 } 335 335 … … 348 348 foreach (ListViewItem item in pluginsManager.Items) 349 349 { 350 PluginIn stance plugin = (PluginInstance)item.Tag;350 PluginInfo plugin = (PluginInfo)item.Tag; 351 351 Guid guid = plugin.AssemblyInfo.Guid; 352 352 if (!pluginApprovals.ContainsKey(guid))
Note: See TracChangeset
for help on using the changeset viewer.
