static void PostStart(ProcessManager.IProcess process) { var proc = process.process; proc.BeginOutputReadLine(); proc.BeginErrorReadLine(); }
void PreStart(ProcessManager.IProcess process) { var proc = process.process; proc.OutputDataReceived += ProcessOnOutputDataReceived; proc.ErrorDataReceived += ProcessOnErrorDataReceived; proc.Exited += ProcessOnExited; }
/// <summary>Create a new compile operation.</summary> /// <param name="startInfo"> /// Specific info to provide to the process generated. /// /// Some properties will be override to enable redirection of input and output streams. /// </param> /// <param name="sourceFile">Path of the source file to compile.</param> /// <param name="intermediateSourceFile">Path of the intermediate file to use.</param> /// <param name="targetFile">Path to the generated file.</param> /// <param name="options">Options to use for compilation.</param> public CompileOperation( ProcessStartInfo startInfo, FileInfo sourceFile, FileInfo intermediateSourceFile, FileInfo targetFile, ShaderCompilerOptions options ) { startInfo.RedirectStandardInput = false; startInfo.RedirectStandardError = true; startInfo.RedirectStandardOutput = true; startInfo.UseShellExecute = false; startInfo.CreateNoWindow = true; commandLine = $"{startInfo.FileName} {startInfo.Arguments}"; m_Process = ProcessManager.Enqueue(startInfo, PreStart, PostStart); this.sourceFile = sourceFile; this.targetFile = targetFile; this.options = options; this.intermediateSourceFile = intermediateSourceFile; }
public static bool IsComplete(this ProcessManager.IProcess process) { return(process != null && process.process != null && process.hasStarted && process.process.HasExited); }