当前位置: 首页>>代码示例>>C#>>正文


C# AppDomain.ExecuteAssembly方法代码示例

本文整理汇总了C#中System.AppDomain.ExecuteAssembly方法的典型用法代码示例。如果您正苦于以下问题:C# AppDomain.ExecuteAssembly方法的具体用法?C# AppDomain.ExecuteAssembly怎么用?C# AppDomain.ExecuteAssembly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.AppDomain的用法示例。


在下文中一共展示了AppDomain.ExecuteAssembly方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LaunchAppDomain

        public void LaunchAppDomain()
        {
            UnloadAppDomain();
            QAppDomain = AppDomain.CreateDomain("QAppDomain");
            AppDomain.MonitoringIsEnabled = true;

            string path = Win32Hooks.HookManager.Instance.AssemblyPath;

            if(this.EveAccount.DX11) {

                t = new Thread(delegate() { QAppDomain.ExecuteAssembly(path + "\\Questor\\Questor.exe",args: new String[] {"-i","-c", Win32Hooks.HookManager.Instance.CharName,"-u", Win32Hooks.HookManager.Instance.EveAccount.AccountName, "-p", Win32Hooks.HookManager.Instance.EveAccount.Password}); });
            } else {

                t = new Thread(delegate() { QAppDomain.ExecuteAssembly(path + "\\Questor\\Questor.exe",args: new String[] {"-d","-i","-c", Win32Hooks.HookManager.Instance.CharName,"-u", Win32Hooks.HookManager.Instance.EveAccount.AccountName, "-p", Win32Hooks.HookManager.Instance.EveAccount.Password}); });
            }
            t.Start();
        }
开发者ID:Blinker,项目名称:QuestorLauncher,代码行数:17,代码来源:HookManager.cs

示例2: Run

        //private static void domain_DomainUnload(object sender, EventArgs e)
        //{
        //    Trace.WriteLine("domain_DomainUnload()");
        //}

        static void Run(object runSourceRestartParameters)
        {
            __domain = AppDomain.CreateDomain(__runsourceDomainName);
            if (runSourceRestartParameters != null)
            {
                __domain.SetData(__domainRestartParametersName, runSourceRestartParameters);
                runSourceRestartParameters = null;
            }
            __domain.ExecuteAssembly(Path.Combine(zapp.GetAppDirectory(), __runsourceExeName));
        }
开发者ID:labeuze,项目名称:source,代码行数:15,代码来源:runsource.launch.cs

示例3: application2Worker_DoWork

        private void application2Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            //Strange things happens when exiting the Console Application. When pressing the "x" in the window, it closes even the forms application
            //and closing then re-opening the console application creates an IOexception. It seems something is not being closed properly. A solution could be
            //to re-create the appdomain everytime the console app starts. This is an ugly temporary solution, but it works for now.

            cDomain = AppDomain.CreateDomain("ConsoleDomain");
            //domain.CreateInstanceFromAndUnwrap(@"C:\Users\Mads\Documents\GitHub\ProgrammeringIII\Programmering III\ApplicationDomainsConsole\bin\Debug\ApplicationDomainsConsole.exe", ")
            cDomain.ExecuteAssembly(@"C:\Users\Mads\Documents\GitHub\ProgrammeringIII\Programmering III\ApplicationDomainsConsole\bin\Debug\ApplicationDomainsConsole.exe");
        }
开发者ID:Tjornfelt,项目名称:ProgrammeringIII,代码行数:10,代码来源:ApplicationDomains.cs

示例4: Start

        public override void Start()
        {
            var setup = AppDomainSetup();

            try
            {
                domain = AppDomain.CreateDomain(executable, new Evidence(), setup);
                thread = new Thread(() => domain.ExecuteAssembly(GetExecutablePath()));
                thread.Start();

            }
            catch (Exception)
            {
                AppDomain.Unload(domain);
                domain = null;
                thread = null;
                throw;
            }
        }
开发者ID:danryd,项目名称:Tarro,代码行数:19,代码来源:AppRuntime.cs

示例5: SwitchDomainForRazorEngine

        private static void SwitchDomainForRazorEngine()
        {
            if (AppDomain.CurrentDomain.IsDefaultAppDomain())
            {
                // RazorEngine cannot clean up from the default appdomain...
                //Console.WriteLine("Switching to secound AppDomain, for RazorEngine...");
                AppDomainSetup adSetup = new AppDomainSetup();
                adSetup.ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
                var current = AppDomain.CurrentDomain;
                // You only need to add strongnames when your appdomain is not a full trust environment.
                var strongNames = new StrongName[0];

                _domain = AppDomain.CreateDomain(
                    "MyMainDomain", null,
                    current.SetupInformation, new PermissionSet(PermissionState.Unrestricted),
                    strongNames);
                _domain.ExecuteAssembly(Assembly.GetExecutingAssembly().Location);
            }
        }
开发者ID:windwp,项目名称:RazorTransformTool,代码行数:19,代码来源:RazorTransformTool.cs

