2014-02-16 12:56:12 +03:00
|
|
|
using System;
|
|
|
|
using FluentValidation;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
using NzbDrone.Core.Validation.Paths;
|
|
|
|
|
|
|
|
namespace NzbDrone.Api.Config
|
|
|
|
{
|
|
|
|
public class DownloadClientConfigModule : NzbDroneConfigModule<DownloadClientConfigResource>
|
|
|
|
{
|
|
|
|
public DownloadClientConfigModule(IConfigService configService, RootFolderValidator rootFolderValidator, PathExistsValidator pathExistsValidator)
|
|
|
|
: base(configService)
|
2014-02-16 20:05:19 +03:00
|
|
|
{
|
2014-02-16 12:56:12 +03:00
|
|
|
SharedValidator.RuleFor(c => c.DownloadedEpisodesFolder)
|
2014-02-16 20:05:19 +03:00
|
|
|
.Cascade(CascadeMode.StopOnFirstFailure)
|
|
|
|
.IsValidPath()
|
2014-02-16 12:56:12 +03:00
|
|
|
.SetValidator(rootFolderValidator)
|
|
|
|
.SetValidator(pathExistsValidator)
|
|
|
|
.When(c => !String.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder));
|
2014-04-01 23:07:41 +03:00
|
|
|
|
2014-02-16 12:56:12 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|