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
|
|
|
|
|
2014-04-19 15:09:22 +00:00
|
|
|
|
namespace NzbDrone.Core.Download.Clients.Pneumatic
|
2014-02-14 05:31:49 +00:00
|
|
|
|
{
|
2014-05-25 21:58:41 +00:00
|
|
|
|
public class PneumaticSettingsValidator : AbstractValidator<PneumaticSettings>
|
2014-02-14 05:31:49 +00:00
|
|
|
|
{
|
2014-05-25 21:58:41 +00:00
|
|
|
|
public PneumaticSettingsValidator()
|
2014-02-14 05:31:49 +00:00
|
|
|
|
{
|
2014-02-16 09:56:12 +00:00
|
|
|
|
//Todo: Validate that the path actually exists
|
2014-05-25 21:58:41 +00:00
|
|
|
|
RuleFor(c => c.NzbFolder).IsValidPath();
|
2014-02-14 05:31:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-25 21:58:41 +00:00
|
|
|
|
public class PneumaticSettings : IProviderConfig
|
2014-02-14 05:31:49 +00:00
|
|
|
|
{
|
2014-05-25 21:58:41 +00:00
|
|
|
|
private static readonly PneumaticSettingsValidator Validator = new PneumaticSettingsValidator();
|
2014-02-14 05:31:49 +00:00
|
|
|
|
|
2014-05-25 21:58:41 +00:00
|
|
|
|
[FieldDefinition(0, Label = "Nzb Folder", Type = FieldType.Path)]
|
|
|
|
|
public String NzbFolder { get; set; }
|
2014-02-14 05:31:49 +00:00
|
|
|
|
|
|
|
|
|
public ValidationResult Validate()
|
|
|
|
|
{
|
|
|
|
|
return Validator.Validate(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|