public static void AddServerToCache(string server, ServerInfo si, CacheItemPolicy cip)
        {
            if (si != null && si.port != 0)
            {

                //ServerInfo si = alo.result.serverInfos[server];

                if (si.players != null)
                {
                    if (si.players.Count > 2)
                    {
                        si.normalTeamGame = checkIfTeamGame(si);
                    }

                    if (si.normalTeamGame)
                    {
                        si.players.Sort(PlayersSort.TeamSort);

                    }
                    else
                    {
                        si.players.Sort(PlayersSort.ScoreSort);
                    }

                }
                oc.Set(server, si, cip);
            } //or maxplayers == -1 or numPlayers, etc
            else
            {
                Debug.WriteLine("[{0}] {1} \t No response", DateTime.Now, server);
            }

            //string id = Ext.CreateReadableID(server, si.hostPlayer);
            //context.Clients.All.addServer(id, server, si);
        }
 public void Update(ServerInfo newSI)
 {
     if (newSI.players != null)
     {
         players = newSI.players;
     }
     //this will change more frequently
     this.numPlayers = newSI.numPlayers;
     //this will change often
     map = newSI.map;
     this.mapFile = newSI.mapFile;
     this.normalTeamGame = newSI.normalTeamGame;
     this.variant = newSI.variant;
     this.variantType = newSI.variantType;
     this.status = newSI.status;
     //these will probably not change often between the same servers, unless it becomes passworded
     this.maxPlayers = newSI.maxPlayers;
     this.xnkid = newSI.xnkid;
     this.xnadr = newSI.xnadr;
     this.passworded = newSI.passworded;
     name = newSI.name;
     port = newSI.port;
     hostPlayer = newSI.hostPlayer;
     this.eldewritoVersion = newSI.eldewritoVersion;
     this.gameVersion = newSI.gameVersion;
     this.isActive = newSI.isActive;
 }
 private static bool checkIfTeamGame(ServerInfo si)
 {
     foreach (PlayerInfo pi in si.players)
     {
         if (pi.team > 1)
         {
             return false;
         }
     }
     return true;
 }