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); }
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(); }
public bool SetPlayerData(string deviceId, string key, string value, double?expiresIn = null) { return(GenericData.SetPlayerData(deviceId, key, value, expiresIn)); }