コード例 #1
0
 public ByteArrayValidator(bool allowNull, int limit, BoundLimit type)
 {
     this.allowNull = allowNull;
     if (type == BoundLimit.Maximum)
     {
         this.minLength = 0;
         if (limit < 0)
         {
             this.maxLength = 0;
         }
         else
         {
             this.maxLength = limit;
         }
     }
     else
     {
         this.maxLength = int.MaxValue;
         if (limit < 0)
         {
             this.minLength = 0;
         }
         else
         {
             this.minLength = limit;
         }
     }
 }
コード例 #2
0
ファイル: Envelope2.cs プロジェクト: OSRS/Oncor_OsrsLegacy
 public T this[int dimension, BoundLimit boundEnd]
 {
     get
     {
         if (boundEnd == BoundLimit.Minimum)
         {
             if (dimension == 0)
             {
                 return(this.MinX);
             }
             else if (dimension == 1)
             {
                 return(this.MinY);
             }
         }
         else
         {
             if (dimension == 0)
             {
                 return(this.MaxX);
             }
             else if (dimension == 1)
             {
                 return(this.MaxY);
             }
         }
         throw new ArgumentOutOfRangeException();
     }
 }
コード例 #3
0
 public StringValidator(bool allowNull, int lengthLimit, BoundLimit BoundLimit)
 {
     this.allowNull = allowNull;
     if (BoundLimit == BoundLimit.Maximum)
     {
         this.maxLength = lengthLimit;
         this.minLength = 0;
     }
     else
     {
         this.minLength = lengthLimit;
         this.maxLength = int.MaxValue;
     }
 }
コード例 #4
0
 /// <summary>
 /// Creates a UInt64Validator instance with only a Minimum or a Maximum value.
 /// </summary>
 /// <param name="limit">ULong value to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public UInt64Validator(ulong limit, BoundLimit type)
 {
     if (type == BoundLimit.Maximum)
     {
         this.hasMax = true;
         this.max    = limit;
         this.hasMin = false;
     }
     else
     {
         this.hasMin = true;
         this.min    = limit;
         this.hasMax = false;
     }
 }
コード例 #5
0
 /// <summary>
 /// Creates a SingleValidator instance with only a Minimum or a Maximum value.
 /// </summary>
 /// <param name="limit">Float value to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public SingleValidator(float limit, BoundLimit type)
 {
     if (type == BoundLimit.Maximum)
     {
         this.hasMax = true;
         this.max    = limit;
         this.hasMin = false;
     }
     else
     {
         this.hasMin = true;
         this.min    = limit;
         this.hasMax = false;
     }
 }
コード例 #6
0
 /// <summary>
 /// Creates a Int16Validator instance with only a Minimum or a Maximum value.
 /// </summary>
 /// <param name="limit">Short to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public Int16Validator(short limit, BoundLimit type)
 {
     if (type == BoundLimit.Maximum)
     {
         this.hasMax = true;
         this.max    = limit;
         this.hasMin = false;
     }
     else
     {
         this.hasMin = true;
         this.min    = limit;
         this.hasMax = false;
     }
 }
コード例 #7
0
 /// <summary>
 /// Creates a DecimalValidator instance with only a Minimum or a Maximum value.
 /// </summary>
 /// <param name="limit">Decimal value to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public DecimalValidator(decimal limit, BoundLimit type)
 {
     if (type == BoundLimit.Maximum)
     {
         this.hasMax = true;
         this.max    = limit;
         this.hasMin = false;
     }
     else
     {
         this.hasMin = true;
         this.min    = limit;
         this.hasMax = false;
     }
 }
コード例 #8
0
 /// <summary>
 /// Creates a DateTimeValidator instance with only a Minimum or a Maximum value and without a DateTime Kind.
 /// </summary>
 /// <param name="limit">DateTime value to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public DateTimeValidator(DateTime limit, BoundLimit type)
 {
     this.hasKind = false;
     if (type == BoundLimit.Maximum)
     {
         this.hasMax = true;
         this.max    = limit;
         this.hasMin = false;
     }
     else
     {
         this.hasMin = true;
         this.min    = limit;
         this.hasMax = false;
     }
 }
コード例 #9
0
 /// <summary>
 /// Creates a TimeSpanValidator instance where the time interval value is set to the parameter provided and either the minimum or maximum time interval is established.
 /// </summary>
 /// <param name="allowZero">Value to be set as the time interval variable.</param>
 /// <param name="limit">Time interval value to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public TimeSpanValidator(bool allowZero, TimeSpan limit, BoundLimit type)
 {
     this.allowZero = allowZero;
     if (type == BoundLimit.Maximum)
     {
         this.hasMax = true;
         this.max    = limit;
         this.hasMin = false;
     }
     else
     {
         this.hasMin = true;
         this.min    = limit;
         this.hasMax = false;
     }
 }
コード例 #10
0
ファイル: EnvelopeN.cs プロジェクト: OSRS/Oncor_OsrsLegacy
 public T this[int dimension, BoundLimit boundEnd]
 {
     get
     {
         if (boundEnd == BoundLimit.Minimum)
         {
             if (dimension < this.ordinateMaxs.Length)
             {
                 return(this.ordinateMins[dimension]);
             }
         }
         else
         {
             if (dimension < this.ordinateMaxs.Length)
             {
                 return(this.ordinateMaxs[dimension]);
             }
         }
         throw new ArgumentOutOfRangeException();
     }
 }
コード例 #11
0
 public ByteArrayValidator(int limit, BoundLimit type)
     : this(false, limit, type)
 {
 }
コード例 #12
0
 public StringValidator(int lengthLimit, BoundLimit BoundLimit) : this(true, lengthLimit, BoundLimit)
 {
 }
コード例 #13
0
 /// <summary>
 /// Creates a TimeSpanValidator instance where a time interval must be greater than 0 (zero) and either the minimum or maximum time interval is established.
 /// </summary>
 /// <param name="limit">Time interval value to be set as the minimum or maximum value.</param>
 /// <param name="type">Type of limit, based on enumeration BoundLimit, to be set for this instance.</param>
 public TimeSpanValidator(TimeSpan limit, BoundLimit type) : this(false, limit, type)
 {
 }