public void SendCommands(IEnumerable <AICommand> commandsToSend) { var message = new AICommandsMessage { Commands = commandsToSend }; var serialized = Serializer.SerializeAICommandsMessage(message); if (commandsToSend.Count() > 0) { Console.WriteLine("Writing commands to server: " + serialized); } Writer.Write(serialized); Writer.Flush(); }
public string SerializeAICommandsMessage(AICommandsMessage message) { return(JsonConvert.SerializeObject(message, settings) + "\n"); }