コード例 #1
0
ファイル: IPAddressRange.cs プロジェクト: madbroths/Encore
        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);
        }
コード例 #2
0
ファイル: AccountService.cs プロジェクト: madbroths/Encore
        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);
        }
コード例 #3
0
 public void CreateIPRangeBan(IPAddressRange range, string notes, DateTime? expiry)
 {
     Contract.Requires(range != null);
 }
コード例 #4
0
ファイル: AccountService.cs プロジェクト: hanson-huang/Encore
        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));
        }