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.
31 lines
998 B
31 lines
998 B
using FluentValidation;
|
|
using FluentValidation.Results;
|
|
using NzbDrone.Core.Validation.Paths;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace NzbDrone.Core.Music
|
|
{
|
|
public interface IAddArtistValidator
|
|
{
|
|
ValidationResult Validate(Artist instance);
|
|
}
|
|
|
|
public class AddArtistValidator : AbstractValidator<Artist>, IAddArtistValidator
|
|
{
|
|
public AddArtistValidator(RootFolderValidator rootFolderValidator,
|
|
ArtistPathValidator artistPathValidator,
|
|
ArtistAncestorValidator artistAncestorValidator)
|
|
{
|
|
RuleFor(c => c.Path).Cascade(CascadeMode.StopOnFirstFailure)
|
|
.IsValidPath()
|
|
.SetValidator(rootFolderValidator)
|
|
.SetValidator(artistPathValidator)
|
|
.SetValidator(artistAncestorValidator);
|
|
|
|
}
|
|
}
|
|
}
|