2014-02-14 05:31:49 +00:00
|
|
|
|
using System;
|
|
|
|
|
using FluentValidation;
|
|
|
|
|
using FluentValidation.Results;
|
2014-02-16 09:56:12 +00:00
|
|
|
|
using NzbDrone.Common.Disk;
|
2014-02-14 05:31:49 +00:00
|
|
|
|
using NzbDrone.Core.Annotations;
|
|
|
|
|
using NzbDrone.Core.ThingiProvider;
|
2014-02-16 09:56:12 +00:00
|
|
|
|
using NzbDrone.Core.Validation.Paths;
|
2014-02-14 05:31:49 +00:00
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Download.Clients
|
|
|
|
|
{
|
|
|
|
|
public class FolderSettingsValidator : AbstractValidator<FolderSettings>
|
|
|
|
|
{
|
|
|
|
|
public FolderSettingsValidator()
|
|
|
|
|
{
|
2014-02-16 09:56:12 +00:00
|
|
|
|
//Todo: Validate that the path actually exists
|
|
|
|
|
RuleFor(c => c.Folder).IsValidPath();
|
2014-02-14 05:31:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class FolderSettings : IProviderConfig
|
|
|
|
|
{
|
|
|
|
|
private static readonly FolderSettingsValidator Validator = new FolderSettingsValidator();
|
|
|
|
|
|
|
|
|
|
[FieldDefinition(0, Label = "Folder", Type = FieldType.Path)]
|
|
|
|
|
public String Folder { get; set; }
|
|
|
|
|
|
|
|
|
|
public ValidationResult Validate()
|
|
|
|
|
{
|
|
|
|
|
return Validator.Validate(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|