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.
44 lines
1.2 KiB
44 lines
1.2 KiB
3 years ago
|
using FluentValidation;
|
||
|
using NzbDrone.Core.Annotations;
|
||
|
using NzbDrone.Core.Validation;
|
||
|
|
||
|
namespace NzbDrone.Core.IndexerProxies.Socks4
|
||
|
{
|
||
|
public class Socks4SettingsValidator : AbstractValidator<Socks4Settings>
|
||
|
{
|
||
|
public Socks4SettingsValidator()
|
||
|
{
|
||
|
RuleFor(c => c.Host).NotEmpty();
|
||
|
RuleFor(c => c.Port).NotEmpty();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public class Socks4Settings : IIndexerProxySettings
|
||
|
{
|
||
|
private static readonly Socks4SettingsValidator Validator = new Socks4SettingsValidator();
|
||
|
|
||
|
public Socks4Settings()
|
||
|
{
|
||
|
Username = "";
|
||
|
Password = "";
|
||
|
}
|
||
|
|
||
|
[FieldDefinition(0, Label = "Host")]
|
||
|
public string Host { get; set; }
|
||
|
|
||
|
[FieldDefinition(1, Label = "Port")]
|
||
|
public int Port { get; set; }
|
||
|
|
||
|
[FieldDefinition(2, Label = "Username", Privacy = PrivacyLevel.UserName)]
|
||
|
public string Username { get; set; }
|
||
|
|
||
|
[FieldDefinition(3, Label = "Password", Type = FieldType.Password, Privacy = PrivacyLevel.Password)]
|
||
|
public string Password { get; set; }
|
||
|
|
||
|
public NzbDroneValidationResult Validate()
|
||
|
{
|
||
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||
|
}
|
||
|
}
|
||
|
}
|