// ReSharper disable AutoPropertyCanBeMadeGetOnly.Local namespace IRCStates; public class Channel { public string Name { get; private set; } public string NameLower { get; private set; } public Dictionary Users { get; private set; } = new(); public string Topic { get; set; } public string TopicSetter { get; set; } public DateTime TopicTime { get; set; } public DateTime Created { get; set; } public Dictionary> ListModes { get; private set; } = []; public Dictionary Modes { get; private set; } = []; public override string ToString() => $"Channel(name={Name})"; public void SetName(string name, string nameLower) { Name = name; NameLower = nameLower; } public void AddMode(string ch, string param, bool listMode) { if (listMode) { if (!ListModes.ContainsKey(ch)) { ListModes[ch] = []; } if (!ListModes[ch].Contains(param)) { ListModes[ch].Add(param ?? string.Empty); } } else { Modes[ch] = param; } } public void RemoveMode(string ch, string param) { if (ListModes.ContainsKey(ch)) { if (!ListModes[ch].Contains(param)) { return; } ListModes[ch].Remove(param); if (!ListModes[ch].Any()) { ListModes.Remove(ch); } } else { Modes.Remove(ch); } } }