1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00

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

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

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

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

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

View File

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

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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ 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));
}
}
}

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 @@ public bool IsValid
}
}
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 @@ 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));
}
}
}

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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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 @@ public bool IsValid
}
}
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
{
@ -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));
}
}
}

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