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.
24 lines
542 B
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);
|
|
}
|
|
}
|
|
}
|