Ejemplo n.º 1
0
        public bool EncryptUserPassword(string deviceId, string password)
        {
            var options = new CrypterOptions()
            {
                { CrypterOption.Rounds, Configuration["PasswordRounds"] }
            };
            BlowfishCrypter crypter = new BlowfishCrypter();
            var             salt    = crypter.GenerateSalt(options);
            var             results = crypter.Crypt(password, salt);

            GenericData.SetPlayerData(deviceId, "password", results);
            return(true);
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
 public bool SetPlayerData(string deviceId, string key, string value, double?expiresIn = null)
 {
     return(GenericData.SetPlayerData(deviceId, key, value, expiresIn));
 }