示例#1
0
        private FileSystemConsoleProcess(string executablePath, Process process, ICrashReportFinder crashReportFinder)
        {
            mProcess           = process;
            mProcessID         = process.Id;
            mExecutablePath    = executablePath;
            mCrashReportFinder = crashReportFinder;

            mProcess.ErrorDataReceived  += HandleStandardErrorDataReceived;
            mProcess.OutputDataReceived += HandleStandardOutputDataReceived;
        }
        public FileSystemConsoleApplication(string executablePath, ICrashReportFinder crashReportFinder)
        {
            if (executablePath == null)
            {
                throw new ArgumentNullException(nameof(executablePath));
            }

            CrashReportFinder = crashReportFinder;
            ExecutablePath    = executablePath;
        }
示例#3
0
        public static FileSystemConsoleProcess Start(string executablePath, string processArguments, ICrashReportFinder crashReportFinder)
        {
            Process osProcess = new Process
            {
                StartInfo = new ProcessStartInfo(executablePath)
                {
                    UseShellExecute        = false,
                    RedirectStandardInput  = true,
                    RedirectStandardOutput = true,
                    RedirectStandardError  = true,
                    CreateNoWindow         = true,
                    ErrorDialog            = false,
                    Arguments = processArguments
                },
                EnableRaisingEvents = true
            };

            osProcess.Start();
            osProcess.BeginOutputReadLine();
            osProcess.BeginErrorReadLine();

            FileSystemConsoleProcess process = new FileSystemConsoleProcess(executablePath, osProcess, crashReportFinder);

            return(process);
        }