private void SerializedEqualsDeserialized(NetworkMsg msg) { var serialized = msg.Serialize(); var newMsg = NetworkMsg.Deserialize(serialized); Assert.AreEqual(msg, newMsg); }
/// <summary> /// Sends the given network message to the client on the other end of the network asynchronously /// </summary> /// <param name="msg"></param> /// <returns></returns> public async Task SendMessageAsync(NetworkMsg msg) { await _streamWriter.WriteAndRewindAsync(msg.Serialize()); }
/// <summary> /// Sends the given network message to the client on the other end of the network /// </summary> /// <param name="msg"></param> public void SendMessage(NetworkMsg msg) { _streamWriter.WriteAndRewind(msg.Serialize()); }