예제 #1
0
        public static ChampionAliasMap Load(string filePath)
        {
            var result  = new ChampionAliasMap();
            var aliases = JsonConvert.DeserializeObject <Dictionary <string, string[]> >(File.ReadAllText(filePath));

            foreach (var entry in aliases)
            {
                result.AddByChampion(entry.Key, entry.Value);
            }
            return(result);
        }
예제 #2
0
 public void FindMentions(HashSet <string> champions, ChampionAliasMap championAliases)
 {
     foreach (var champion in champions)
     {
         var aliases = championAliases.GetByChampion(champion);
         foreach (var alias in aliases)
         {
             var message = Content.ToLower();
             if (message.Contains(alias))
             {
                 AddReferredChampion(champion);
             }
         }
     }
 }
예제 #3
0
 public MessageCollection()
 {
     Messages = new List <Message>();
     _aliases = ChampionAliasMap.Load("champion-aliases.json");
 }