diff --git a/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs b/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs index 55d170bfc..3006c6b36 100644 --- a/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs +++ b/src/NzbDrone.Core.Test/IndexerTests/TestIndexerSettings.cs @@ -1,12 +1,12 @@ using System; -using FluentValidation.Results; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Test.IndexerTests { public class TestIndexerSettings : IProviderConfig { - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { throw new NotImplementedException(); } diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs index 12aedb38c..c7cb5b0a1 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Download.Clients.Deluge { @@ -19,7 +19,7 @@ public DelugeSettingsValidator() public class DelugeSettings : IProviderConfig { - private static readonly DelugeSettingsValidator validator = new DelugeSettingsValidator(); + private static readonly DelugeSettingsValidator Validator = new DelugeSettingsValidator(); public DelugeSettings() { @@ -53,9 +53,9 @@ public DelugeSettings() [FieldDefinition(7, Label = "Use SSL", Type = FieldType.Checkbox)] public Boolean UseSsl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs index 00ce58d44..f9f108bb6 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs @@ -1,10 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; -using NzbDrone.Core.Validation.Paths; namespace NzbDrone.Core.Download.Clients.Nzbget { @@ -58,9 +56,9 @@ public NzbgetSettings() [FieldDefinition(7, Label = "Use SSL", Type = FieldType.Checkbox)] public Boolean UseSsl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/Pneumatic/PneumaticSettings.cs b/src/NzbDrone.Core/Download/Clients/Pneumatic/PneumaticSettings.cs index c0a400559..c9aa3fde0 100644 --- a/src/NzbDrone.Core/Download/Clients/Pneumatic/PneumaticSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Pneumatic/PneumaticSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; using NzbDrone.Core.Validation.Paths; namespace NzbDrone.Core.Download.Clients.Pneumatic @@ -26,9 +26,9 @@ public class PneumaticSettings : IProviderConfig [FieldDefinition(1, Label = "Strm Folder", Type = FieldType.Path, HelpText = ".strm files in this folder will be import by drone")] public String StrmFolder { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs index c5d8e1e84..0a8e556f6 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/SabnzbdSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -72,9 +71,9 @@ public SabnzbdSettings() [FieldDefinition(8, Label = "Use SSL", Type = FieldType.Checkbox)] public Boolean UseSsl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs index ba7041574..4a80b2d63 100644 --- a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs @@ -1,8 +1,8 @@ using FluentValidation; using System; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; using NzbDrone.Core.Validation.Paths; namespace NzbDrone.Core.Download.Clients.TorrentBlackhole @@ -18,7 +18,7 @@ public TorrentBlackholeSettingsValidator() public class TorrentBlackholeSettings : IProviderConfig { - private static readonly TorrentBlackholeSettingsValidator validator = new TorrentBlackholeSettingsValidator(); + private static readonly TorrentBlackholeSettingsValidator Validator = new TorrentBlackholeSettingsValidator(); [FieldDefinition(0, Label = "Torrent Folder", Type = FieldType.Path, HelpText = "Folder in which Sonarr will store the .torrent file")] public String TorrentFolder { get; set; } @@ -26,9 +26,9 @@ public class TorrentBlackholeSettings : IProviderConfig [FieldDefinition(1, Label = "Watch Folder", Type = FieldType.Path, HelpText = "Folder from which Sonarr should import completed downloads")] public String WatchFolder { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs index 0eb21b4e8..3989aa790 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Download.Clients.Transmission { @@ -19,7 +19,7 @@ public TransmissionSettingsValidator() public class TransmissionSettings : IProviderConfig { - private static readonly TransmissionSettingsValidator validator = new TransmissionSettingsValidator(); + private static readonly TransmissionSettingsValidator Validator = new TransmissionSettingsValidator(); public TransmissionSettings() { @@ -54,9 +54,9 @@ public TransmissionSettings() [FieldDefinition(8, Label = "Use SSL", Type = FieldType.Checkbox)] public Boolean UseSsl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/UsenetBlackhole/UsenetBlackholeSettings.cs b/src/NzbDrone.Core/Download/Clients/UsenetBlackhole/UsenetBlackholeSettings.cs index 62aa1ac1b..d587689ed 100644 --- a/src/NzbDrone.Core/Download/Clients/UsenetBlackhole/UsenetBlackholeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/UsenetBlackhole/UsenetBlackholeSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; using NzbDrone.Core.Validation.Paths; namespace NzbDrone.Core.Download.Clients.UsenetBlackhole @@ -26,9 +26,9 @@ public class UsenetBlackholeSettings : IProviderConfig [FieldDefinition(1, Label = "Watch Folder", Type = FieldType.Path, HelpText = "Folder from which Sonarr should import completed downloads")] public String WatchFolder { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs index 496939f89..4647a5076 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrentSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Download.Clients.UTorrent { @@ -18,7 +18,7 @@ public UTorrentSettingsValidator() public class UTorrentSettings : IProviderConfig { - private static readonly UTorrentSettingsValidator validator = new UTorrentSettingsValidator(); + private static readonly UTorrentSettingsValidator Validator = new UTorrentSettingsValidator(); public UTorrentSettings() { @@ -48,9 +48,9 @@ public UTorrentSettings() [FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(UTorrentPriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")] public Int32 OlderTvPriority { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs index 27c64c70e..60233f963 100644 --- a/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs +++ b/src/NzbDrone.Core/Indexers/BitMeTv/BitMeTvSettings.cs @@ -1,7 +1,6 @@ using System; using System.Text.RegularExpressions; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -27,7 +26,7 @@ public BitMeTvSettingsValidator() public class BitMeTvSettings : IProviderConfig { - private static readonly BitMeTvSettingsValidator validator = new BitMeTvSettingsValidator(); + private static readonly BitMeTvSettingsValidator Validator = new BitMeTvSettingsValidator(); public BitMeTvSettings() { @@ -46,9 +45,9 @@ public BitMeTvSettings() [FieldDefinition(3, Label = "Cookie", HelpText = "BitMeTv uses a login cookie needed to access the rss, you'll have to retrieve it via a browser.")] public String Cookie { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs index 3937055c0..49745f7fd 100644 --- a/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs +++ b/src/NzbDrone.Core/Indexers/BroadcastheNet/BroadcastheNetSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -18,7 +17,7 @@ public BroadcastheNetSettingsValidator() public class BroadcastheNetSettings : IProviderConfig { - private static readonly BroadcastheNetSettingsValidator validator = new BroadcastheNetSettingsValidator(); + private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator(); public BroadcastheNetSettings() { @@ -31,9 +30,9 @@ public BroadcastheNetSettings() [FieldDefinition(1, Label = "API Key")] public String ApiKey { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs b/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs index 64be09f2f..795e66f32 100644 --- a/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs +++ b/src/NzbDrone.Core/Indexers/Eztv/EztvSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -17,7 +16,7 @@ public EztvSettingsValidator() public class EztvSettings : IProviderConfig { - private static readonly EztvSettingsValidator validator = new EztvSettingsValidator(); + private static readonly EztvSettingsValidator Validator = new EztvSettingsValidator(); public EztvSettings() { @@ -27,9 +26,9 @@ public EztvSettings() [FieldDefinition(0, Label = "Website URL", HelpText = "Enter to URL to an EZTV compatible RSS feed")] public String BaseUrl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs b/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs index 40b58291a..5586b9f8b 100644 --- a/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs +++ b/src/NzbDrone.Core/Indexers/Fanzub/FanzubSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -17,7 +16,7 @@ public FanzubSettingsValidator() public class FanzubSettings : IProviderConfig { - private static readonly FanzubSettingsValidator validator = new FanzubSettingsValidator(); + private static readonly FanzubSettingsValidator Validator = new FanzubSettingsValidator(); public FanzubSettings() { @@ -27,9 +26,9 @@ public FanzubSettings() [FieldDefinition(0, Label = "Rss URL", HelpText = "Enter to URL to an Fanzub compatible RSS feed")] public String BaseUrl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs index 08695eecc..5326dc537 100644 --- a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs +++ b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs @@ -1,7 +1,6 @@ using System; using System.Text.RegularExpressions; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Common.Extensions; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; @@ -25,7 +24,7 @@ public IPTorrentsSettingsValidator() public class IPTorrentsSettings : IProviderConfig { - private static readonly IPTorrentsSettingsValidator validator = new IPTorrentsSettingsValidator(); + private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator(); public IPTorrentsSettings() { @@ -34,9 +33,9 @@ public IPTorrentsSettings() [FieldDefinition(0, Label = "Feed URL", HelpText = "The full RSS feed url generated by IPTorrents, using only the categories you selected (HD, SD, x264, etc ...)")] public String Url { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/KickassTorrents/KickassTorrentsSettings.cs b/src/NzbDrone.Core/Indexers/KickassTorrents/KickassTorrentsSettings.cs index 2edaeca3b..7202799fb 100644 --- a/src/NzbDrone.Core/Indexers/KickassTorrents/KickassTorrentsSettings.cs +++ b/src/NzbDrone.Core/Indexers/KickassTorrents/KickassTorrentsSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -17,7 +16,7 @@ public KickassTorrentsSettingsValidator() public class KickassTorrentsSettings : IProviderConfig { - private static readonly KickassTorrentsSettingsValidator validator = new KickassTorrentsSettingsValidator(); + private static readonly KickassTorrentsSettingsValidator Validator = new KickassTorrentsSettingsValidator(); public KickassTorrentsSettings() { @@ -31,9 +30,9 @@ public KickassTorrentsSettings() [FieldDefinition(1, Label = "Verified Only", Type = FieldType.Checkbox, Advanced = true, HelpText = "By setting this to No you will likely get more junk and unconfirmed releases, so use it with caution.")] public Boolean VerifiedOnly { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs b/src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs index 62f18795b..f45baeb01 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/NewznabSettings.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Text.RegularExpressions; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Common.Extensions; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; @@ -54,7 +53,7 @@ public class NewznabSettings : IProviderConfig public NewznabSettings() { - Categories = new[] { 5030, 5040 }; + Categories = new[] {5030, 5040}; AnimeCategories = Enumerable.Empty(); } @@ -64,18 +63,21 @@ public NewznabSettings() [FieldDefinition(1, Label = "API Key")] public String ApiKey { get; set; } - [FieldDefinition(2, Label = "Categories", HelpText = "Comma Separated list, leave blank to disable standard/daily shows", Advanced = true)] + [FieldDefinition(2, Label = "Categories", + HelpText = "Comma Separated list, leave blank to disable standard/daily shows", Advanced = true)] public IEnumerable Categories { get; set; } - [FieldDefinition(3, Label = "Anime Categories", HelpText = "Comma Separated list, leave blank to disable anime", Advanced = true)] + [FieldDefinition(3, Label = "Anime Categories", HelpText = "Comma Separated list, leave blank to disable anime", + Advanced = true)] public IEnumerable AnimeCategories { get; set; } - [FieldDefinition(4, Label = "Additional Parameters", HelpText = "Additional newznab parameters", Advanced = true)] + [FieldDefinition(4, Label = "Additional Parameters", HelpText = "Additional newznab parameters", Advanced = true + )] public String AdditionalParameters { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs index ddd80f27a..b080290e8 100644 --- a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs +++ b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -17,7 +16,7 @@ public NyaaSettingsValidator() public class NyaaSettings : IProviderConfig { - private static readonly NyaaSettingsValidator validator = new NyaaSettingsValidator(); + private static readonly NyaaSettingsValidator Validator = new NyaaSettingsValidator(); public NyaaSettings() { @@ -27,9 +26,9 @@ public NyaaSettings() [FieldDefinition(0, Label = "Website URL")] public String BaseUrl { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs index c6c1d140d..fe6217361 100644 --- a/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs +++ b/src/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsSettings.cs @@ -1,7 +1,7 @@ using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Indexers.Omgwtfnzbs { @@ -33,9 +33,9 @@ public OmgwtfnzbsSettings() [FieldDefinition(2, Label = "Delay", HelpText = "Time in minutes to delay new nzbs before they appear on the RSS feed", Advanced = true)] public int Delay { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs b/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs index 0ce40ecf6..bd99f4075 100644 --- a/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs +++ b/src/NzbDrone.Core/Indexers/Torrentleech/TorrentleechSettings.cs @@ -1,6 +1,5 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -18,7 +17,7 @@ public TorrentleechSettingsValidator() public class TorrentleechSettings : IProviderConfig { - private static readonly TorrentleechSettingsValidator validator = new TorrentleechSettingsValidator(); + private static readonly TorrentleechSettingsValidator Validator = new TorrentleechSettingsValidator(); public TorrentleechSettings() { @@ -31,9 +30,9 @@ public TorrentleechSettings() [FieldDefinition(1, Label = "API Key")] public String ApiKey { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs b/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs index 377fbe133..a6b6cc90c 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs @@ -3,7 +3,6 @@ using System.Linq; using System.Text.RegularExpressions; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Common.Extensions; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; @@ -67,9 +66,9 @@ public TorznabSettings() [FieldDefinition(4, Label = "Additional Parameters", HelpText = "Additional Torznab parameters", Advanced = true)] public String AdditionalParameters { get; set; } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/MetaData/Consumers/MediaBrowser/MediaBrowserMetadataSettings.cs b/src/NzbDrone.Core/MetaData/Consumers/MediaBrowser/MediaBrowserMetadataSettings.cs index 3fbab1719..d490d9097 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/MediaBrowser/MediaBrowserMetadataSettings.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/MediaBrowser/MediaBrowserMetadataSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Metadata.Consumers.MediaBrowser { @@ -33,9 +33,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/MetaData/Consumers/Roksbox/RoksboxMetadataSettings.cs b/src/NzbDrone.Core/MetaData/Consumers/Roksbox/RoksboxMetadataSettings.cs index 81b410e4a..040643e5e 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/Roksbox/RoksboxMetadataSettings.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/Roksbox/RoksboxMetadataSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Metadata.Consumers.Roksbox { @@ -45,9 +45,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/MetaData/Consumers/Wdtv/WdtvMetadataSettings.cs b/src/NzbDrone.Core/MetaData/Consumers/Wdtv/WdtvMetadataSettings.cs index b10b4247c..31ce00b60 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/Wdtv/WdtvMetadataSettings.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/Wdtv/WdtvMetadataSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Metadata.Consumers.Wdtv { @@ -45,9 +45,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadataSettings.cs b/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadataSettings.cs index 65b397883..72a7e59da 100644 --- a/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadataSettings.cs +++ b/src/NzbDrone.Core/MetaData/Consumers/Xbmc/XbmcMetadataSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Metadata.Consumers.Xbmc { @@ -49,9 +49,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs b/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs index 3fd19a59f..dabe966cf 100644 --- a/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs +++ b/src/NzbDrone.Core/Notifications/Email/EmailSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Email { @@ -47,17 +47,9 @@ public EmailSettings() [FieldDefinition(6, Label = "Recipient Address")] public String To { get; set; } - public bool IsValid + public NzbDroneValidationResult Validate() { - get - { - return !string.IsNullOrWhiteSpace(Server) && Port > 0 && !string.IsNullOrWhiteSpace(From) && !string.IsNullOrWhiteSpace(To); - } - } - - public ValidationResult Validate() - { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs b/src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs index d6444e6cd..04d864e96 100644 --- a/src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs +++ b/src/NzbDrone.Core/Notifications/Growl/GrowlSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Growl { @@ -41,9 +41,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs index 323b184de..71a5528e0 100644 --- a/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs +++ b/src/NzbDrone.Core/Notifications/MediaBrowser/MediaBrowserSettings.cs @@ -1,9 +1,9 @@ using System; using FluentValidation; -using FluentValidation.Results; using Newtonsoft.Json; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.MediaBrowser { @@ -51,14 +51,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); - } - - public override int GetHashCode() - { - return base.GetHashCode(); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs index f476f071c..445f366ef 100644 --- a/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs +++ b/src/NzbDrone.Core/Notifications/NotifyMyAndroid/NotifyMyAndroidSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.NotifyMyAndroid { @@ -32,9 +32,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs b/src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs index f5672c733..e1841ce6b 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexClientSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Plex { @@ -44,9 +44,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs b/src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs index 89be29eb0..cc69e8a90 100644 --- a/src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs +++ b/src/NzbDrone.Core/Notifications/Plex/PlexServerSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Plex { @@ -47,9 +47,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs b/src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs index 14f412402..b07fe27b8 100644 --- a/src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs +++ b/src/NzbDrone.Core/Notifications/Prowl/ProwlSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Prowl { @@ -32,9 +32,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs index b20591b51..140ac3c7f 100644 --- a/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs +++ b/src/NzbDrone.Core/Notifications/PushBullet/PushBulletSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.PushBullet { @@ -32,9 +32,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Pushalot/PushalotSettings.cs b/src/NzbDrone.Core/Notifications/Pushalot/PushalotSettings.cs index 7e5e9c8cd..72560b249 100644 --- a/src/NzbDrone.Core/Notifications/Pushalot/PushalotSettings.cs +++ b/src/NzbDrone.Core/Notifications/Pushalot/PushalotSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Pushalot { @@ -32,9 +32,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs index 51c2ab86a..b3533ed24 100644 --- a/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs +++ b/src/NzbDrone.Core/Notifications/Pushover/PushoverSettings.cs @@ -1,8 +1,8 @@ using System; using FluentValidation; -using FluentValidation.Results; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Pushover { @@ -44,9 +44,9 @@ public bool IsValid } } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs index 484c57b61..cab9527e7 100644 --- a/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs +++ b/src/NzbDrone.Core/Notifications/Xbmc/XbmcSettings.cs @@ -1,10 +1,10 @@ using System; using System.ComponentModel; using FluentValidation; -using FluentValidation.Results; using Newtonsoft.Json; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.Notifications.Xbmc { @@ -57,23 +57,10 @@ public XbmcSettings() [JsonIgnore] public String Address { get { return String.Format("{0}:{1}", Host, Port); } } - - public bool IsValid - { - get - { - return !string.IsNullOrWhiteSpace(Host) && Port > 0; - } - } - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return Validator.Validate(this); - } - - public override int GetHashCode() - { - return base.GetHashCode(); + return new NzbDroneValidationResult(Validator.Validate(this)); } } } diff --git a/src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs b/src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs index 46501fb34..595e3866c 100644 --- a/src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs +++ b/src/NzbDrone.Core/ThingiProvider/IProviderConfig.cs @@ -1,9 +1,9 @@ -using FluentValidation.Results; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.ThingiProvider { public interface IProviderConfig { - ValidationResult Validate(); + NzbDroneValidationResult Validate(); } } \ No newline at end of file diff --git a/src/NzbDrone.Core/ThingiProvider/NullConfig.cs b/src/NzbDrone.Core/ThingiProvider/NullConfig.cs index 6eea2e66c..9016f6644 100644 --- a/src/NzbDrone.Core/ThingiProvider/NullConfig.cs +++ b/src/NzbDrone.Core/ThingiProvider/NullConfig.cs @@ -1,4 +1,4 @@ -using FluentValidation.Results; +using NzbDrone.Core.Validation; namespace NzbDrone.Core.ThingiProvider { @@ -6,9 +6,9 @@ public class NullConfig : IProviderConfig { public static readonly NullConfig Instance = new NullConfig(); - public ValidationResult Validate() + public NzbDroneValidationResult Validate() { - return new ValidationResult(); + return new NzbDroneValidationResult(); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Validation/NzbDroneValidationResult.cs b/src/NzbDrone.Core/Validation/NzbDroneValidationResult.cs index 804e8e147..4d7ed4aa8 100644 --- a/src/NzbDrone.Core/Validation/NzbDroneValidationResult.cs +++ b/src/NzbDrone.Core/Validation/NzbDroneValidationResult.cs @@ -1,9 +1,7 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; -using System.Text; -using FluentValidation; using FluentValidation.Results; +using NzbDrone.Common.Extensions; namespace NzbDrone.Core.Validation { @@ -13,6 +11,11 @@ public NzbDroneValidationResult() { } + public NzbDroneValidationResult(ValidationResult validationResult) + : this(validationResult.Errors) + { + } + public NzbDroneValidationResult(IEnumerable failures) { var errors = new List(); @@ -51,5 +54,13 @@ public virtual bool HasWarnings { get { return Warnings.Any(); } } + + public override bool IsValid + { + get + { + return Errors.Empty(); + } + } } } \ No newline at end of file