Pretty new to C#, I'm trying to create a WinForms Application that will run ScanState and capture the output from it. I've got this code as a test...
private void button1_Click(object sender, EventArgs e)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
process.StartInfo.FileName = $"amd64\\scanstate.exe"; ;
process.StartInfo.Arguments = "";
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardInput = true;
process.Start();
string q = "";
string err = "";
while (!process.HasExited)
{
q += process.StandardOutput.ReadToEnd();
err += process.StandardError.ReadToEnd();
}
//label1.text = q;
MessageBox.Show(q.ToString());
MessageBox.Show(err);
}
But all I get is two blank message boxes. Inspecting q shows that apparently it says something. The inspector says this: \r\0\n\0s\0t\0r\0a\0t\0o\0r\0 \0p\0r\0i\0v\0i\0l\0e\0g\0e\0s\0 \0a\0r\0e\0 \0r\0e\0q\0u\0i\0r\0e\0d\0 \0t\0o\0 \0r\0u\0n\0 \0t\0h\0i\0s\0 \0t\0o\0o\0l\0.\0\r\0\n\0\r\r\nScanState return code: 34\r\r\n"
I'm not sure what this is or if it can even be converted to plain text.