コード例 #1
0
        internal ProcessExecutor(
            CancellationToken cancellationToken,
            Downloader.Models.ApplicationExecRoot executable,
            Storage.Models.StorageEnv env)
            : base(cancellationToken, env)
        {
            _info = new ProcessStartInfo
            {
                ErrorDialog            = false,
                RedirectStandardError  = true,
                RedirectStandardOutput = true,
                UseShellExecute        = false,
                CreateNoWindow         = true,
                WindowStyle            = ProcessWindowStyle.Hidden
            };

            var args    = ReplaceWithEnvironment(executable.Args.ToString());
            var command = ReplaceWithEnvironment(executable.Binary);

            foreach (var e in executable.Env)
            {
                var enValue = ReplaceWithEnvironment(e.Value);
                // FIXME: OMG! I am so sowwy(((
                foreach (var e1 in executable.Env)
                {
                    enValue = enValue.Replace(e1.Key, e1.Value);
                }
                _info.Environment.Add(e.Key, enValue);
                command = command.Replace(e.Key, e.Value);
                args    = args.Replace(e.Key, e.Value);
            }

            _info.FileName  = command;
            _info.Arguments = args;
        }
コード例 #2
0
 internal CmdExecutor(
     CancellationToken cancellationToken,
     Downloader.Models.ApplicationExecRoot executable,
     Storage.Models.StorageEnv env)
     : base(cancellationToken, OverrideExecutable(executable), env)
 {
 }
コード例 #3
0
ファイル: Executor.cs プロジェクト: elmankross/x-server
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 internal static Executor Get(CancellationToken cancellationToken,
                              Downloader.Models.ApplicationExecRoot executable,
                              Storage.Models.StorageEnv env)
 {
     return(executable.Binary switch
     {
         CmdExecutor.COMMAND_PREFIX => new CmdExecutor(cancellationToken, executable, env),
         _ => new ProcessExecutor(cancellationToken, executable, env),
     });
コード例 #4
0
 private static Downloader.Models.ApplicationExecRoot OverrideExecutable(
     Downloader.Models.ApplicationExecRoot exec)
 {
     exec.Binary = "cmd.exe";
     return(exec);
 }