Hi.
I need help with two things:
1) I'm getting the input from a JAR program, the minecraft server software to be exact.
The code I'm using is working great, for 2 lines of text.
After that I'm getting nothing.
These two lines are information about the game (how many achievements and recipes).
So when I run the program I get this info:
which is correct, but only a part of all the text.Quote:
148 recipes
16 achievements
2) I only get the text when I close the server program, its not "live".
So I first run my program, which runs the server software, I close the server software and I get the stdout.
I wan't stdout live!
Here is my code:
Code:private void button2_Click(object sender, EventArgs e)
{
string line;
ProcessStartInfo processStartInfo = new ProcessStartInfo("java.exe", "-Xms512M -Xmx1024M -jar minecraft_server.jar");
processStartInfo.UseShellExecute = false;
processStartInfo.ErrorDialog = false;
processStartInfo.RedirectStandardError = true;
processStartInfo.RedirectStandardInput = true;
processStartInfo.RedirectStandardOutput = true;
Process process = new Process();
process.StartInfo = processStartInfo;
bool processStarted = process.Start();
StreamWriter inputWriter = process.StandardInput;
StreamReader outputReader = process.StandardOutput;
while (!outputReader.EndOfStream)
{
line = outputReader.ReadLine();
AddToLog(line);
}
StreamReader errorReader = process.StandardError;
}
private void AddToLog(string text)
{
textBox1.Text = textBox1.Text + Environment.NewLine + text;
}