mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
25 lines
1.1 KiB
C#
25 lines
1.1 KiB
C#
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,
|
|
MappedNetworkDriveValidator mappedNetworkDriveValidator)
|
|
: base(configService)
|
|
{
|
|
SharedValidator.RuleFor(c => c.DownloadedEpisodesFolder)
|
|
.Cascade(CascadeMode.StopOnFirstFailure)
|
|
.IsValidPath()
|
|
.SetValidator(rootFolderValidator)
|
|
.SetValidator(mappedNetworkDriveValidator)
|
|
.SetValidator(pathExistsValidator)
|
|
.When(c => !string.IsNullOrWhiteSpace(c.DownloadedEpisodesFolder));
|
|
}
|
|
}
|
|
} |