public SonOfStrikeGui cmd(string cmdToExecute) { if (cmdToExecute.starts(">")) { sosApi.invoke(cmdToExecute.removeFirstChar()); } else { switch (cmdToExecute) { //case "Ctrl+C": // cmdApi.hostCmd_Ctrl_C(); // break; case "queue": // while debugging "there are {0} items in the queue".format(ExecutionQueue.Count).error(); //ExecutingRequest.Set(); break; case "queueSet": // while debugging "ExecutingRequest.Set()".error(); ExecutingRequest.Set(); break; default: addToExecutionQueue(cmdToExecute); break; } } selectThis(); return(this); }
public void dataReceived(string text) { if (text.contains(endExecutionString)) { var size = LastCommandResult.str().size(); try { var snipptet = (size == 0) ? "" : LastCommandResult.str().Substring(0, (size > 40) ? 40 : size); var stats = "Execution Result: {0} chars [{1}]".format(size, snipptet).remove("".line()).lineBeforeAndAfter(); stats.info(); writeToOutput(stats); if (size == 0) { writeToOutput("[no data returned]".lineBeforeAndAfter()); } } catch (Exception ex) { ex.log("in SonOfStrikeApi.dataReceived"); } ExecutingRequest.Set(); //processExecutionQueue(); return; } //if (text.starts(cdbPrompt)) // text = text.Substring(cdbPrompt.Length); LastCommandResult.AppendLine(text); if (sosApi.showReceivedData) { writeToOutput(text); } }