You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
using System;
|
|
using FluentValidation;
|
|
using NzbDrone.Core.Annotations;
|
|
using NzbDrone.Core.ThingiProvider;
|
|
using NzbDrone.Core.Validation;
|
|
using NzbDrone.Core.Validation.Paths;
|
|
|
|
namespace NzbDrone.Core.Notifications.CustomScript
|
|
{
|
|
public class CustomScriptSettingsValidator : AbstractValidator<CustomScriptSettings>
|
|
{
|
|
public CustomScriptSettingsValidator()
|
|
{
|
|
RuleFor(c => c.Path).IsValidPath();
|
|
}
|
|
}
|
|
|
|
public class CustomScriptSettings : IProviderConfig
|
|
{
|
|
private static readonly CustomScriptSettingsValidator Validator = new CustomScriptSettingsValidator();
|
|
|
|
[FieldDefinition(0, Label = "Path", Type = FieldType.Path)]
|
|
public String Path { get; set; }
|
|
|
|
[FieldDefinition(0, Label = "Arguments", HelpText = "Arguments to pass to the script")]
|
|
public String Arguments { get; set; }
|
|
|
|
public NzbDroneValidationResult Validate()
|
|
{
|
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
|
}
|
|
}
|
|
}
|