Browse Source

fixed ffmpeg test

master
jkpete 3 months ago
parent
commit
8b368bf4c8
  1. 6
      Example/UsingTest/Script/EGSaveTest.cs
  2. 13
      addons/EGFramework/Module/ProtocolTools/EGProcess.cs

6
Example/UsingTest/Script/EGSaveTest.cs

@ -47,7 +47,7 @@ namespace EGFramework.Examples.Test{
public void TestProcess(){ public void TestProcess(){
this.EGEnabledProtocolTool<EGProcess>(); this.EGEnabledProtocolTool<EGProcess>();
this.EGProcess().InitProcess("cmd.exe"); this.EGProcess().InitProcess("cmd.exe");
this.EGProcess().SendStringData("cmd.exe","ipconfig"); this.EGProcess().SendStringData("cmd.exe","SaveData\\ffmpeg.exe -version\n");
} }
public async void TestSsh(){ public async void TestSsh(){
@ -234,8 +234,8 @@ namespace EGFramework.Examples.Test{
{ {
try try
{ {
GD.Print("[String]"+protocolData); GD.Print(protocolData);
GD.Print("[Bytes]"+protocolBytes); // GD.Print("[Bytes]"+protocolBytes);
return true; return true;
} }
catch (System.Exception) catch (System.Exception)

13
addons/EGFramework/Module/ProtocolTools/EGProcess.cs

@ -52,8 +52,16 @@ namespace EGFramework{
process.EnableRaisingEvents = true; process.EnableRaisingEvents = true;
process.OutputDataReceived += (sender, e) => { process.OutputDataReceived += (sender, e) => {
if (!string.IsNullOrEmpty(e.Data)) { if (!string.IsNullOrEmpty(e.Data)) {
ResponseMsgs.Enqueue(new ResponseMsg { sender = processName, stringData = e.Data }); try
EG.Print("[process output]"+processName+" "+e.Data); {
ResponseMsgs.Enqueue(new ResponseMsg { sender = processName, stringData = e.Data });
}
catch (Exception err)
{
ErrorLogs = "[process output error]" + err.ToString();
EG.Print(ErrorLogs);
}
} }
}; };
process.Exited += (sender, e) => { process.Exited += (sender, e) => {
@ -61,6 +69,7 @@ namespace EGFramework{
}; };
Processes.Add(processName,process); Processes.Add(processName,process);
process.Start(); process.Start();
process.BeginOutputReadLine();
} }
} }
catch(Exception e){ catch(Exception e){

Loading…
Cancel
Save