private bool RangeBan(GUIButton button, object obj) { BannedPlayer banned = obj as BannedPlayer; if (banned == null) { return(false); } banned.IP = ToRange(banned.IP); BannedPlayer bp; while ((bp = bannedPlayers.Find(x => banned.CompareTo(x.IP))) != null) { //remove all specific bans that are now covered by the rangeban bannedPlayers.Remove(bp); } bannedPlayers.Add(banned); Save(); if (banFrame != null) { banFrame.Parent.RemoveChild(banFrame); CreateBanFrame(banFrame.Parent); } return(true); }
private void RangeBan(BannedPlayer banned) { banned.EndPoint = ToRange(banned.EndPoint); BannedPlayer bp; while ((bp = bannedPlayers.Find(x => banned.CompareTo(x.EndPoint))) != null) { //remove all specific bans that are now covered by the rangeban bannedPlayers.Remove(bp); } bannedPlayers.Add(banned); Save(); }