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

21 lines
537 B

using System;
using FluentValidation.Validators;
namespace NzbDrone.Core.Validation
{
public class GuidValidator : PropertyValidator
{
protected override string GetDefaultMessageTemplate() => "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);
}
}
}