using System; using System.Runtime.InteropServices; using System.Runtime.Remoting; using System.Security; using System.Security.Policy; namespace System.Runtime.Hosting { /// Provides the base class for the activation of manifest-based assemblies. // Token: 0x020002BA RID: 698 [MonoTODO("missing manifest support")] [ComVisible(true)] public class ApplicationActivator { /// Creates an instance of the application to be activated, using the specified activation context. /// An that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object. /// An that identifies the application to activate. /// /// is null. // Token: 0x0600210C RID: 8460 RVA: 0x00078DE4 File Offset: 0x00076FE4 public virtual ObjectHandle CreateInstance(ActivationContext activationContext) { return this.CreateInstance(activationContext, null); } /// Creates an instance of the application to be activated, using the specified activation context and custom activation data. /// An that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object. /// An that identifies the application to activate. /// Custom activation data. /// /// is null. // Token: 0x0600210D RID: 8461 RVA: 0x00078DF0 File Offset: 0x00076FF0 public virtual ObjectHandle CreateInstance(ActivationContext activationContext, string[] activationCustomData) { if (activationContext == null) { throw new ArgumentNullException("activationContext"); } AppDomainSetup appDomainSetup = new AppDomainSetup(activationContext); return ApplicationActivator.CreateInstanceHelper(appDomainSetup); } /// Creates an instance of an application using the specified object. /// An that is a wrapper for the return value of the application execution. The return value must be unwrapped to access the real object. /// An object whose property identifies the application to activate. /// The property of is null. /// The application instance failed to execute because the policy settings on the current application domain do not provide permission for this application to run. // Token: 0x0600210E RID: 8462 RVA: 0x00078E1C File Offset: 0x0007701C protected static ObjectHandle CreateInstanceHelper(AppDomainSetup adSetup) { if (adSetup == null) { throw new ArgumentNullException("adSetup"); } if (adSetup.ActivationArguments == null) { string text = Locale.GetText("{0} is missing it's {1} property"); throw new ArgumentException(string.Format(text, "AppDomainSetup", "ActivationArguments"), "adSetup"); } HostSecurityManager hostSecurityManager; if (AppDomain.CurrentDomain.DomainManager != null) { hostSecurityManager = AppDomain.CurrentDomain.DomainManager.HostSecurityManager; } else { hostSecurityManager = new HostSecurityManager(); } Evidence evidence = new Evidence(); evidence.AddHost(adSetup.ActivationArguments); TrustManagerContext trustManagerContext = new TrustManagerContext(); ApplicationTrust applicationTrust = hostSecurityManager.DetermineApplicationTrust(evidence, null, trustManagerContext); if (!applicationTrust.IsApplicationTrustedToRun) { string text2 = Locale.GetText("Current policy doesn't allow execution of addin."); throw new PolicyException(text2); } AppDomain appDomain = AppDomain.CreateDomain("friendlyName", null, adSetup); return appDomain.CreateInstance("assemblyName", "typeName", null); } } }