コード例 #1
0
        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"]);
        }
コード例 #2
0
        public void EncryptionTests()
        {
            CommonConfiguration.Instance.EncryptionConfiguration.IsEncryptionEnabled = true;
            CommonConfiguration.Instance.EncryptionConfiguration.Salt = "o6806642kbM7c5";

            var sw = new Stopwatch();

            sw.Start();
            var value      = SampleGenerator.GameEventTestLarge();
            var p1         = sw.ElapsedMilliseconds;
            var serialised = JsonSerializerHelper.Serialize(value);
            var p2         = sw.ElapsedMilliseconds;
            var encrypted  = GamePacket.EncryptStringAES(serialised);
            var p3         = sw.ElapsedMilliseconds;

            var dSerialisation = p2 - p1;
            var dEncryption    = p3 - p2;
        }