2015-12-20 01:18:22 +00:00
using System.ComponentModel ;
using FluentValidation ;
using Newtonsoft.Json ;
2014-05-13 17:57:46 +00:00
using NzbDrone.Core.Annotations ;
using NzbDrone.Core.ThingiProvider ;
2015-03-17 04:33:34 +00:00
using NzbDrone.Core.Validation ;
2014-05-13 17:57:46 +00:00
using NzbDrone.Core.Validation.Paths ;
2016-02-14 16:55:32 +00:00
namespace NzbDrone.Core.Download.Clients.Blackhole
2014-05-13 17:57:46 +00:00
{
public class TorrentBlackholeSettingsValidator : AbstractValidator < TorrentBlackholeSettings >
{
public TorrentBlackholeSettingsValidator ( )
{
//Todo: Validate that the path actually exists
RuleFor ( c = > c . TorrentFolder ) . IsValidPath ( ) ;
}
}
public class TorrentBlackholeSettings : IProviderConfig
{
2015-12-20 01:18:22 +00:00
public TorrentBlackholeSettings ( )
{
ReadOnly = true ;
}
2015-03-17 04:33:34 +00:00
private static readonly TorrentBlackholeSettingsValidator Validator = new TorrentBlackholeSettingsValidator ( ) ;
2014-05-13 17:57:46 +00:00
2015-03-10 21:00:47 +00:00
[FieldDefinition(0, Label = "Torrent Folder", Type = FieldType.Path, HelpText = "Folder in which Sonarr will store the .torrent file")]
2015-10-03 17:45:26 +00:00
public string TorrentFolder { get ; set ; }
2014-05-13 17:57:46 +00:00
2015-03-10 21:00:47 +00:00
[FieldDefinition(1, Label = "Watch Folder", Type = FieldType.Path, HelpText = "Folder from which Sonarr should import completed downloads")]
2015-10-03 17:45:26 +00:00
public string WatchFolder { get ; set ; }
2014-05-13 17:57:46 +00:00
2015-12-20 01:18:22 +00:00
[DefaultValue(false)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
[FieldDefinition(2, Label = "Read Only", Type = FieldType.Checkbox, HelpText = "Instead of moving files this will instruct Sonarr to Copy or Hardlink (depending on settings/system configuration)")]
public bool ReadOnly { get ; set ; }
2015-03-17 04:33:34 +00:00
public NzbDroneValidationResult Validate ( )
2014-05-13 17:57:46 +00:00
{
2015-03-17 04:33:34 +00:00
return new NzbDroneValidationResult ( Validator . Validate ( this ) ) ;
2014-05-13 17:57:46 +00:00
}
}
}