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); }
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); } } } }
public MessageCollection() { Messages = new List <Message>(); _aliases = ChampionAliasMap.Load("champion-aliases.json"); }