Changeset 1815 for trunk/eraser6


Ignore:
Timestamp:
2/12/2010 1:04:52 AM (5 years ago)
Author:
lowjoel
Message:

Handle partially trusted plugin loading (eg. from network paths) by displaying an error message to catch the SecurityException? thrown

Location:
trunk/eraser6/Eraser.Manager
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Eraser.Manager/Plugins.cs

    r1802 r1815  
    258258            } 
    259259 
    260             //Initialize the plugin 
    261             IPlugin pluginInterface = (IPlugin)Activator.CreateInstance( 
    262                 instance.Assembly.GetType(typePlugin.ToString())); 
    263             pluginInterface.Initialize(this); 
    264             instance.Plugin = pluginInterface; 
    265  
    266             //And broadcast the plugin load event 
    267             OnPluginLoaded(this, new PluginLoadedEventArgs(instance)); 
     260            try 
     261            { 
     262                //Initialize the plugin 
     263                IPlugin pluginInterface = (IPlugin)Activator.CreateInstance( 
     264                    instance.Assembly.GetType(typePlugin.ToString())); 
     265                pluginInterface.Initialize(this); 
     266                instance.Plugin = pluginInterface; 
     267 
     268                //And broadcast the plugin load event 
     269                OnPluginLoaded(this, new PluginLoadedEventArgs(instance)); 
     270            } 
     271            catch (System.Security.SecurityException e) 
     272            { 
     273                MessageBox.Show(S._("Could not load the plugin {0}.\n\nThe error returned was: {1}", 
     274                    filePath, e.Message), S._("Eraser"), MessageBoxButtons.OK, MessageBoxIcon.Error, 
     275                    MessageBoxDefaultButton.Button1, Localisation.IsRightToLeft(null) ? 
     276                        MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign : 0); 
     277            } 
    268278        } 
    269279 
  • trunk/eraser6/Eraser.Manager/Strings.en.resx

    r1805 r1815  
    202202    <value>(default)</value> 
    203203  </data> 
     204  <data name="Could not load the plugin {0}.\n\nThe error returned was: {1}" xml:space="preserve"> 
     205    <value>Could not load the plugin {0}.\n\nThe error returned was: {1}</value> 
     206  </data> 
     207  <data name="Eraser" xml:space="preserve"> 
     208    <value>Eraser</value> 
     209  </data> 
    204210  <data name="Running on restart" xml:space="preserve"> 
    205211    <value>Running on restart</value> 
  • trunk/eraser6/Eraser.Manager/Strings.it.resx

    r1802 r1815  
    202202    <value>(Untranslated)</value> 
    203203  </data> 
     204  <data name="Could not load the plugin {0}.\n\nThe error returned was: {1}" xml:space="preserve"> 
     205    <value>(Untranslated)</value> 
     206  </data> 
     207  <data name="Eraser" xml:space="preserve"> 
     208    <value>(Untranslated)</value> 
     209  </data> 
    204210  <data name="Running on restart" xml:space="preserve"> 
    205211    <value>Esecuzione al riavvio</value> 
  • trunk/eraser6/Eraser.Manager/Strings.nl.resx

    r1802 r1815  
    202202    <value>(Untranslated)</value> 
    203203  </data> 
     204  <data name="Could not load the plugin {0}.\n\nThe error returned was: {1}" xml:space="preserve"> 
     205    <value>(Untranslated)</value> 
     206  </data> 
     207  <data name="Eraser" xml:space="preserve"> 
     208    <value>(Untranslated)</value> 
     209  </data> 
    204210  <data name="Running on restart" xml:space="preserve"> 
    205211    <value>(Untranslated)</value> 
  • trunk/eraser6/Eraser.Manager/Strings.resx

    r1802 r1815  
    202202    <value>(default)</value> 
    203203  </data> 
     204  <data name="Could not load the plugin {0}.\n\nThe error returned was: {1}" xml:space="preserve"> 
     205    <value>Could not load the plugin {0}.\n\nThe error returned was: {1}</value> 
     206  </data> 
     207  <data name="Eraser" xml:space="preserve"> 
     208    <value>Eraser</value> 
     209  </data> 
    204210  <data name="Running on restart" xml:space="preserve"> 
    205211    <value>Running on restart</value> 
Note: See TracChangeset for help on using the changeset viewer.