System.AppDomain.ExecuteAssembly C# (CSharp) Méthode

ExecuteAssembly() private méthode

private ExecuteAssembly ( Assembly assembly, string args ) : int
assembly Assembly
args string
Résultat int
        private int ExecuteAssembly(Assembly assembly, string[] args)
        {
            MethodInfo entry = assembly.EntryPoint;
            if (entry == null)
            {
                throw new MissingMethodException(SR.EntryPointNotFound + assembly.FullName);
            }

            object result = null;
            try
            {
                result = entry.GetParameters().Length > 0 ?
                    entry.Invoke(null, new object[] { args }) :
                    entry.Invoke(null, null);
            }
            catch (TargetInvocationException targetInvocationException)
            {
                if (targetInvocationException.InnerException == null)
                {
                    throw;
                }
                
                // We are catching the TIE here and throws the inner exception only,
                // this is needed to have a consistent exception story with desktop clr
                ExceptionDispatchInfo.Capture(targetInvocationException.InnerException).Throw();
            }

            return result != null ? (int)result : 0;
        }

Same methods

AppDomain::ExecuteAssembly ( string assemblyFile ) : int
AppDomain::ExecuteAssembly ( string assemblyFile, string args ) : int
AppDomain::ExecuteAssembly ( string assemblyFile, string args, byte hashValue, Configuration hashAlgorithm ) : int

Usage Example

        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();
        }
All Usage Examples Of System.AppDomain::ExecuteAssembly