Beispiel #1
0
 int CompareRatings(SummonerRating x, SummonerRating y)
 {
     int output = x.Map.CompareTo(y.Map);
     if (output == 0)
         return x.GameMode.CompareTo(y.GameMode);
     else
         return output;
 }
Beispiel #2
0
 List<SummonerRating> GetSummonerRatings(Summoner summoner, DbConnection connection)
 {
     using (var select = Command("select {0} from summoner_rating where summoner_id = :summoner_id", connection, SummonerRating.GetFields()))
     {
         select.Set("summoner_id", summoner.Id);
         using (var reader = select.ExecuteReader())
         {
             List<SummonerRating> output = new List<SummonerRating>();
             while (reader.Read())
             {
                 SummonerRating rating = new SummonerRating(reader);
                 output.Add(rating);
             }
             return output;
         }
     }
 }
Beispiel #3
0
 void LoadSummonerRating(Summoner summoner, NpgsqlConnection database)
 {
     DatabaseCommand select = GetCommand("select {0} from summoner_rating where summoner_id = :summoner_id", database, SummonerRating.GetFields());
     select.Set("summoner_id", summoner.Id);
     using (NpgsqlDataReader reader = select.ExecuteReader())
     {
         while (reader.Read())
         {
             SummonerRating rating = new SummonerRating(reader);
             summoner.Ratings.Add(rating);
             Dictionary<GameModeType, SummonerRating> dictionary;
             if (!summoner.RatingDictionary.TryGetValue(rating.Map, out dictionary))
             {
                 dictionary = new Dictionary<GameModeType, SummonerRating>();
                 summoner.RatingDictionary[rating.Map] = dictionary;
             }
             dictionary[rating.GameMode] = rating;
         }
         summoner.Ratings.Sort(CompareRatings);
     }
 }