1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-28 23:16:32 -04:00
Files
Sonarr/src/NzbDrone.Core/Notifications/CustomScript/CustomScriptSettings.cs
T

34 lines
1.1 KiB
C#

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();
RuleFor(c => c.Arguments).Empty().WithMessage("Arguments are no longer supported for custom scripts");
}
}
public class CustomScriptSettings : IProviderConfig
{
private static readonly CustomScriptSettingsValidator Validator = new CustomScriptSettingsValidator();
[FieldDefinition(0, Label = "Path", Type = FieldType.FilePath)]
public string Path { get; set; }
[FieldDefinition(1, Label = "Arguments", HelpText = "Arguments to pass to the script", Hidden = HiddenType.HiddenIfNotSet)]
public string Arguments { get; set; }
public NzbDroneValidationResult Validate()
{
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}