/// <summary> /// Checks if the Account is allowed to login, removes the permission to login /// </summary> /// <param name="accountName">Name of the Account.</param> /// <param name="sessionId">SessionId to check for validity.</param> /// <returns></returns> public bool HasRegisteredAccountLogin(string accountName, long sessionId) { try { //return if the player has been registered bool successful = RegisteredAccountLogins.Remove(accountName); if (successful) { Logger.Log.DebugFormat("[WCF] Account {0} has lost the permission to login with SessionId {1}.", accountName, sessionId); } else { Logger.Log.DebugFormat("[WCF] Account {0} is not permitted to login with SessionId {1}.", accountName, sessionId); } return(successful); } catch (Exception ex) { Logger.Log.Error(ex.Message); } return(false); }
/// <summary> /// Register Account for Login (Verification for Security) /// </summary> /// <param name="accountName">Name of the Account</param> /// <param name="sessionId">SessionId for the valid connection.</param> public void RegisterAccountLogin(string accountName, long sessionId) { try { if (!RegisteredAccountLogins.ContainsKey(accountName)) { RegisteredAccountLogins.Add(accountName, sessionId); } else { RegisteredAccountLogins.Remove(accountName); RegisteredAccountLogins.Add(accountName, sessionId); } Logger.Log.DebugFormat("[WCF] Account {0} is now permitted to login with SessionId {1}", accountName, sessionId); } catch (Exception ex) { Logger.Log.Error(ex.Message); } }