You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Lidarr/src/NzbDrone.Core/Validation/GuidValidator.cs

24 lines
542 B

using System;
using FluentValidation.Validators;
namespace NzbDrone.Core.Validation
{
public class GuidValidator : PropertyValidator
{
public GuidValidator()
: base("String is not a valid Guid")
{
}
protected override bool IsValid(PropertyValidatorContext context)
{
if (context.PropertyValue == null)
{
return false;
}
return Guid.TryParse(context.PropertyValue.ToString(), out Guid guidOutput);
}
}
}