0
我試圖重定向遊戲服務器進程的輸出,但我沒有收到大部分輸出。C# - 重定向遊戲(UDK)服務器的進程輸出
Here's a image of what such a server looks like.
現在,我能夠接受的黃線,但一切只是沒有顯示出來,無論是在控制檯或在我的結束。
有什麼想法?
Process p = new Process();
p.StartInfo.FileName = file;
p.StartInfo.Arguments = arguments;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.OutputDataReceived += new DataReceivedEventHandler(OutputHandler);
p.ErrorDataReceived += new DataReceivedEventHandler(ErrorHandler);
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
private void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
...
}
private void ErrorHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
...
}