public Exception ValidateValue(
     string value, string locationName, LocationKind locationKind, LocationValidationContext context) =>
 value == "latest" || Version.TryParse(value, out _)
         ? null
         : CreateArgumentException(value, locationName, locationKind);
Esempio n. 2
0
 public Exception ValidateValue(
     string value, string locationName, LocationKind locationKind, LocationValidationContext context) =>
 value == null || !string.IsNullOrEmpty(value.Trim())
         ? null
         : CreateArgumentException(value, locationName, locationKind);
Esempio n. 3
0
 public Exception ValidateValue(float value, string locationName, LocationKind locationKind, LocationValidationContext context)
 {
     if (value < 0)
     {
         return(new ArgumentOutOfRangeException(locationName, value, "Значение не может быть меньше 0."));
     }
     return(null);
 }
Esempio n. 4
0
        public Exception ValidateValue(float value, string locationName, LocationKind locationKind, LocationValidationContext context)
        {
            if (value < 0)
            {
                return(new ArgumentOutOfRangeException($"Значение {locationName} не может быть отрицательным."));
            }

            return(null);
        }
Esempio n. 5
0
 public Exception ValidateValue(Rectangle value, string locationName, LocationKind locationKind, LocationValidationContext context)
 {
     if (value.Size == Point.Zero)
     {
         return(new ArgumentOutOfRangeException($"The size of {value} must not be 0."));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 6
0
 public Exception ValidateValue(Point value, string locationName, LocationKind locationKind, LocationValidationContext context)
 {
     if (value == Point.Zero)
     {
         return(new ArgumentOutOfRangeException($"The coordinates for {locationName} must not be (0, 0)."));
     }
     else
     {
         return(null);
     }
 }