示例6: loadServer

        public override void loadServer(string filename)
        {
            if (appDomain != null)
                throw new ApplicationException("Server is already loaded");

            appDomain = AppDomain.CreateDomain(Utils.randomName(15, 20));
            thread = new Thread(new ThreadStart(() => {
                try {
                    appDomain.ExecuteAssembly(filename, null, new string[] { ipcName, ipcUri });
                }
                catch (NullReferenceException) {
                    // Here if appDomain was set to null by Dispose() before this thread started
                }
                catch (AppDomainUnloadedException) {
                    // Here if it was unloaded by Dispose()
                }
                unloadAppDomain(appDomain);
                appDomain = null;
            }));
            thread.Start();
        }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:21,代码来源:NewAppDomainAssemblyServerLoader.cs

示例7: RunAssembly

 private static void RunAssembly(AppDomain appDomain)
 {
     appDomain.ExecuteAssembly("../../../LoadedAppDomain/bin/Debug/LoadedAppDomain.exe");
 }
开发者ID:NomadPL,项目名称:Nomad,代码行数:4,代码来源:ConsoleStandaloneCodeTest.cs

示例8: StartFieldWorksThread

		internal void StartFieldWorksThread()
		{
			m_FieldWorksDomain = AppDomain.CreateDomain("Running FieldWorks Domain");
			GetFieldWorksInfo().PretendNotRunningUnitTests();
			// FIXME: use FwAppArgs.kProject and FwAppArgs.kApp
			m_FieldWorksDomain.ExecuteAssembly(typeof(FieldWorks).Assembly.Location, null, new string[] {"-app", App, "-db", Db});
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:LinuxSmokeTestHelper.cs

示例9: Run

        private void Run()
        {
            string assemblyFile = Assembly.GetEntryAssembly().Location;
            string assemblyFolder = Path.GetDirectoryName(assemblyFile);
            string assemblyFileName = Path.GetFileNameWithoutExtension(assemblyFile);

            var versionDirectory = new VersionDirectoryFinder(log).GetVersionDirectory(assemblyFolder);

            if (versionDirectory == null)
            {
                log.Error("Cannot find any valid directory, which has a name with version pattern.");
                Console.ReadKey();
                return;
            }

            var exeDirectory = new DirectoryInfo(Path.Combine(versionDirectory.FullName, assemblyFileName));
            var files = exeDirectory.GetFiles("*.exe");
            if (files.Length == 0)
                throw new FileNotFoundException(string.Format("Cannot find a file with 'exe' extension inside '{0}'",
                                                              exeDirectory.FullName));
            if (files.Length > 1)
                throw new InvalidOperationException(string.Format("There is more than 1 file with 'exe' extension inside '{0}'",
                                                                  exeDirectory.FullName));

            var targetFile = files[0].FullName;
            var targetFolder = Path.GetDirectoryName(targetFile);

            var targetFileConfig = GetConfigurationFilename(targetFile);

            var currentFileConfig = GetConfigurationFilename(assemblyFile);

            //targetFileConfig = new ConfigurationFileMerger().MergeFiles(targetFileConfig, currentFileConfig);

            try
            {
                domain = AppDomain.CreateDomain(AppDomain.CurrentDomain.FriendlyName + "_bootstrapped",
                                                    AppDomain.CurrentDomain.Evidence,
                                                    new AppDomainSetup
                                                        {
                                                            ConfigurationFile = targetFileConfig,
                                                            ApplicationBase = targetFolder,
                                                        });

                var logger = (UnhandledExceptionLogger)domain.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly().Location,
                                                   typeof(UnhandledExceptionLogger).FullName,
                                                   false, BindingFlags.Default, null, null,
                                                   Thread.CurrentThread.CurrentCulture, null);
                logger.ProcessUnhandledExceptions();

                BootstrapperParameters.WriteToDomain(new BootstrapperParameters
                    {
                        BootstrapperFile = assemblyFile,
                        ConfigurationFile = currentFileConfig,
                    }, domain);

            //				var newArgs = new List<string>(args);
            //				newArgs.AddRange(.ToArray());
                var returnValue = domain.ExecuteAssembly(targetFile, args);
                AppDomain.Unload(domain);
                if (returnValue == (int) ReturnCodes.RestartDueToAvailableUpdate || returnValue == (int) ReturnCodes.RestartDueToConfigChange)
                    Main(args);
            }
            catch (Exception ex)
            {
                log.Error("An error occurred while running bootstrapped program", ex);
                Console.ReadLine();
            }
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:68,代码来源:BootstrapperProgram.cs

示例10: InvokeAppDomain

 private void InvokeAppDomain(AppDomain domain)
 {
     domain.ExecuteAssembly(domain.FriendlyName);
 }
开发者ID:BackupTheBerlios,项目名称:aqdomus-svn,代码行数:4,代码来源:BasicServiceContainer.cs

示例11: ExecuteAssembly

 private static int ExecuteAssembly(string exePath, AppDomain domain)
 {
     return domain.ExecuteAssembly(exePath);
 }
开发者ID:wongatech,项目名称:HealthMonitoring,代码行数:4,代码来源:AppDomainExecutor.cs


注:本文中的System.AppDomain.ExecuteAssembly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。