I'm starting a process with code similar to that below:
// some of the flags are not needed
process.StartInfo.CreateNoWindow = true;
process.StartInfo.ErrorDialog = false;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.EnableRaisingEvents = true;
process.OutputDataReceived += process_OutputDataReceived;
process.ErrorDataReceived += process_OutputDataReceived;
process.Start();
process.BeginErrorReadLine();
process.BeginOutputReadLine();
void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
}
void process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
}
The issue I'm running into is that the DataReceivedEventArgs
object has a Data
property which is a string. I need to read the standard output data as the binary data it is. I'm guessing there's no way to get the string data back into it's appropriate binary data, so any suggestions on using a different method for receiving the binary data would be great.