diff --git a/NzbDrone.Core/Indexers/IndexerFetchService.cs b/NzbDrone.Core/Indexers/IndexerFetchService.cs index d9457f58b..b571f6466 100644 --- a/NzbDrone.Core/Indexers/IndexerFetchService.cs +++ b/NzbDrone.Core/Indexers/IndexerFetchService.cs @@ -128,7 +128,7 @@ namespace NzbDrone.Core.Indexers } catch (ApiKeyException) { - _logger.Warn("Invalid API Key for {0} {1}", indexer.Name, url); + _logger.Warn("Invalid API Key for {0} {1}", indexer, url); } catch (Exception feedEx) { diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 582096964..c19c6e319 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -422,7 +422,13 @@ - + + + + + + + @@ -621,4 +627,4 @@ --> - + \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.ncrunchproject b/NzbDrone.Core/NzbDrone.Core.ncrunchproject index b2eed192e..b36cf9e27 100644 --- a/NzbDrone.Core/NzbDrone.Core.ncrunchproject +++ b/NzbDrone.Core/NzbDrone.Core.ncrunchproject @@ -13,7 +13,7 @@ true true 5000 - Debug + RELEASE x86 x86 diff --git a/NzbDrone.Core/ThingiProvider/IProvider.cs b/NzbDrone.Core/ThingiProvider/IProvider.cs index c3308316e..4947c3d8b 100644 --- a/NzbDrone.Core/ThingiProvider/IProvider.cs +++ b/NzbDrone.Core/ThingiProvider/IProvider.cs @@ -1,33 +1,9 @@  using System; using System.Collections.Generic; -using FluentValidation.Results; -using NzbDrone.Core.Datastore; -using NzbDrone.Core.Messaging.Events; namespace NzbDrone.Core.ThingiProvider { - public interface IProviderRepository : IBasicRepository where TProvider : ModelBase, new() - { - TProvider GetByName(string name); - } - - - public class ProviderRepository : BasicRepository, IProviderRepository - where TProviderDefinition : ModelBase, - new() - { - protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator) - : base(database, eventAggregator) - { - } - - public TProviderDefinition GetByName(string name) - { - throw new NotImplementedException(); - } - } - public interface IProvider { Type ConfigContract { get; } @@ -35,45 +11,4 @@ namespace NzbDrone.Core.ThingiProvider IEnumerable DefaultDefinitions { get; } ProviderDefinition Definition { get; set; } } - - public abstract class ProviderDefinition : ModelBase - { - private IProviderConfig _settings; - public string Name { get; set; } - public string Implementation { get; set; } - public bool Enable { get; set; } - - public string ConfigContract { get; set; } - - public IProviderConfig Settings - { - get - { - return _settings; - } - set - { - _settings = value; - if (value != null) - { - ConfigContract = value.GetType().Name; - } - } - } - } - - public interface IProviderConfig - { - ValidationResult Validate(); - } - - public class NullConfig : IProviderConfig - { - public static readonly NullConfig Instance = new NullConfig(); - - public ValidationResult Validate() - { - return new ValidationResult(); - } - } } \ No newline at end of file diff --git a/NzbDrone.Core/ThingiProvider/IProviderConfig.cs b/NzbDrone.Core/ThingiProvider/IProviderConfig.cs new file mode 100644 index 000000000..46501fb34 --- /dev/null +++ b/NzbDrone.Core/ThingiProvider/IProviderConfig.cs @@ -0,0 +1,9 @@ +using FluentValidation.Results; + +namespace NzbDrone.Core.ThingiProvider +{ + public interface IProviderConfig + { + ValidationResult Validate(); + } +} \ No newline at end of file diff --git a/NzbDrone.Core/ThingiProvider/IProviderFactory.cs b/NzbDrone.Core/ThingiProvider/IProviderFactory.cs new file mode 100644 index 000000000..54e8315a6 --- /dev/null +++ b/NzbDrone.Core/ThingiProvider/IProviderFactory.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; + +namespace NzbDrone.Core.ThingiProvider +{ + public interface IProviderFactory + where TProviderDefinition : ProviderDefinition, new() + where TProvider : IProvider + { + List All(); + List GetAvailableProviders(); + TProviderDefinition Get(int id); + TProviderDefinition Create(TProviderDefinition indexer); + void Update(TProviderDefinition indexer); + void Delete(int id); + List Templates(); + } +} \ No newline at end of file diff --git a/NzbDrone.Core/ThingiProvider/IProviderRepository.cs b/NzbDrone.Core/ThingiProvider/IProviderRepository.cs new file mode 100644 index 000000000..13043b64d --- /dev/null +++ b/NzbDrone.Core/ThingiProvider/IProviderRepository.cs @@ -0,0 +1,8 @@ +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.ThingiProvider +{ + public interface IProviderRepository : IBasicRepository where TProvider : ModelBase, new() + { + } +} \ No newline at end of file diff --git a/NzbDrone.Core/ThingiProvider/NullConfig.cs b/NzbDrone.Core/ThingiProvider/NullConfig.cs new file mode 100644 index 000000000..6eea2e66c --- /dev/null +++ b/NzbDrone.Core/ThingiProvider/NullConfig.cs @@ -0,0 +1,14 @@ +using FluentValidation.Results; + +namespace NzbDrone.Core.ThingiProvider +{ + public class NullConfig : IProviderConfig + { + public static readonly NullConfig Instance = new NullConfig(); + + public ValidationResult Validate() + { + return new ValidationResult(); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/ThingiProvider/ProviderDefinition.cs b/NzbDrone.Core/ThingiProvider/ProviderDefinition.cs new file mode 100644 index 000000000..ef21d3206 --- /dev/null +++ b/NzbDrone.Core/ThingiProvider/ProviderDefinition.cs @@ -0,0 +1,30 @@ +using NzbDrone.Core.Datastore; + +namespace NzbDrone.Core.ThingiProvider +{ + public abstract class ProviderDefinition : ModelBase + { + private IProviderConfig _settings; + public string Name { get; set; } + public string Implementation { get; set; } + public bool Enable { get; set; } + + public string ConfigContract { get; set; } + + public IProviderConfig Settings + { + get + { + return _settings; + } + set + { + _settings = value; + if (value != null) + { + ConfigContract = value.GetType().Name; + } + } + } + } +} \ No newline at end of file diff --git a/NzbDrone.Core/ThingiProvider/ProviderService.cs b/NzbDrone.Core/ThingiProvider/ProviderFactory.cs similarity index 86% rename from NzbDrone.Core/ThingiProvider/ProviderService.cs rename to NzbDrone.Core/ThingiProvider/ProviderFactory.cs index 4765de4bc..bbd909bb3 100644 --- a/NzbDrone.Core/ThingiProvider/ProviderService.cs +++ b/NzbDrone.Core/ThingiProvider/ProviderFactory.cs @@ -2,25 +2,11 @@ using System.Collections.Generic; using System.Linq; using NLog; -using NzbDrone.Common.Reflection; using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Messaging.Events; namespace NzbDrone.Core.ThingiProvider { - public interface IProviderFactory - where TProviderDefinition : ProviderDefinition, new() - where TProvider : IProvider - { - List All(); - List GetAvailableProviders(); - TProviderDefinition Get(int id); - TProviderDefinition Create(TProviderDefinition indexer); - void Update(TProviderDefinition indexer); - void Delete(int id); - List Templates(); - } - public abstract class ProviderFactory : IProviderFactory, IHandle where TProviderDefinition : ProviderDefinition, new() where TProvider : IProvider diff --git a/NzbDrone.Core/ThingiProvider/ProviderRepository.cs b/NzbDrone.Core/ThingiProvider/ProviderRepository.cs new file mode 100644 index 000000000..cceaaefcb --- /dev/null +++ b/NzbDrone.Core/ThingiProvider/ProviderRepository.cs @@ -0,0 +1,16 @@ +using System; +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Messaging.Events; + +namespace NzbDrone.Core.ThingiProvider +{ + public class ProviderRepository : BasicRepository, IProviderRepository + where TProviderDefinition : ModelBase, + new() + { + protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator) + : base(database, eventAggregator) + { + } + } +} \ No newline at end of file