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{ @@ -47,7 +47,7 @@ namespace EGFramework.Examples.Test{
public void TestProcess(){
this.EGEnabledProtocolTool<EGProcess>();
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(){
@ -234,8 +234,8 @@ namespace EGFramework.Examples.Test{ @@ -234,8 +234,8 @@ namespace EGFramework.Examples.Test{
{
try
{
GD.Print("[String]"+protocolData);
GD.Print("[Bytes]"+protocolBytes);
GD.Print(protocolData);
// GD.Print("[Bytes]"+protocolBytes);
return true;
}
catch (System.Exception)

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

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

Loading…
Cancel
Save