Example #1
0
 private void Init(PluginSandboxOptions options)
 {
     try
     {
         var info = new AppDomainSetup();
         info.ApplicationBase = options.ApplicationBase;
         if (options.PermissionSet == null)
         {
             _sandbox = AppDomain.CreateDomain(options.FrendlyName, options.Evidence, info);
         }
         else
         {
             _sandbox = AppDomain.CreateDomain(options.FrendlyName, options.Evidence, info, options.PermissionSet);
         }
         object obj = _sandbox.CreateInstanceAndUnwrap(options.AssemblyName, options.TypeName);
         _plugin = obj as PluginBase;
         if (_plugin == null)
         {
             throw new ApplicationException(string.Format("Type '{0}' must extend 'Plugin.Common.PluginBase'"));
         }
     }
     catch (Exception e)
     {
         _exception = e;
     }
 }
Example #2
0
 public PluginSandbox(PluginSandboxOptions options)
 {
     // default context
     _context = new Dictionary <string, object>();
     Init(options);
 }