Fixed: Download Client with config Warnings won't be excluded

This commit is contained in:
Mark McDowall 2015-03-16 21:33:34 -07:00
parent 8dccf2efe8
commit 99d9303394
38 changed files with 131 additions and 156 deletions

View File

@ -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();
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public class DelugeSettings : IProviderConfig
{
private static readonly DelugeSettingsValidator validator = new DelugeSettingsValidator();
private static readonly DelugeSettingsValidator Validator = new DelugeSettingsValidator();
public DelugeSettings()
{
@ -53,9 +53,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.TorrentBlackhole
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 @@ namespace NzbDrone.Core.Download.Clients.TorrentBlackhole
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.Transmission
public class TransmissionSettings : IProviderConfig
{
private static readonly TransmissionSettingsValidator validator = new TransmissionSettingsValidator();
private static readonly TransmissionSettingsValidator Validator = new TransmissionSettingsValidator();
public TransmissionSettings()
{
@ -54,9 +54,9 @@ namespace NzbDrone.Core.Download.Clients.Transmission
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.UsenetBlackhole
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
public class UTorrentSettings : IProviderConfig
{
private static readonly UTorrentSettingsValidator validator = new UTorrentSettingsValidator();
private static readonly UTorrentSettingsValidator Validator = new UTorrentSettingsValidator();
public UTorrentSettings()
{
@ -48,9 +48,9 @@ namespace NzbDrone.Core.Download.Clients.UTorrent
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.BitMeTv
public class BitMeTvSettings : IProviderConfig
{
private static readonly BitMeTvSettingsValidator validator = new BitMeTvSettingsValidator();
private static readonly BitMeTvSettingsValidator Validator = new BitMeTvSettingsValidator();
public BitMeTvSettings()
{
@ -46,9 +45,9 @@ namespace NzbDrone.Core.Indexers.BitMeTv
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
public class BroadcastheNetSettings : IProviderConfig
{
private static readonly BroadcastheNetSettingsValidator validator = new BroadcastheNetSettingsValidator();
private static readonly BroadcastheNetSettingsValidator Validator = new BroadcastheNetSettingsValidator();
public BroadcastheNetSettings()
{
@ -31,9 +30,9 @@ namespace NzbDrone.Core.Indexers.BroadcastheNet
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.Eztv
public class EztvSettings : IProviderConfig
{
private static readonly EztvSettingsValidator validator = new EztvSettingsValidator();
private static readonly EztvSettingsValidator Validator = new EztvSettingsValidator();
public EztvSettings()
{
@ -27,9 +26,9 @@ namespace NzbDrone.Core.Indexers.Eztv
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.Fanzub
public class FanzubSettings : IProviderConfig
{
private static readonly FanzubSettingsValidator validator = new FanzubSettingsValidator();
private static readonly FanzubSettingsValidator Validator = new FanzubSettingsValidator();
public FanzubSettings()
{
@ -27,9 +26,9 @@ namespace NzbDrone.Core.Indexers.Fanzub
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.IPTorrents
public class IPTorrentsSettings : IProviderConfig
{
private static readonly IPTorrentsSettingsValidator validator = new IPTorrentsSettingsValidator();
private static readonly IPTorrentsSettingsValidator Validator = new IPTorrentsSettingsValidator();
public IPTorrentsSettings()
{
@ -34,9 +33,9 @@ namespace NzbDrone.Core.Indexers.IPTorrents
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
public class KickassTorrentsSettings : IProviderConfig
{
private static readonly KickassTorrentsSettingsValidator validator = new KickassTorrentsSettingsValidator();
private static readonly KickassTorrentsSettingsValidator Validator = new KickassTorrentsSettingsValidator();
public KickassTorrentsSettings()
{
@ -31,9 +30,9 @@ namespace NzbDrone.Core.Indexers.KickassTorrents
[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));
}
}
}

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using FluentValidation;
using FluentValidation.Results;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Annotations;
using NzbDrone.Core.ThingiProvider;
@ -64,18 +63,21 @@ namespace NzbDrone.Core.Indexers.Newznab
[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<Int32> 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<Int32> 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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.Nyaa
public class NyaaSettings : IProviderConfig
{
private static readonly NyaaSettingsValidator validator = new NyaaSettingsValidator();
private static readonly NyaaSettingsValidator Validator = new NyaaSettingsValidator();
public NyaaSettings()
{
@ -27,9 +26,9 @@ namespace NzbDrone.Core.Indexers.Nyaa
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.Omgwtfnzbs
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Indexers.Torrentleech
public class TorrentleechSettings : IProviderConfig
{
private static readonly TorrentleechSettingsValidator validator = new TorrentleechSettingsValidator();
private static readonly TorrentleechSettingsValidator Validator = new TorrentleechSettingsValidator();
public TorrentleechSettings()
{
@ -31,9 +30,9 @@ namespace NzbDrone.Core.Indexers.Torrentleech
[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));
}
}
}

View File

@ -3,7 +3,6 @@ using System.Collections.Generic;
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 @@ namespace NzbDrone.Core.Indexers.Torznab
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Metadata.Consumers.MediaBrowser
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Metadata.Consumers.Roksbox
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Metadata.Consumers.Wdtv
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Metadata.Consumers.Xbmc
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Email
[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));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Growl
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.MediaBrowser
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
}
public override int GetHashCode()
{
return base.GetHashCode();
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.NotifyMyAndroid
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Plex
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Plex
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Prowl
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.PushBullet
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Pushalot
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Notifications.Pushover
}
}
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return Validator.Validate(this);
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -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
{
@ -58,22 +58,9 @@ namespace NzbDrone.Core.Notifications.Xbmc
[JsonIgnore]
public String Address { get { return String.Format("{0}:{1}", Host, Port); } }
public bool IsValid
public NzbDroneValidationResult Validate()
{
get
{
return !string.IsNullOrWhiteSpace(Host) && Port > 0;
}
}
public ValidationResult Validate()
{
return Validator.Validate(this);
}
public override int GetHashCode()
{
return base.GetHashCode();
return new NzbDroneValidationResult(Validator.Validate(this));
}
}
}

View File

@ -1,9 +1,9 @@
using FluentValidation.Results;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.ThingiProvider
{
public interface IProviderConfig
{
ValidationResult Validate();
NzbDroneValidationResult Validate();
}
}

View File

@ -1,4 +1,4 @@
using FluentValidation.Results;
using NzbDrone.Core.Validation;
namespace NzbDrone.Core.ThingiProvider
{
@ -6,9 +6,9 @@ namespace NzbDrone.Core.ThingiProvider
{
public static readonly NullConfig Instance = new NullConfig();
public ValidationResult Validate()
public NzbDroneValidationResult Validate()
{
return new ValidationResult();
return new NzbDroneValidationResult();
}
}
}

View File

@ -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 @@ namespace NzbDrone.Core.Validation
{
}
public NzbDroneValidationResult(ValidationResult validationResult)
: this(validationResult.Errors)
{
}
public NzbDroneValidationResult(IEnumerable<ValidationFailure> failures)
{
var errors = new List<NzbDroneValidationFailure>();
@ -51,5 +54,13 @@ namespace NzbDrone.Core.Validation
{
get { return Warnings.Any(); }
}
public override bool IsValid
{
get
{
return Errors.Empty();
}
}
}
}