Exemple #1
0
 private static ProcessLaunchContext CreateContextForGetOutput(string fileName, string?args)
 {
     return(ProcessLaunchContext.Create(
                fileName: fileName,
                args: args,
                showWindow: false,
                useShellExecute: false
                ));
 }
Exemple #2
0
 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));
        }
Exemple #5
0
        public static ProgramRunner RunProgram(ProcessLaunchContext launchContext)
        {
            var processHolder = ProcessHolder.Start(launchContext);

            return(new ProgramRunner(processHolder));
        }