/*Helper Methods*/ protected bool SendMessage(byte[] parameters, Command command) { TcpCommandMessage message = new TcpCommandMessage(command, parameters); if (sender != null) { return(sender.SendWithoutAck(message) == TcpCommandIOBase.TransmissionResult.Successful); } return(false); }
private TcpCommandIOBase.TransmissionResult SendCurrentGameState() { string stateAsString = model.GenerateXmlRepresentation(); byte[] stateAsBytes = ASCIIEncoding.UTF8.GetBytes(stateAsString); TcpCommandMessage message = new TcpCommandMessage(RESPONSE_COMMAND, stateAsBytes); if (model.state == GameState.WON)//added { Settings.Default.totalGamesWon += 1; Settings.Default.Save(); } return(sender.SendWithoutAck(message)); }