コード例 #1
0
        public void GetPlayerData(string deviceId, string key)
        {
            var data = GenericData.GetPlayerData(deviceId, key);

            Response.BodyWriter.WriteAsync(data);
            Response.CompleteAsync();
            return;
        }
コード例 #2
0
        public bool CheckPassword(string deviceId, string password)
        {
            BlowfishCrypter crypter          = new BlowfishCrypter();
            string          existingPassword = GenericData.GetPlayerData(deviceId, "password").ToUTF8String();
            string          checkedPassword  = crypter.Crypt(password, existingPassword);

            return(existingPassword == checkedPassword);
        }
コード例 #3
0
        public void IncrementPlayerData(string deviceId, string key, double changeAmount, double?expirationTimer = null)
        {
            PerformanceTracker pt      = new PerformanceTracker("IncrementPlayerData");
            string             lockKey = deviceId + key;

            locks.TryAdd(lockKey, new ReaderWriterLockSlim());
            var thisLock = locks[lockKey];

            thisLock.EnterWriteLock();
            var    data = GenericData.GetPlayerData(deviceId, key);
            double val  = 0;

            Double.TryParse(data.ToString(), out val);
            val += changeAmount;
            GenericData.SetPlayerData(deviceId, key, val.ToString(), expirationTimer);
            thisLock.ExitWriteLock();

            if (thisLock.WaitingWriteCount == 0)
            {
                locks.TryRemove(lockKey, out thisLock);
            }

            pt.Stop();
        }