Fix: Invalid Cast Exception #194

This commit is contained in:
Chen, Mei 2020-09-16 17:14:03 +02:00
parent b9f3ec64d8
commit 3667c2d115

View file

@ -273,11 +273,10 @@ namespace AsterNET.Manager
if (processingCommandResult) if (processingCommandResult)
{ {
string lineLower = line.ToLower(Helper.CultureInfo); string lineLower = line.ToLower(Helper.CultureInfo);
if (lineLower == "--end command--") if (lineLower == "--end command--" || lineLower == "")
{ {
var commandResponse = new CommandResponse(); var commandResponse = new CommandResponse();
Helper.SetAttributes(commandResponse, packet); Helper.SetAttributes(commandResponse, packet);
commandList.Add(line);
commandResponse.Result = commandList; commandResponse.Result = commandList;
processingCommandResult = false; processingCommandResult = false;
packet.Clear(); packet.Clear();
@ -308,11 +307,11 @@ namespace AsterNET.Manager
mrConnector.DispatchEvent(connectEvent); mrConnector.DispatchEvent(connectEvent);
continue; continue;
} }
if (line.Trim().ToLower(Helper.CultureInfo) == "response: follows") if (line.Trim().ToLower(Helper.CultureInfo) == "response: follows"
|| line.Trim().ToLower(Helper.CultureInfo).EndsWith("command output follows"))
{ {
// Switch to wait "--END COMMAND--" mode // Switch to wait "--END COMMAND--"/"" mode
processingCommandResult = true; processingCommandResult = true;
packet.Clear();
commandList.Clear(); commandList.Clear();
Helper.AddKeyValue(packet, line); Helper.AddKeyValue(packet, line);
continue; continue;