Exemplo n.º 1
0
        public AuthAccountInfo FindAccount(string authString)
        {
            string ascii = AuthStringToAscii(authString);

            LogThread.Log("Checking auth cache for: " + ascii, NetworkCore.LogInterface.LogMessageType.Normal);
            if (_accounts.ContainsKey(authString))
            {
                AuthAccountInfo aai = _accounts[authString];
                aai.Timestamp = DateTime.Now.Ticks;
                LogThread.Log("Authstring found for account: " + aai.AccountID, NetworkCore.LogInterface.LogMessageType.Normal);
                return(aai);
            }

            LogThread.Log(string.Format("Authstring {0} not found in the local cache", ascii), NetworkCore.LogInterface.LogMessageType.System);
            return(null);
        }
Exemplo n.º 2
0
        public void RegisterAuthString(string authString, int accountId, int hardCurrency, int vip, string displayName)
        {
            if (_accounts.Count > MAX_CACHED_ACCOUNTS)
            {
                int preDump = _accounts.Count;
                // Dump accounts that are a day old or more
                DumpAccounts(24 * 60 * 60);

                LogInterface.Log(string.Format("Dumping cached accounts: ({0}) -> ({1})", preDump, _accounts.Count), LogInterface.LogMessageType.System, true);
            }

            AuthAccountInfo aai = new AuthAccountInfo();

            aai.AccountID         = accountId;
            aai.HardCurrency      = hardCurrency;
            aai.Vip               = vip;
            aai.Timestamp         = DateTime.Now.Ticks;
            aai.DisplayName       = displayName;
            _accounts[authString] = aai;
        }