Ejemplo n.º 1
0
        public void UpdateGameServerInfo(int id, GameServerInfo info, string endpoint)
        {
            var fields = new[]
            {
                Tuple.Create("name", (object)info.Name),
                Tuple.Create("game_modes", (object)string.Join(", ", info.GameModes)),
                Tuple.Create("endpoint", (object)endpoint)
            };
            var cmd = CreateUpdateQuery(Table.ServersInformation, id, fields);

            ExecuteQuery(cmd);
        }
Ejemplo n.º 2
0
 public void PutGameServerInfo(GameServerInfo info, string endpoint)
 {
     if (Cache.GameServersInformation.ContainsKey(endpoint))
     {
         database.UpdateGameServerInfo(Cache.GameServersInformation[endpoint], info, endpoint);
         Cache.GameServersStats[endpoint].Name = info.Name;
     }
     else
     {
         var id = database.InsertServerInformation(info, endpoint);
         Cache.GameServersInformation[endpoint]   = id;
         Cache.GameServersStats[endpoint]         = new GameServerStats(endpoint, info.Name);
         Cache.GameServersMatchesPerDay[endpoint] = new ConcurrentDictionary <DateTime, int>();
     }
     Cache.GameServersStats[endpoint].Info = info;
 }
Ejemplo n.º 3
0
        private void HandleServersInformationTable(Cache cache)
        {
            var rows = GetAllRows(Table.ServersInformation);

            foreach (var row in rows)
            {
                var id         = int.Parse(row[0]);
                var endpoint   = row[3];
                var serverInfo = new GameServerInfo(row[1], row[2]);
                cache.GameServersMatchesPerDay[endpoint] = new ConcurrentDictionary <DateTime, int>();
                cache.GameServersStats[endpoint]         = new GameServerStats(endpoint, serverInfo.Name)
                {
                    Info = serverInfo
                };
                cache.GameServersInformation[endpoint] = id;
            }
        }
Ejemplo n.º 4
0
 public int InsertServerInformation(GameServerInfo info, string endpoint)
 {
     InsertInto(Table.ServersInformation, info.Name, info.EncodeGameModes(), endpoint);
     return(tableRowsCount[Table.ServersInformation]);
 }