internal void Proceed()
        {
            if (!PreCheckIsActionRequired())
            {
                return;
            }

            AppDomainSetup domainSetup = new AppDomainSetup();

            domainSetup.ApplicationBase    = Path.GetDirectoryName(SingletonSettings.AssemblyPath);
            domainSetup.LoaderOptimization = LoaderOptimization.MultiDomainHost;
            Evidence domainEvidence = AppDomain.CurrentDomain.Evidence;

            AppDomain        domain            = AppDomain.CreateDomain("UnregisterDomain", domainEvidence, domainSetup);
            IAppDomainMethod appDomainInstance =
                (IAppDomainMethod)domain.CreateInstanceFromAndUnwrap(
                    typeof(IAppDomainMethod).Assembly.CodeBase, typeof(UnregisterOperationHost).FullName);

            appDomainInstance.SetConfig(
                new UnregisterOperationHostSettings(
                    SingletonSettings.AssemblyPath, SingletonSettings.UnRegMode,
                    SingletonSettings.DoRegisterCall == SingletonSettings.RegisterCall.On ? true : false,
                    SingletonSettings.SignCheck, SingletonSettings.AddinReg));

            int result = 0;

            try
            {
                result = appDomainInstance.ExecuteInDomain();
            }
            catch (Exception)
            {
                throw;
            }

            new ResultValidator(result).ThrowIfNeeded();

            try
            {
                AppDomain.Unload(domain);
            }
            catch
            {
                ;
            }
        }
Ejemplo n.º 2
0
        internal void Proceed()
        {
            AppDomainSetup domainSetup = new AppDomainSetup();

            domainSetup.ApplicationBase    = Path.GetDirectoryName(SingletonSettings.AssemblyPath);
            domainSetup.LoaderOptimization = LoaderOptimization.MultiDomainHost;
            Evidence domainEvidence = AppDomain.CurrentDomain.Evidence;

            AppDomain        domain            = AppDomain.CreateDomain("RegFileDomain", domainEvidence, domainSetup);
            IAppDomainMethod appDomainInstance =
                (IAppDomainMethod)domain.CreateInstanceFromAndUnwrap(
                    typeof(IAppDomainMethod).Assembly.CodeBase, typeof(RegFileOperationHost).FullName);

            appDomainInstance.SetConfig(
                new RegFileOperationHostSettings(
                    SingletonSettings.AssemblyPath, SingletonSettings.RegMode,
                    SingletonSettings.Codebase, SingletonSettings.RegFilePath, SingletonSettings.AddinReg, SingletonSettings.ExportCall));

            int result = 0;

            try
            {
                result = appDomainInstance.ExecuteInDomain();
            }
            catch (Exception)
            {
                throw;
            }

            new ResultValidator(result).ThrowIfNeeded();

            try
            {
                AppDomain.Unload(domain);
            }
            catch
            {
                ;
            }
        }