public void DatacontractSerializerHelperTest() { var gameEvent = SampleGenerator.GameEventTestLarge(); var content = DatacontractSerializerHelper.Serialize(gameEvent); Assert.IsTrue(content.Length > 0); var gameEvent2 = DatacontractSerializerHelper.Deserialize <GameEvent>(content); Assert.AreEqual(gameEvent.Properties.Count, gameEvent2.Properties.Count); Assert.AreEqual(gameEvent.Properties["stat_22"], gameEvent2.Properties["stat_22"]); }
static void HandlePacket(string message) { var packet = DatacontractSerializerHelper.Deserialize <GamePacket>(message); if (packet != null) { if (OnGameEventReceived != null) { OnGameEventReceived.Invoke(null, new GamePacketArgs { GamePacket = packet }); } } }