Exemple #1
0
 /// <summary>
 /// Validates a value to the specified format.
 /// </summary>
 /// <param name="value">The value to validate.</param>
 /// <returns>True if the value is valid, otherwise false.</returns>
 public bool Validate(string value)
 {
     if (ValidationRegex == null)
     {
         return(ValidationFunction == null || ValidationFunction(value));
     }
     return(ValidationRegex.IsMatch(value));
 }
 public void ValidateText(string text)
 {
     if (ValidationRegex != null)
     {
         bool match = ValidationRegex.IsMatch(text);
         ShowCautionImage = !match;
     }
 }
Exemple #3
0
        /// <inheritdoc />
        protected override StringValueNode ParseValue(string runtimeValue)
        {
            if (!ValidationRegex.IsMatch(runtimeValue))
            {
                throw ThrowHelper.HslaType_ParseValue_IsInvalid(this);
            }

            return(base.ParseValue(runtimeValue));
        }
Exemple #4
0
        /// <inheritdoc />
        protected override string ParseLiteral(StringValueNode valueSyntax)
        {
            if (!ValidationRegex.IsMatch(valueSyntax.Value))
            {
                throw ThrowHelper.HslaType_ParseLiteral_IsInvalid(this);
            }

            return(base.ParseLiteral(valueSyntax));
        }
Exemple #5
0
 /// <summary>
 /// Validates a value to the specified format.
 /// </summary>
 /// <param name="value">The value to validate.</param>
 /// <returns>True if the value is valid, otherwise false.</returns>
 public bool Validate(JsonValue value)
 {
     return(ValidationRegex == null || value.Type != JsonValueType.String
                         ? ValidationFunction == null || ValidationFunction(value)
                         : ValidationRegex.IsMatch(value.String));
 }