public void GetPlayerData(string deviceId, string key) { var data = GenericData.GetPlayerData(deviceId, key); Response.BodyWriter.WriteAsync(data); Response.CompleteAsync(); return; }
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); }
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(); }