void AddUse(ulong userID, string commandName) { if (!storedData.MaxUses.ContainsKey(userID)) { storedData.MaxUses.Add(userID, new List <MaxUses>()); } var foundUses = storedData.MaxUses[userID].SingleOrDefault(x => x.CommandName.ToLower() == commandName.ToLower()); if (foundUses != null) { foundUses.Uses++; return; } var maxUses = new MaxUses(commandName, 1); storedData.MaxUses[userID].Add(maxUses); SaveData(); }
void AddUse(ulong userID, string commandName) { if (!storedData.MaxUses.ContainsKey(userID)) { storedData.MaxUses.Add(userID, new List <MaxUses>()); } var search = storedData.MaxUses[userID].Where(x => x.CommandName.ToLower() == commandName.ToLower()); if (search.Any()) { search.First().Uses++; SaveData(); return; } var maxUses = new MaxUses(commandName, 1); storedData.MaxUses[userID].Add(maxUses); SaveData(); }