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; }
internal CmdExecutor( CancellationToken cancellationToken, Downloader.Models.ApplicationExecRoot executable, Storage.Models.StorageEnv env) : base(cancellationToken, OverrideExecutable(executable), env) { }
/// <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), });
private static Downloader.Models.ApplicationExecRoot OverrideExecutable( Downloader.Models.ApplicationExecRoot exec) { exec.Binary = "cmd.exe"; return(exec); }