public bool Equals(IPAddressRange other) { if (other == null) return false; Contract.Assume(other._lowerBoundary != null); Contract.Assume(other._upperBoundary != null); return other.Family == Family && other._lowerBoundary.SequenceEqual(_lowerBoundary) && other._upperBoundary.SequenceEqual(_upperBoundary); }
public void CreateIPRangeBan(IPAddressRange range, string notes, DateTime? expiry) { var ban = BanManager.Instance.FindIPRangeBan(x => x.Range.Equals(range)); if (ban != null) throw new ArgumentException("IP range ban already exists."); BanManager.Instance.CreateIPRangeBan(range, notes, expiry); }
public void CreateIPRangeBan(IPAddressRange range, string notes, DateTime? expiry) { Contract.Requires(range != null); }
public void CreateIPRangeBan(IPAddressRange range, string notes, DateTime? expiry) { IPRangeBan ban = null; BanManager.Instance.PostWait(mgr => ban = mgr.FindIPRangeBan(x => x.Range.Equals(range))).Wait(); if (ban != null) throw new ArgumentException("IP range ban already exists."); BanManager.Instance.PostAsync(mgr => mgr.CreateIPRangeBan(range, notes, expiry)); }