Beispiel #1
0
        /// <summary>
        /// Loads the module based on the configuration passed in the constructor.
        /// </summary>
        public override void LoadModule()
        {
            AppDomainSetup ads = new AppDomainSetup();
            ads.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
            ads.LoaderOptimization = LoaderOptimization.SingleDomain;
            ads.ShadowCopyFiles = "false";

            System.Security.Policy.Evidence secureEvidence = new System.Security.Policy.Evidence();
            secureEvidence.AddAssembly( Assembly.GetCallingAssembly() );
            //Create the AppDomain.
            moduleSpace = AppDomain.CreateDomain(
                "Project2QDomain." + moduleId,
                secureEvidence,
                ads );

            //FullTrust this guy.
            IModule.SetSecurityPolicy( moduleSpace );

            moduleProxy = new ModuleProxy(
                moduleId,
                "Project2QAssembly." + moduleId,
                modConfig.FileNames,
                modConfig.FullName,
                new Project2Q.SDK.ModuleSupport.ModuleProxy.VariableParamRetrievalDelegate(Server.RetrieveVariable) );

            try {
                moduleProxy.LoadScript(modConfig.Includes, modConfig.Language);
            }
            catch {
                AppDomain.Unload( moduleSpace );
                moduleSpace = null;
                moduleProxy = null;
                throw;
            }
        }
Beispiel #2
0
 public ModuleEvents(ModuleProxy ml)
 {
     this.moduleProxy = ml;
 }
Beispiel #3
0
 /// <summary>
 /// Initializes the module with values.
 /// </summary>
 /// <param name="mp">The module proxy object.</param>
 /// <param name="mid">The module ID.</param>
 public virtual void Initialize(ModuleProxy mp, int mid)
 {
     this.mp = mp;
     this.moduleId = mid;
 }