1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-23 22:25:14 -04:00

New: Add pushsafer notification service (#8770)

This commit is contained in:
Ricardo Christmann
2023-07-15 04:22:08 +02:00
committed by GitHub
parent 3055ed5336
commit f38077aac7
5 changed files with 271 additions and 0 deletions
@@ -73,5 +73,18 @@ namespace NzbDrone.Core.Validation
ruleBuilder.SetValidator(new NotEmptyValidator(null));
return ruleBuilder.SetValidator(new RegularExpressionValidator("radarr", RegexOptions.IgnoreCase)).WithMessage("Must contain Radarr");
}
public static IRuleBuilderOptions<T, string> ValidParsedStringRange<T>(this IRuleBuilder<T, string> ruleBuilder, int minValue, int maxValue)
{
return ruleBuilder.Must(x =>
{
if (int.TryParse(x, out var value))
{
return value >= minValue && value <= maxValue;
}
return false;
}).WithMessage($"Must be greater than or equal to '{minValue}' and less than or equal to '{maxValue}'");
}
}
}