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>
|
|
|
|
{
|
2015-04-16 08:50:19 +02:00
|
|
|
public DownloadClientConfigModule(IConfigService configService,
|
|
|
|
RootFolderValidator rootFolderValidator,
|
|
|
|
PathExistsValidator pathExistsValidator,
|
|
|
|
MappedNetworkDriveValidator mappedNetworkDriveValidator)
|
2014-02-16 12:56:12 +03:00
|
|
|
: 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)
|
2015-04-16 08:50:19 +02:00
|
|
|
.SetValidator(mappedNetworkDriveValidator)
|
2014-02-16 12:56:12 +03:00
|
|
|
.SetValidator(pathExistsValidator)
|
|
|
|
.When(c => !String.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|