Reading SA-MP Server output in C#
#1

Hello everybody,

I am currently working on a remote server controller utility in C#, it works pretty well in Minecraft already:

[ame]http://www.youtube.com/watch?v=cOFVstelNJ0[/ame]
For the output i mean see 1:45

Now the problem is, i have tried this at the sa-mp server but i am not getting any output as i get in Minecraft, CMD and other console applications! Any ideas ?

Code:
Код:
//CMD is in this case the command splitted by spaces, the Helper.processes is a List<Process> object
Process ps = new Process();
ps.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
if (cmd.Length > 3) ps.StartInfo.Arguments = cmd[3];
ps.StartInfo.FileName = cmd[2];
ps.StartInfo.UseShellExecute = false;
ps.StartInfo.RedirectStandardOutput = true;
ps.StartInfo.RedirectStandardInput = true;

Helper.Processes.Add(ps);
Helper.Broadcast("Process is now running under ID #" + (Helper.Processes.Count - 1) + ", type \"process stopview\" in order to switch back to the main server input.");

Helper.Processes[Helper.Processes.Count - 1].Start();
Helper.Processes[Helper.Processes.Count - 1].BeginOutputReadLine();
Helper.Processes[Helper.Processes.Count - 1].OutputDataReceived += new DataReceivedEventHandler(ProcessStreamer.StreamOutput);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)