fCraft.PlayerDB.RemoveInactivePlayers C# (CSharp) Method

RemoveInactivePlayers() static private method

static private RemoveInactivePlayers ( ) : int
return int
        internal static int RemoveInactivePlayers() {
            int count = 0;
            lock( AddLocker ) {
                playersByIP = new Dictionary<IPAddress, List<PlayerInfo>>();
                PlayerInfo[] playerInfoListCache = PlayerInfoList;
                for( int i = 0; i < playerInfoListCache.Length; i++ ) {
                    if( !playersByIP.ContainsKey( playerInfoListCache[i].LastIP ) ) {
                        playersByIP[playerInfoListCache[i].LastIP] = new List<PlayerInfo>();
                    }
                    playersByIP[playerInfoListCache[i].LastIP].Add( PlayerInfoList[i] );
                }
                foreach( PlayerInfo p in playerInfoListCache.Where( p => PlayerIsInactive( p, true ) ) ) {
                    Trie.Remove( p.Name );
                    List.Remove( p );
                    count++;
                }
                List.TrimExcess();
                UpdateCache();
                playersByIP = null;
            }
            return count;
        }