private static ProcessLaunchContext CreateContextForGetOutput(string fileName, string?args) { return(ProcessLaunchContext.Create( fileName: fileName, args: args, showWindow: false, useShellExecute: false )); }
private static ProcessLaunchContext CreateContextForOpenFile(FileInfo file) { return(ProcessLaunchContext.Create( file: file, args: null, showWindow: true, useShellExecute: true )); }
public static ProcessHolder Start(ProcessLaunchContext launchContext) { if (launchContext is null) { throw new ArgumentNullException(nameof(launchContext)); } return(new ProcessHolder(StartProgram(launchContext))); }
private static Process StartProgram(ProcessLaunchContext launchContext) { ProcessStartInfo starterInfo = launchContext.CreateStartInfo(); return(Process.Start(starterInfo)); }
public static ProgramRunner RunProgram(ProcessLaunchContext launchContext) { var processHolder = ProcessHolder.Start(launchContext); return(new ProgramRunner(processHolder)); }