mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Hello Autofac, Goodbye Ninject
This commit is contained in:
parent
17d9d0cc4f
commit
924d3d0c8e
@ -3,11 +3,10 @@
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using Autofac;
|
||||
using Funq;
|
||||
using Ninject;
|
||||
using NzbDrone.Api.QualityProfiles;
|
||||
using NzbDrone.Api.QualityType;
|
||||
using ServiceStack.ContainerAdapter.Ninject;
|
||||
using ServiceStack.WebHost.Endpoints;
|
||||
using QualityProfileService = NzbDrone.Api.QualityProfiles.QualityProfileService;
|
||||
|
||||
@ -15,17 +14,17 @@ namespace NzbDrone.Api
|
||||
{
|
||||
public class AppHost : AppHostBase
|
||||
{
|
||||
private IKernel _kernel;
|
||||
private IContainer _container;
|
||||
|
||||
public AppHost(IKernel kernel) //Tell ServiceStack the name and where to find your web services
|
||||
public AppHost(IContainer container) //Tell ServiceStack the name and where to find your web services
|
||||
: base("NzbDrone API", typeof(QualityProfileService).Assembly)
|
||||
{
|
||||
_kernel = kernel;
|
||||
_container = container;
|
||||
}
|
||||
|
||||
public override void Configure(Container container)
|
||||
{
|
||||
container.Adapter = new NinjectContainerAdapter(_kernel);
|
||||
container.Adapter = new AutofacIocAdapter(_container);
|
||||
SetConfig(new EndpointHostConfig { ServiceStackHandlerFactoryPath = "api" });
|
||||
|
||||
Routes
|
||||
|
36
NzbDrone.Api/AutofacContainerAdapter.cs
Normal file
36
NzbDrone.Api/AutofacContainerAdapter.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Autofac;
|
||||
using ServiceStack.Configuration;
|
||||
|
||||
namespace NzbDrone.Api
|
||||
{
|
||||
public class AutofacIocAdapter : IContainerAdapter
|
||||
{
|
||||
private readonly IContainer _container;
|
||||
|
||||
public AutofacIocAdapter(IContainer container)
|
||||
{
|
||||
_container = container;
|
||||
}
|
||||
|
||||
public T Resolve<T>()
|
||||
{
|
||||
return _container.Resolve<T>();
|
||||
}
|
||||
|
||||
public T TryResolve<T>()
|
||||
{
|
||||
T result;
|
||||
|
||||
if (_container.TryResolve<T>(out result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Ninject;
|
||||
using NzbDrone.Api.Exceptions;
|
||||
using NzbDrone.Api.Helpers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -16,7 +15,6 @@ public class ValidApiRequestAttribute : Attribute, IHasRequestFilter
|
||||
public ApplyTo ApplyTo { get; set; }
|
||||
public int Priority { get; set; }
|
||||
|
||||
[Inject]
|
||||
public ConfigProvider _configProvider;
|
||||
|
||||
public void RequestFilter(IHttpRequest req, IHttpResponse res, object requestDto)
|
||||
|
@ -50,22 +50,21 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AutoMapper">
|
||||
<HintPath>..\packages\AutoMapper.2.2.0\lib\net40\AutoMapper.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack">
|
||||
<HintPath>..\packages\ServiceStack.3.9.25\lib\net35\ServiceStack.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack.Common">
|
||||
<HintPath>..\packages\ServiceStack.Common.3.9.25\lib\net35\ServiceStack.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack.ContainerAdapter.Ninject">
|
||||
<HintPath>..\packages\ServiceStack.ContainerAdapter.Ninject.1.0.4526.38581\lib\net40\ServiceStack.ContainerAdapter.Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack.Interfaces">
|
||||
<HintPath>..\packages\ServiceStack.Common.3.9.25\lib\net35\ServiceStack.Interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
@ -94,6 +93,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppHost.cs" />
|
||||
<Compile Include="AutofacContainerAdapter.cs" />
|
||||
<Compile Include="Bootstrapper.cs" />
|
||||
<Compile Include="Exceptions\InvalidApiKeyException.cs" />
|
||||
<Compile Include="Filters\ValidApiRequestAttribute.cs" />
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Ninject;
|
||||
using NzbDrone.Api.Filters;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
@ -14,7 +13,6 @@ public class QualityProfileService : RestServiceBase<QualityProfileModel>
|
||||
{
|
||||
private readonly QualityProvider _qualityProvider;
|
||||
|
||||
[Inject]
|
||||
public QualityProfileService(QualityProvider qualityProvider)
|
||||
{
|
||||
_qualityProvider = qualityProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Ninject;
|
||||
using NzbDrone.Api.Filters;
|
||||
using NzbDrone.Core.Providers;
|
||||
using ServiceStack.ServiceInterface;
|
||||
@ -14,7 +13,6 @@ public class QualityTypeService : RestServiceBase<QualityTypeModel>
|
||||
{
|
||||
private readonly QualityTypeProvider _qualityTypeProvider;
|
||||
|
||||
[Inject]
|
||||
public QualityTypeService(QualityTypeProvider qualityTypeProvider)
|
||||
{
|
||||
_qualityTypeProvider = qualityTypeProvider;
|
||||
|
@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
||||
<package id="AutoMapper" version="2.2.0" targetFramework="net40" />
|
||||
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
|
||||
<package id="ServiceStack" version="3.9.25" targetFramework="net40" />
|
||||
<package id="ServiceStack.Common" version="3.9.25" targetFramework="net40" />
|
||||
<package id="ServiceStack.ContainerAdapter.Ninject" version="1.0.4526.38581" targetFramework="net40" />
|
||||
<package id="ServiceStack.OrmLite.SqlServer" version="3.9.26" targetFramework="net40" />
|
||||
<package id="ServiceStack.Redis" version="3.9.25" targetFramework="net40" />
|
||||
<package id="ServiceStack.Text" version="3.9.27" targetFramework="net40" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
using FluentAssertions;
|
||||
using Autofac;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.App.Test
|
||||
@ -11,14 +11,14 @@ public class CentralDispatchTests : TestBase
|
||||
[Test]
|
||||
public void Kernel_can_get_kernel()
|
||||
{
|
||||
CentralDispatch.Kernel.Should().NotBeNull();
|
||||
CentralDispatch.Container.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Kernel_should_return_same_kernel()
|
||||
{
|
||||
var firstKernel = CentralDispatch.Kernel;
|
||||
var secondKernel = CentralDispatch.Kernel;
|
||||
var firstKernel = CentralDispatch.Container;
|
||||
var secondKernel = CentralDispatch.Container;
|
||||
|
||||
firstKernel.Should().BeSameAs(secondKernel);
|
||||
}
|
||||
@ -26,7 +26,7 @@ public void Kernel_should_return_same_kernel()
|
||||
[Test]
|
||||
public void Kernel_should_be_able_to_resolve_ApplicationServer()
|
||||
{
|
||||
var appServer = CentralDispatch.Kernel.Get<ApplicationServer>();
|
||||
var appServer = CentralDispatch.Container.Resolve<ApplicationServer>();
|
||||
|
||||
appServer.Should().NotBeNull();
|
||||
}
|
||||
@ -34,8 +34,8 @@ public void Kernel_should_be_able_to_resolve_ApplicationServer()
|
||||
[Test]
|
||||
public void Kernel_should_resolve_same_ApplicationServer_instance()
|
||||
{
|
||||
var appServer1 = CentralDispatch.Kernel.Get<ApplicationServer>();
|
||||
var appServer2 = CentralDispatch.Kernel.Get<ApplicationServer>();
|
||||
var appServer1 = CentralDispatch.Container.Resolve<ApplicationServer>();
|
||||
var appServer2 = CentralDispatch.Container.Resolve<ApplicationServer>();
|
||||
|
||||
appServer1.Should().BeSameAs(appServer2);
|
||||
}
|
||||
|
@ -3,8 +3,7 @@
|
||||
//using FluentAssertions;
|
||||
//using Moq;
|
||||
//using NUnit.Framework;
|
||||
//using Ninject;
|
||||
//using NzbDrone.Common;
|
||||
////using NzbDrone.Common;
|
||||
//using NzbDrone.Common.Model;
|
||||
//using NzbDrone.Providers;
|
||||
//using NzbDrone.Test.Common;
|
||||
|
@ -53,6 +53,12 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FizzWare.NBuilder, Version=3.0.1.0, Culture=neutral, PublicKeyToken=5651b03e12e42c12, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NBuilder.3.0.1.1\lib\FizzWare.NBuilder.dll</HintPath>
|
||||
</Reference>
|
||||
@ -63,10 +69,6 @@
|
||||
<Reference Include="Moq">
|
||||
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
||||
<package id="FluentAssertions" version="1.7.0" />
|
||||
<package id="Moq" version="4.0.10827" />
|
||||
<package id="NBuilder" version="3.0.1.1" />
|
||||
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
|
||||
<package id="NLog" version="2.0.0.2000" />
|
||||
<package id="NUnit" version="2.6.0.12054" />
|
||||
</packages>
|
@ -53,6 +53,12 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="FluentAssertions, Version=1.7.0.0, Culture=neutral, PublicKeyToken=33f2691a05b67b6a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\FluentAssertions.1.7.0\Lib\net40\FluentAssertions.dll</HintPath>
|
||||
@ -60,10 +66,6 @@
|
||||
<Reference Include="Moq">
|
||||
<HintPath>..\packages\Moq.4.0.10827\lib\NET40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
||||
<package id="FluentAssertions" version="1.7.0" />
|
||||
<package id="Moq" version="4.0.10827" />
|
||||
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
|
||||
<package id="NLog" version="2.0.0.2000" />
|
||||
<package id="NUnit" version="2.6.0.12054" />
|
||||
</packages>
|
@ -4,7 +4,6 @@
|
||||
using System.Xml.Linq;
|
||||
using System.Xml.XPath;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common.Model;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
@ -16,7 +15,6 @@ public class ConfigFileProvider
|
||||
|
||||
private readonly string _configFile;
|
||||
|
||||
[Inject]
|
||||
public ConfigFileProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
|
@ -5,7 +5,6 @@
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
@ -14,7 +13,6 @@ public class HttpProvider
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public HttpProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
@ -15,7 +14,6 @@ public class IISProvider
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
|
||||
[Inject]
|
||||
public IISProvider(ConfigFileProvider configFileProvider, ProcessProvider processProvider, EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_configFileProvider = configFileProvider;
|
||||
|
@ -53,6 +53,12 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Exceptron.Client, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Exceptron.Client.1.0.7\lib\net20\Exceptron.Client.dll</HintPath>
|
||||
@ -61,10 +67,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog">
|
||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -5,7 +5,6 @@
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
using NzbDrone.Common.Contract;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
@ -19,7 +18,6 @@ public class RestProvider
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
|
||||
[Inject]
|
||||
public RestProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Security.Principal;
|
||||
using NLog;
|
||||
using NetFwTypeLib;
|
||||
using Ninject;
|
||||
|
||||
namespace NzbDrone.Common
|
||||
{
|
||||
@ -16,7 +15,6 @@ public class SecurityProvider
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private readonly ProcessProvider _processProvider;
|
||||
|
||||
[Inject]
|
||||
public SecurityProvider(ConfigFileProvider configFileProvider, EnvironmentProvider environmentProvider,
|
||||
ProcessProvider processProvider)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
||||
<package id="Exceptron.Client" version="1.0.7" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
|
||||
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
|
||||
<package id="NLog" version="2.0.0.2000" />
|
||||
</packages>
|
@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Autofac;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
@ -9,7 +10,6 @@
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using Ninject;
|
||||
|
||||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
@ -19,12 +19,14 @@ class CentralDispatchFixture : CoreTest
|
||||
readonly IList<Type> indexers = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(IndexerBase))).ToList();
|
||||
readonly IList<Type> jobs = typeof(CentralDispatch).Assembly.GetTypes().Where(t => t.GetInterfaces().Contains(typeof(IJob))).ToList();
|
||||
|
||||
private IKernel kernel;
|
||||
private IContainer kernel;
|
||||
|
||||
public CentralDispatchFixture()
|
||||
{
|
||||
InitLogging();
|
||||
kernel = new CentralDispatch().Kernel;
|
||||
var dispatch = new CentralDispatch();
|
||||
kernel = dispatch.Build();
|
||||
|
||||
WebTimer.Stop();
|
||||
}
|
||||
|
||||
@ -44,7 +46,7 @@ public void Resolve_all_providers()
|
||||
foreach (var provider in providers)
|
||||
{
|
||||
Console.WriteLine("Resolving " + provider.Name);
|
||||
kernel.Get(provider).Should().NotBeNull();
|
||||
kernel.Resolve(provider).Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +56,7 @@ public void All_jobs_should_be_registered()
|
||||
{
|
||||
//Assert
|
||||
|
||||
var registeredJobs = kernel.GetAll<IJob>();
|
||||
var registeredJobs = kernel.Resolve<IEnumerable<IJob>>();
|
||||
|
||||
jobs.Should().NotBeEmpty();
|
||||
|
||||
@ -67,7 +69,7 @@ public void All_indexers_should_be_registered()
|
||||
{
|
||||
//Assert
|
||||
|
||||
var registeredIndexers = kernel.GetAll<IndexerBase>();
|
||||
var registeredIndexers = kernel.Resolve<IEnumerable<IndexerBase>>();
|
||||
|
||||
indexers.Should().NotBeEmpty();
|
||||
|
||||
@ -78,26 +80,26 @@ public void All_indexers_should_be_registered()
|
||||
[Test]
|
||||
public void jobs_are_initialized()
|
||||
{
|
||||
kernel.Get<JobProvider>().All().Should().HaveSameCount(jobs);
|
||||
kernel.Resolve<JobProvider>().All().Should().HaveSameCount(jobs);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void indexers_are_initialized()
|
||||
{
|
||||
kernel.Get<IndexerProvider>().All().Should().HaveSameCount(indexers);
|
||||
kernel.Resolve<IndexerProvider>().All().Should().HaveSameCount(indexers);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void quality_profile_initialized()
|
||||
{
|
||||
kernel.Get<QualityProvider>().All().Should().HaveCount(2);
|
||||
kernel.Resolve<QualityProvider>().All().Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JobProvider_should_be_singletone()
|
||||
{
|
||||
var first = kernel.Get<JobProvider>();
|
||||
var second = kernel.Get<JobProvider>();
|
||||
var first = kernel.Resolve<JobProvider>();
|
||||
var second = kernel.Resolve<JobProvider>();
|
||||
|
||||
first.Should().BeSameAs(second);
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ protected void WithRealDb()
|
||||
Mocker.SetConstant(Db);
|
||||
}
|
||||
|
||||
|
||||
protected static ProgressNotification MockNotification
|
||||
{
|
||||
get
|
||||
|
@ -6,7 +6,6 @@
|
||||
using System.Xml.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Autofac;
|
||||
using FluentAssertions;
|
||||
using NLog;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -17,24 +18,27 @@ namespace NzbDrone.Core.Test.Integeration
|
||||
[TestFixture(Category = "ServiceIngeneration")]
|
||||
public class ServiceIntegerationFixture : CoreTest
|
||||
{
|
||||
private KernelBase _kernel;
|
||||
private IContainer _container;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
WithRealDb();
|
||||
_kernel = new StandardKernel();
|
||||
_kernel.Bind<IDatabase>().ToConstant(Db);
|
||||
var builder = new CentralDispatch().ContainerBuilder;
|
||||
|
||||
builder.Register(c => Db)
|
||||
.As<IDatabase>();
|
||||
|
||||
_container = builder.Build();
|
||||
|
||||
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
|
||||
.Returns("http://services.nzbdrone.com");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_update_scene_mapping()
|
||||
{
|
||||
_kernel.Get<SceneMappingProvider>().UpdateMappings();
|
||||
_container.Resolve<SceneMappingProvider>().UpdateMappings();
|
||||
var mappings = Db.Fetch<SceneMapping>();
|
||||
|
||||
mappings.Should().NotBeEmpty();
|
||||
@ -47,7 +51,7 @@ public void should_be_able_to_update_scene_mapping()
|
||||
[Test]
|
||||
public void should_be_able_to_get_daily_series_ids()
|
||||
{
|
||||
var dailySeries = _kernel.Get<ReferenceDataProvider>().GetDailySeriesIds();
|
||||
var dailySeries = _container.Resolve<ReferenceDataProvider>().GetDailySeriesIds();
|
||||
|
||||
dailySeries.Should().NotBeEmpty();
|
||||
dailySeries.Should().OnlyContain(c => c > 0);
|
||||
@ -76,11 +80,6 @@ public void should_be_able_to_submit_exceptions()
|
||||
|
||||
hash.Should().HaveLength(8);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -56,6 +56,12 @@
|
||||
<Reference Include="Accessibility">
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Autofac">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="AutoMoq">
|
||||
<HintPath>..\packages\AutoMoq.1.6.1\lib\AutoMoq.dll</HintPath>
|
||||
</Reference>
|
||||
@ -97,10 +103,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -69,7 +69,7 @@ private void WaitForQueue()
|
||||
[Test]
|
||||
public void running_scheduled_jobs_should_updates_last_execution_time()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
//Act
|
||||
@ -86,7 +86,7 @@ public void running_scheduled_jobs_should_updates_last_execution_time()
|
||||
[Test]
|
||||
public void failing_scheduled_job_should_mark_job_as_failed()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
//Act
|
||||
@ -105,7 +105,7 @@ public void failing_scheduled_job_should_mark_job_as_failed()
|
||||
[Test]
|
||||
public void scheduler_skips_jobs_that_arent_mature_yet()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
//Act
|
||||
@ -126,7 +126,7 @@ public void scheduler_skips_jobs_that_arent_mature_yet()
|
||||
//after execution so the job can successfully run.
|
||||
public void can_run_async_job_again()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -146,7 +146,7 @@ public void can_run_async_job_again()
|
||||
[Test]
|
||||
public void no_concurent_jobs()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -166,7 +166,7 @@ public void no_concurent_jobs()
|
||||
[Test]
|
||||
public void can_run_broken_job_again()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { brokenJob };
|
||||
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
@ -188,7 +188,7 @@ public void can_run_broken_job_again()
|
||||
[Test]
|
||||
public void schedule_hit_should_be_ignored_if_queue_is_running()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { slowJob, fakeJob };
|
||||
IEnumerable<IJob> fakeJobs = new List<IJob> { slowJob, fakeJob };
|
||||
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
@ -210,8 +210,7 @@ public void schedule_hit_should_be_ignored_if_queue_is_running()
|
||||
[Test]
|
||||
public void can_queue_jobs_at_the_same_time()
|
||||
{
|
||||
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -238,7 +237,7 @@ public void can_queue_jobs_at_the_same_time()
|
||||
[Test]
|
||||
public void Init_Jobs()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
@ -265,7 +264,7 @@ public void Init_Timers_only_registers_once()
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var fakeTimer = new FakeJob();
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeTimer };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeTimer };
|
||||
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
@ -287,7 +286,7 @@ public void Init_Timers_only_registers_once()
|
||||
[Test]
|
||||
public void inti_should_removed_jobs_that_no_longer_exist()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
WithRealDb();
|
||||
@ -307,7 +306,7 @@ public void inti_should_removed_jobs_that_no_longer_exist()
|
||||
[Test]
|
||||
public void inti_should_removed_jobs_that_no_longer_exist_even_with_same_name()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
WithRealDb();
|
||||
@ -329,7 +328,7 @@ public void inti_should_removed_jobs_that_no_longer_exist_even_with_same_name()
|
||||
[Test]
|
||||
public void init_should_update_existing_job()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> fakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
WithRealDb();
|
||||
@ -364,7 +363,7 @@ public void init_should_update_existing_job()
|
||||
[Test]
|
||||
public void jobs_with_zero_interval_are_registered_as_disabled()
|
||||
{
|
||||
IList<IJob> fakeJobs = new List<IJob> { disabledJob };
|
||||
IEnumerable<IJob> fakeJobs = new List<IJob> { disabledJob };
|
||||
Mocker.SetConstant(fakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -378,7 +377,7 @@ public void jobs_with_zero_interval_are_registered_as_disabled()
|
||||
[Test]
|
||||
public void disabled_jobs_arent_run_by_scheduler()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { disabledJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { disabledJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -394,7 +393,7 @@ public void disabled_jobs_arent_run_by_scheduler()
|
||||
[Test]
|
||||
public void job_with_specific_target_should_not_update_last_execution()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
//Act
|
||||
@ -412,7 +411,7 @@ public void job_with_specific_target_should_not_update_last_execution()
|
||||
[Test]
|
||||
public void job_with_specific_target_should_not_set_success_flag()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
//Act
|
||||
@ -430,7 +429,7 @@ public void job_with_specific_target_should_not_set_success_flag()
|
||||
[Test]
|
||||
public void duplicated_queue_item_should_start_queue_if_its_not_running()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { fakeJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var stuckQueueItem = new JobQueueItem
|
||||
@ -456,7 +455,7 @@ public void duplicated_queue_item_should_start_queue_if_its_not_running()
|
||||
[Test]
|
||||
public void Item_added_to_queue_while_scheduler_runs_should_be_executed()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
ResetLastExecution();
|
||||
@ -477,7 +476,7 @@ public void Item_added_to_queue_while_scheduler_runs_should_be_executed()
|
||||
[Test]
|
||||
public void trygin_to_queue_unregistered_job_should_fail()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, disabledJob };
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -492,7 +491,7 @@ public void trygin_to_queue_unregistered_job_should_fail()
|
||||
[Test]
|
||||
public void scheduled_job_should_have_scheduler_as_source()
|
||||
{
|
||||
IList<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob};
|
||||
IEnumerable<IJob> BaseFakeJobs = new List<IJob> { slowJob, fakeJob};
|
||||
Mocker.SetConstant(BaseFakeJobs);
|
||||
|
||||
var jobProvider = Mocker.Resolve<JobProvider>();
|
||||
@ -504,8 +503,5 @@ public void scheduled_job_should_have_scheduler_as_source()
|
||||
|
||||
WaitForQueue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Autofac;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
@ -24,7 +24,14 @@ public class TvDbProviderTest : CoreTest
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
tvDbProvider = new StandardKernel().Get<TvDbProvider>();
|
||||
var builder = new ContainerBuilder();
|
||||
|
||||
builder.RegisterType<EnvironmentProvider>();
|
||||
builder.RegisterType<TvDbProvider>();
|
||||
|
||||
var container = builder.Build();
|
||||
|
||||
tvDbProvider = container.Resolve<TvDbProvider>();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
|
@ -7,7 +7,6 @@
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -5,7 +5,6 @@
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -7,7 +7,6 @@
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Autofac" version="2.6.3.862" targetFramework="net40" />
|
||||
<package id="AutoMoq" version="1.6.1" targetFramework="net40" />
|
||||
<package id="CommonServiceLocator" version="1.0" targetFramework="net40" />
|
||||
<package id="EntityFramework" version="4.3.1" targetFramework="net40" />
|
||||
@ -10,7 +11,6 @@
|
||||
<package id="Moq" version="4.0.10827" />
|
||||
<package id="NBuilder" version="3.0.1.1" />
|
||||
<package id="Newtonsoft.Json" version="4.5.11" targetFramework="net40" />
|
||||
<package id="Ninject" version="3.0.1.10" targetFramework="net40" />
|
||||
<package id="NLog" version="2.0.0.2000" />
|
||||
<package id="NUnit" version="2.6.0.12054" />
|
||||
<package id="Prowlin" version="0.9.4456.26422" targetFramework="net40" />
|
||||
|
94
NzbDrone.Core/AutofacSignalrDependencyResolver.cs
Normal file
94
NzbDrone.Core/AutofacSignalrDependencyResolver.cs
Normal file
@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Autofac;
|
||||
using Autofac.Builder;
|
||||
using Autofac.Core;
|
||||
using SignalR;
|
||||
|
||||
namespace NzbDrone.Core
|
||||
{
|
||||
public class AutofacSignalrDependencyResolver : DefaultDependencyResolver, IDependencyResolver, IRegistrationSource
|
||||
{
|
||||
private ILifetimeScope LifetimeScope { get; set; }
|
||||
|
||||
public AutofacSignalrDependencyResolver(ILifetimeScope lifetimeScope)
|
||||
{
|
||||
LifetimeScope = lifetimeScope;
|
||||
var currentRegistrationSource =
|
||||
LifetimeScope.ComponentRegistry.Sources.FirstOrDefault(s => s.GetType() == GetType());
|
||||
if (currentRegistrationSource != null)
|
||||
{
|
||||
((AutofacSignalrDependencyResolver)currentRegistrationSource).LifetimeScope = lifetimeScope;
|
||||
}
|
||||
else
|
||||
{
|
||||
LifetimeScope.ComponentRegistry.AddRegistrationSource(this);
|
||||
}
|
||||
}
|
||||
|
||||
public AutofacSignalrDependencyResolver()
|
||||
{
|
||||
}
|
||||
|
||||
public override object GetService(Type serviceType)
|
||||
{
|
||||
object result;
|
||||
|
||||
if (LifetimeScope == null)
|
||||
{
|
||||
return base.GetService(serviceType);
|
||||
}
|
||||
|
||||
if (LifetimeScope.TryResolve(serviceType, out result))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IEnumerable<object> GetServices(Type serviceType)
|
||||
{
|
||||
object result;
|
||||
|
||||
if (LifetimeScope == null)
|
||||
{
|
||||
return base.GetServices(serviceType);
|
||||
}
|
||||
|
||||
if (LifetimeScope.TryResolve(typeof(IEnumerable<>).MakeGenericType(serviceType), out result))
|
||||
{
|
||||
return (IEnumerable<object>)result;
|
||||
}
|
||||
|
||||
return Enumerable.Empty<object>();
|
||||
}
|
||||
|
||||
public IEnumerable<IComponentRegistration> RegistrationsFor(Service service, Func<Service, IEnumerable<IComponentRegistration>> registrationAccessor)
|
||||
{
|
||||
var typedService = service as TypedService;
|
||||
if (typedService != null)
|
||||
{
|
||||
var instances = base.GetServices(typedService.ServiceType);
|
||||
|
||||
if (instances != null)
|
||||
{
|
||||
return instances
|
||||
.Select(i => RegistrationBuilder.ForDelegate(i.GetType(), (c, p) => i).As(typedService.ServiceType)
|
||||
.InstancePerLifetimeScope()
|
||||
.PreserveExistingDefaults()
|
||||
.CreateRegistration());
|
||||
}
|
||||
}
|
||||
|
||||
return Enumerable.Empty<IComponentRegistration>();
|
||||
}
|
||||
|
||||
bool IRegistrationSource.IsAdapterForIndividualComponents
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
}
|
@ -3,8 +3,10 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using Autofac;
|
||||
using Autofac.Core;
|
||||
using DeskMetrics;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
@ -29,140 +31,113 @@ public class CentralDispatch
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
|
||||
public StandardKernel Kernel { get; private set; }
|
||||
public ContainerBuilder ContainerBuilder { get; private set; }
|
||||
|
||||
public CentralDispatch()
|
||||
{
|
||||
_environmentProvider = new EnvironmentProvider();
|
||||
|
||||
logger.Debug("Initializing Kernel:");
|
||||
Kernel = new StandardKernel();
|
||||
logger.Debug("Initializing ContainerBuilder:");
|
||||
ContainerBuilder = new ContainerBuilder();
|
||||
|
||||
GlobalHost.DependencyResolver = new NinjectDependencyResolver(Kernel);
|
||||
ContainerBuilder.RegisterAssemblyTypes(typeof(DiskProvider).Assembly).SingleInstance();
|
||||
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly).SingleInstance();
|
||||
ContainerBuilder.RegisterType<EnvironmentProvider>();
|
||||
|
||||
InitDatabase();
|
||||
InitReporting();
|
||||
|
||||
InitQuality();
|
||||
InitExternalNotifications();
|
||||
InitMetadataProviders();
|
||||
InitIndexers();
|
||||
InitJobs();
|
||||
RegisterJobs();
|
||||
}
|
||||
|
||||
private void InitDatabase()
|
||||
{
|
||||
logger.Info("Initializing Database...");
|
||||
logger.Info("Registering Database...");
|
||||
|
||||
var appDataPath = _environmentProvider.GetAppDataPath();
|
||||
if (!Directory.Exists(appDataPath)) Directory.CreateDirectory(appDataPath);
|
||||
|
||||
var connection = Kernel.Get<Connection>();
|
||||
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetMainPetaPocoDb()).InTransientScope();
|
||||
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb(false)).WhenInjectedInto<DatabaseTarget>().InSingletonScope();
|
||||
Kernel.Bind<IDatabase>().ToMethod(c => connection.GetLogPetaPocoDb()).WhenInjectedInto<LogProvider>();
|
||||
Kernel.Bind<LogDbContext>().ToMethod(c => connection.GetLogEfContext()).WhenInjectedInto<LogProvider>().InSingletonScope();
|
||||
ContainerBuilder.Register(c => c.Resolve<Connection>().GetMainPetaPocoDb())
|
||||
.As<IDatabase>();
|
||||
|
||||
Kernel.Get<DatabaseTarget>().Register();
|
||||
LogConfiguration.Reload();
|
||||
}
|
||||
ContainerBuilder.Register(c => c.Resolve<Connection>().GetLogPetaPocoDb(false))
|
||||
.SingleInstance()
|
||||
.Named<IDatabase>("DatabaseTarget");
|
||||
|
||||
private void InitReporting()
|
||||
{
|
||||
EnvironmentProvider.UGuid = Kernel.Get<ConfigProvider>().UGuid;
|
||||
ReportingService.RestProvider = Kernel.Get<RestProvider>();
|
||||
ReportingService.SetupExceptronDriver();
|
||||
}
|
||||
ContainerBuilder.Register(c => c.Resolve<Connection>().GetLogPetaPocoDb())
|
||||
.Named<IDatabase>("LogProvider");
|
||||
|
||||
private void InitQuality()
|
||||
{
|
||||
logger.Debug("Initializing Quality...");
|
||||
Kernel.Get<QualityProvider>().SetupDefaultProfiles();
|
||||
Kernel.Get<QualityTypeProvider>().SetupDefault();
|
||||
ContainerBuilder.Register(c => c.Resolve<Connection>().GetLogEfContext())
|
||||
.As<LogDbContext>()
|
||||
.SingleInstance();
|
||||
|
||||
ContainerBuilder.RegisterType<DatabaseTarget>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("DatabaseTarget"));
|
||||
ContainerBuilder.RegisterType<LogProvider>().WithParameter(ResolvedParameter.ForNamed<IDatabase>("LogProvider"));
|
||||
}
|
||||
|
||||
private void InitIndexers()
|
||||
{
|
||||
logger.Debug("Initializing Indexers...");
|
||||
Kernel.Bind<IndexerBase>().To<NzbsRUs>();
|
||||
Kernel.Bind<IndexerBase>().To<Newznab>();
|
||||
Kernel.Bind<IndexerBase>().To<Wombles>();
|
||||
Kernel.Bind<IndexerBase>().To<FileSharingTalk>();
|
||||
Kernel.Bind<IndexerBase>().To<NzbIndex>();
|
||||
Kernel.Bind<IndexerBase>().To<NzbClub>();
|
||||
Kernel.Bind<IndexerBase>().To<Omgwtfnzbs>();
|
||||
Kernel.Bind<IndexerBase>().To<Nzbx>();
|
||||
logger.Debug("Registering Indexers...");
|
||||
|
||||
var indexers = Kernel.GetAll<IndexerBase>();
|
||||
Kernel.Get<IndexerProvider>().InitializeIndexers(indexers.ToList());
|
||||
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly)
|
||||
.Where(t => t.BaseType == typeof(IndexerBase))
|
||||
.As<IndexerBase>();
|
||||
|
||||
var newznabIndexers = new List<NewznabDefinition>
|
||||
{
|
||||
new NewznabDefinition { Enable = false, Name = "Nzbs.org", Url = "http://nzbs.org", BuiltIn = true },
|
||||
new NewznabDefinition { Enable = false, Name = "Nzb.su", Url = "https://nzb.su", BuiltIn = true },
|
||||
new NewznabDefinition { Enable = false, Name = "Dognzb.cr", Url = "https://dognzb.cr", BuiltIn = true }
|
||||
};
|
||||
|
||||
Kernel.Get<NewznabProvider>().InitializeNewznabIndexers(newznabIndexers);
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<NzbsRUs>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<Newznab>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<Wombles>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<FileSharingTalk>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<NzbIndex>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<NzbClub>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<Omgwtfnzbs>();
|
||||
//ContainerBuilder.Bind<IndexerBase>().To<Nzbx>();
|
||||
}
|
||||
|
||||
private void InitJobs()
|
||||
private void RegisterJobs()
|
||||
{
|
||||
logger.Debug("Initializing Background Jobs...");
|
||||
logger.Debug("Registering Background Jobs...");
|
||||
|
||||
Kernel.Bind<JobProvider>().ToSelf().InSingletonScope();
|
||||
ContainerBuilder.RegisterType<JobProvider>().SingleInstance();
|
||||
|
||||
Kernel.Bind<IJob>().To<RssSyncJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<ImportNewSeriesJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<UpdateInfoJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<DiskScanJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<DeleteSeriesJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<EpisodeSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<PostDownloadScanJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<UpdateSceneMappingsJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<SeasonSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<RenameSeasonJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<SeriesSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<RenameSeriesJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<BacklogSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<BannerDownloadJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<ConvertEpisodeJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<AppUpdateJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<TrimLogsJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<RecentBacklogSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<SearchHistoryCleanupJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<PastWeekBacklogSearchJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<RefreshEpisodeMetadata>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<CleanupRecycleBinJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<EmptyRecycleBinJob>().InSingletonScope();
|
||||
Kernel.Bind<IJob>().To<XemUpdateJob>().InSingletonScope();
|
||||
ContainerBuilder.RegisterType<Xbmc>().As<ExternalNotificationBase>().SingleInstance();
|
||||
|
||||
Kernel.Get<JobProvider>().Initialize();
|
||||
Kernel.Get<WebTimer>().StartTimer(30);
|
||||
ContainerBuilder.RegisterAssemblyTypes(typeof(CentralDispatch).Assembly)
|
||||
.Where(t => t.GetInterfaces().Contains(typeof(IJob)))
|
||||
.As<IJob>()
|
||||
.SingleInstance();
|
||||
}
|
||||
|
||||
private void InitExternalNotifications()
|
||||
{
|
||||
logger.Debug("Initializing External Notifications...");
|
||||
Kernel.Bind<ExternalNotificationBase>().To<Xbmc>();
|
||||
Kernel.Bind<ExternalNotificationBase>().To<Smtp>();
|
||||
Kernel.Bind<ExternalNotificationBase>().To<Twitter>();
|
||||
Kernel.Bind<ExternalNotificationBase>().To<Providers.ExternalNotification.Growl>();
|
||||
Kernel.Bind<ExternalNotificationBase>().To<Prowl>();
|
||||
Kernel.Bind<ExternalNotificationBase>().To<Plex>();
|
||||
|
||||
var notifiers = Kernel.GetAll<ExternalNotificationBase>();
|
||||
Kernel.Get<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
|
||||
logger.Debug("Registering External Notifications...");
|
||||
ContainerBuilder.RegisterType<Xbmc>().As<ExternalNotificationBase>().SingleInstance();
|
||||
ContainerBuilder.RegisterType<Smtp>().As<ExternalNotificationBase>().SingleInstance();
|
||||
ContainerBuilder.RegisterType<Twitter>().As<ExternalNotificationBase>().SingleInstance();
|
||||
ContainerBuilder.RegisterType<Providers.ExternalNotification.Growl>().As<ExternalNotificationBase>().SingleInstance();
|
||||
ContainerBuilder.RegisterType<Prowl>().As<ExternalNotificationBase>().SingleInstance();
|
||||
ContainerBuilder.RegisterType<Plex>().As<ExternalNotificationBase>().SingleInstance();
|
||||
}
|
||||
|
||||
private void InitMetadataProviders()
|
||||
{
|
||||
logger.Debug("Initializing Metadata Providers...");
|
||||
logger.Debug("Registering Metadata Providers...");
|
||||
|
||||
Kernel.Bind<MetadataBase>().To<Providers.Metadata.Xbmc>().InSingletonScope();
|
||||
ContainerBuilder.RegisterType<Providers.Metadata.Xbmc>().As<MetadataBase>().SingleInstance();
|
||||
}
|
||||
|
||||
var providers = Kernel.GetAll<MetadataBase>();
|
||||
Kernel.Get<MetadataProvider>().Initialize(providers.ToList());
|
||||
private void InitReporting(IContainer container)
|
||||
{
|
||||
EnvironmentProvider.UGuid = container.Resolve<ConfigProvider>().UGuid;
|
||||
ReportingService.RestProvider = container.Resolve<RestProvider>();
|
||||
ReportingService.SetupExceptronDriver();
|
||||
}
|
||||
|
||||
private void InitQuality(IContainer container)
|
||||
{
|
||||
logger.Debug("Initializing Quality...");
|
||||
container.Resolve<QualityProvider>().SetupDefaultProfiles();
|
||||
container.Resolve<QualityTypeProvider>().SetupDefault();
|
||||
}
|
||||
|
||||
public void DedicateToHost()
|
||||
@ -190,6 +165,45 @@ public void DedicateToHost()
|
||||
}
|
||||
}
|
||||
|
||||
public IContainer Build()
|
||||
{
|
||||
var container = ContainerBuilder.Build();
|
||||
|
||||
logger.Debug("Initializing Components");
|
||||
|
||||
container.Resolve<DatabaseTarget>().Register();
|
||||
LogConfiguration.Reload();
|
||||
|
||||
InitReporting(container);
|
||||
InitQuality(container);
|
||||
|
||||
var indexers = container.Resolve<IEnumerable<IndexerBase>>();
|
||||
container.Resolve<IndexerProvider>().InitializeIndexers(indexers.ToList());
|
||||
|
||||
var newznabIndexers = new List<NewznabDefinition>
|
||||
{
|
||||
new NewznabDefinition { Enable = false, Name = "Nzbs.org", Url = "http://nzbs.org", BuiltIn = true },
|
||||
new NewznabDefinition { Enable = false, Name = "Nzb.su", Url = "https://nzb.su", BuiltIn = true },
|
||||
new NewznabDefinition { Enable = false, Name = "Dognzb.cr", Url = "https://dognzb.cr", BuiltIn = true }
|
||||
};
|
||||
|
||||
container.Resolve<NewznabProvider>().InitializeNewznabIndexers(newznabIndexers);
|
||||
|
||||
container.Resolve<JobProvider>().Initialize();
|
||||
container.Resolve<WebTimer>().StartTimer(30);
|
||||
|
||||
var notifiers = container.Resolve<IEnumerable<ExternalNotificationBase>>();
|
||||
container.Resolve<ExternalNotificationProvider>().InitializeNotifiers(notifiers.ToList());
|
||||
|
||||
var providers = container.Resolve<IEnumerable<MetadataBase>>();
|
||||
container.Resolve<MetadataProvider>().Initialize(providers.ToList());
|
||||
|
||||
//SignalR
|
||||
GlobalHost.DependencyResolver = new AutofacSignalrDependencyResolver(container.BeginLifetimeScope("SignalR"));
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
private static void ShutDown()
|
||||
{
|
||||
logger.Info("Shutting down application...");
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using NLog.Config;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NLog.Targets;
|
||||
using NLog.Targets.Wrappers;
|
||||
@ -14,7 +13,6 @@ public class DatabaseTarget : Target
|
||||
{
|
||||
private readonly IDatabase _database;
|
||||
|
||||
[Inject]
|
||||
public DatabaseTarget(IDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
|
@ -1,13 +1,11 @@
|
||||
using System.Data.Common;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
|
||||
namespace NzbDrone.Core.Instrumentation
|
||||
{
|
||||
public class LogDbContext : DbContext
|
||||
{
|
||||
[Inject]
|
||||
public LogDbContext(DbConnection connection)
|
||||
: base(connection, false)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -23,7 +22,6 @@ public class AppUpdateJob : IJob
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public AppUpdateJob(UpdateProvider updateProvider, EnvironmentProvider environmentProvider, DiskProvider diskProvider,
|
||||
HttpProvider httpProvider, ProcessProvider processProvider, ArchiveProvider archiveProvider, ConfigFileProvider configFileProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -20,7 +19,6 @@ public class BacklogSearchJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public BacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
||||
SeasonSearchJob seasonSearchJob, ConfigProvider configProvider)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
@ -19,7 +18,6 @@ public class BannerDownloadJob : IJob
|
||||
|
||||
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
|
||||
|
||||
[Inject]
|
||||
public BannerDownloadJob(SeriesProvider seriesProvider, BannerProvider bannerProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -12,7 +11,6 @@ public class CleanupRecycleBinJob : IJob
|
||||
{
|
||||
private readonly RecycleBinProvider _recycleBinProvider;
|
||||
|
||||
[Inject]
|
||||
public CleanupRecycleBinJob(RecycleBinProvider recycleBinProvider)
|
||||
{
|
||||
_recycleBinProvider = recycleBinProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -17,7 +16,6 @@ public class ConvertEpisodeJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public ConvertEpisodeJob(HandbrakeProvider handbrakeProvider, AtomicParsleyProvider atomicParsleyProvider,
|
||||
EpisodeProvider episodeProvider)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
@ -15,7 +14,6 @@ public class DeleteSeriesJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public DeleteSeriesJob(SeriesProvider seriesProvider, RecycleBinProvider recycleBinProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
@ -18,7 +17,6 @@ public class DiskScanJob : IJob
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public DiskScanJob(SeriesProvider seriesProvider, DiskScanProvider diskScanProvider,
|
||||
ConfigProvider configProvider)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -12,7 +11,6 @@ public class EmptyRecycleBinJob : IJob
|
||||
{
|
||||
private readonly RecycleBinProvider _recycleBinProvider;
|
||||
|
||||
[Inject]
|
||||
public EmptyRecycleBinJob(RecycleBinProvider recycleBinProvider)
|
||||
{
|
||||
_recycleBinProvider = recycleBinProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
@ -10,7 +9,6 @@ public class EpisodeSearchJob : IJob
|
||||
{
|
||||
private readonly SearchProvider _searchProvider;
|
||||
|
||||
[Inject]
|
||||
public EpisodeSearchJob(SearchProvider searchProvider)
|
||||
{
|
||||
_searchProvider = searchProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -28,7 +27,6 @@ public class ImportNewSeriesJob : IJob
|
||||
|
||||
private List<int> _attemptedSeries;
|
||||
|
||||
[Inject]
|
||||
public ImportNewSeriesJob(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
|
||||
MediaFileProvider mediaFileProvider, UpdateInfoJob updateInfoJob,
|
||||
DiskScanJob diskScanJob, BannerDownloadJob bannerDownloadJob,
|
||||
|
@ -7,7 +7,6 @@
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -25,7 +24,7 @@ public class JobProvider
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IDatabase _database;
|
||||
private readonly NotificationProvider _notificationProvider;
|
||||
private readonly IList<IJob> _jobs;
|
||||
private readonly IEnumerable<IJob> _jobs;
|
||||
|
||||
private Thread _jobThread;
|
||||
public Stopwatch StopWatch { get; private set; }
|
||||
@ -36,8 +35,7 @@ public class JobProvider
|
||||
private ProgressNotification _notification;
|
||||
|
||||
|
||||
[Inject]
|
||||
public JobProvider(IDatabase database, NotificationProvider notificationProvider, IList<IJob> jobs)
|
||||
public JobProvider(IDatabase database, NotificationProvider notificationProvider, IEnumerable<IJob> jobs)
|
||||
{
|
||||
StopWatch = new Stopwatch();
|
||||
_database = database;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -19,7 +18,6 @@ public class PastWeekBacklogSearchJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public PastWeekBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
||||
ConfigProvider configProvider)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -17,7 +16,6 @@ public class PostDownloadScanJob : IJob
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly DiskProvider _diskProvider;
|
||||
|
||||
[Inject]
|
||||
public PostDownloadScanJob(PostDownloadProvider postDownloadProvider,ConfigProvider configProvider, DiskProvider diskProvider)
|
||||
{
|
||||
_postDownloadProvider = postDownloadProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -19,7 +18,6 @@ public class RecentBacklogSearchJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RecentBacklogSearchJob(EpisodeProvider episodeProvider, EpisodeSearchJob episodeSearchJob,
|
||||
ConfigProvider configProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -17,7 +16,6 @@ public class RefreshEpisodeMetadata : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RefreshEpisodeMetadata(MediaFileProvider mediaFileProvider, SeriesProvider seriesProvider,
|
||||
MetadataProvider metadataProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -19,7 +18,6 @@ public class RenameSeasonJob : IJob
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RenameSeasonJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
|
||||
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider,
|
||||
MetadataProvider metadataProvider)
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Linq;
|
||||
using System;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -19,7 +18,6 @@ public class RenameSeriesJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RenameSeriesJob(MediaFileProvider mediaFileProvider, DiskScanProvider diskScanProvider,
|
||||
ExternalNotificationProvider externalNotificationProvider, SeriesProvider seriesProvider,
|
||||
MetadataProvider metadataProvider)
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
@ -26,7 +25,6 @@ public class RssSyncJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RssSyncJob(DownloadProvider downloadProvider, IndexerProvider indexerProvider,
|
||||
MonitoredEpisodeSpecification isMonitoredEpisodeSpecification, AllowedDownloadSpecification allowedDownloadSpecification,
|
||||
UpgradeHistorySpecification upgradeHistorySpecification, ConfigProvider configProvider)
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
@ -16,7 +15,6 @@ public class SearchHistoryCleanupJob : IJob
|
||||
private readonly SearchHistoryProvider _searchHistoryProvider;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public SearchHistoryCleanupJob(SearchHistoryProvider searchHistoryProvider)
|
||||
{
|
||||
_searchHistoryProvider = searchHistoryProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -17,7 +16,6 @@ public class SeasonSearchJob : IJob
|
||||
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public SeasonSearchJob(SearchProvider searchProvider, EpisodeSearchJob episodeSearchJob,
|
||||
EpisodeProvider episodeProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -16,7 +15,6 @@ public class SeriesSearchJob : IJob
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public SeriesSearchJob(SeasonSearchJob seasonSearchJob,
|
||||
SeasonProvider seasonProvider)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
|
||||
@ -10,7 +9,6 @@ public class TrimLogsJob : IJob
|
||||
{
|
||||
private readonly LogProvider _logProvider;
|
||||
|
||||
[Inject]
|
||||
public TrimLogsJob(LogProvider logProvider)
|
||||
{
|
||||
_logProvider = logProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -19,7 +18,6 @@ public class UpdateInfoJob : IJob
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public UpdateInfoJob(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
|
||||
ReferenceDataProvider referenceDataProvider, ConfigProvider configProvider)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
@ -10,7 +9,6 @@ public class UpdateSceneMappingsJob : IJob
|
||||
{
|
||||
private readonly SceneMappingProvider _sceneNameMappingProvider;
|
||||
|
||||
[Inject]
|
||||
public UpdateSceneMappingsJob(SceneMappingProvider sceneNameMappingProvider)
|
||||
{
|
||||
_sceneNameMappingProvider = sceneNameMappingProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
@ -16,7 +15,6 @@ public class XemUpdateJob : IJob
|
||||
|
||||
private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public XemUpdateJob(XemProvider xemProvider)
|
||||
{
|
||||
_xemProvider = xemProvider;
|
||||
|
@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Ninject;
|
||||
using SignalR;
|
||||
|
||||
namespace NzbDrone.Core
|
||||
{
|
||||
public class NinjectDependencyResolver : DefaultDependencyResolver
|
||||
{
|
||||
private readonly IKernel _kernel;
|
||||
|
||||
public NinjectDependencyResolver(IKernel kernel)
|
||||
{
|
||||
if (kernel == null)
|
||||
{
|
||||
throw new ArgumentNullException("kernel");
|
||||
}
|
||||
|
||||
_kernel = kernel;
|
||||
}
|
||||
|
||||
public override object GetService(Type serviceType)
|
||||
{
|
||||
return _kernel.TryGet(serviceType) ?? base.GetService(serviceType);
|
||||
}
|
||||
|
||||
public override IEnumerable<object> GetServices(Type serviceType)
|
||||
{
|
||||
return _kernel.GetAll(serviceType).Concat(base.GetServices(serviceType));
|
||||
}
|
||||
}
|
||||
}
|
@ -123,6 +123,12 @@
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration">
|
||||
<HintPath>..\packages\Autofac.2.6.3.862\lib\NET40\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DataTables.Mvc.Core, Version=0.1.0.85, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\DataTables.Mvc.Core.0.1.0.85\lib\DataTables.Mvc.Core.dll</HintPath>
|
||||
@ -167,10 +173,6 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Ninject, Version=3.0.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Ninject.3.0.1.10\lib\net40\Ninject.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
@ -316,7 +318,7 @@
|
||||
<Compile Include="Model\Xem\XemResult.cs" />
|
||||
<Compile Include="Model\Xem\XemSceneTvdbMapping.cs" />
|
||||
<Compile Include="Model\Xem\XemValues.cs" />
|
||||
<Compile Include="NinjectDependencyResolver.cs" />
|
||||
<Compile Include="AutofacSignalrDependencyResolver.cs" />
|
||||
<Compile Include="Providers\BannerProvider.cs" />
|
||||
<Compile Include="Providers\DecisionEngine\AllowedReleaseGroupSpecification.cs" />
|
||||
<Compile Include="Providers\DecisionEngine\CustomStartDateSpecification.cs" />
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Linq;
|
||||
using Ionic.Zip;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
|
||||
namespace NzbDrone.Core.Providers
|
||||
@ -12,7 +11,6 @@ public class BackupProvider
|
||||
private readonly EnvironmentProvider _environmentProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public BackupProvider(EnvironmentProvider environmentProvider)
|
||||
{
|
||||
_environmentProvider = environmentProvider;
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -20,7 +19,6 @@ public class BannerProvider
|
||||
|
||||
private const string BANNER_URL_PREFIX = "http://www.thetvdb.com/banners/";
|
||||
|
||||
[Inject]
|
||||
public BannerProvider(HttpProvider httpProvider, EnvironmentProvider environmentProvider,
|
||||
DiskProvider diskProvider)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
using System.Linq;
|
||||
using Ionic.Zip;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
|
||||
namespace NzbDrone.Core.Providers.Core
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Sabnzbd;
|
||||
@ -18,7 +17,6 @@ public class ConfigProvider
|
||||
|
||||
private readonly IDatabase _database;
|
||||
|
||||
[Inject]
|
||||
public ConfigProvider(IDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
|
||||
namespace NzbDrone.Core.Providers.Core
|
||||
{
|
||||
@ -12,7 +11,6 @@ public class UdpProvider
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public UdpProvider()
|
||||
{
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
@ -11,7 +10,6 @@ public class AcceptableSizeSpecification
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public AcceptableSizeSpecification(QualityTypeProvider qualityTypeProvider, EpisodeProvider episodeProvider)
|
||||
{
|
||||
_qualityTypeProvider = qualityTypeProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository.Search;
|
||||
|
||||
@ -17,7 +16,6 @@ public class AllowedDownloadSpecification
|
||||
private readonly CustomStartDateSpecification _customStartDateSpecification;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public AllowedDownloadSpecification(QualityAllowedByProfileSpecification qualityAllowedByProfileSpecification,
|
||||
UpgradeDiskSpecification upgradeDiskSpecification, AcceptableSizeSpecification acceptableSizeSpecification,
|
||||
AlreadyInQueueSpecification alreadyInQueueSpecification, RetentionSpecification retentionSpecification,
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
@ -12,7 +11,6 @@ public class AllowedReleaseGroupSpecification
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public AllowedReleaseGroupSpecification(ConfigProvider configProvider)
|
||||
{
|
||||
_configProvider = configProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
@ -11,7 +10,6 @@ public class AlreadyInQueueSpecification
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public AlreadyInQueueSpecification(DownloadProvider downloadProvider)
|
||||
{
|
||||
_downloadProvider = downloadProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
@ -11,7 +10,6 @@ public class MonitoredEpisodeSpecification
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public MonitoredEpisodeSpecification(SeriesProvider seriesProvider, EpisodeProvider episodeProvider)
|
||||
{
|
||||
_seriesProvider = seriesProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
@ -11,7 +10,6 @@ public class RetentionSpecification
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public RetentionSpecification(ConfigProvider configProvider)
|
||||
{
|
||||
_configProvider = configProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
@ -11,7 +10,6 @@ public class UpgradeDiskSpecification
|
||||
private readonly QualityUpgradeSpecification _qualityUpgradeSpecification;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public UpgradeDiskSpecification(EpisodeProvider episodeProvider, QualityUpgradeSpecification qualityUpgradeSpecification)
|
||||
{
|
||||
_episodeProvider = episodeProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
@ -12,7 +11,6 @@ public class UpgradeHistorySpecification
|
||||
private readonly QualityUpgradeSpecification _qualityUpgradeSpecification;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public UpgradeHistorySpecification(EpisodeProvider episodeProvider, HistoryProvider historyProvider, QualityUpgradeSpecification qualityUpgradeSpecification)
|
||||
{
|
||||
_episodeProvider = episodeProvider;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Core.Providers.DecisionEngine
|
||||
@ -10,7 +9,6 @@ public class UpgradePossibleSpecification
|
||||
private readonly QualityProvider _qualityProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public UpgradePossibleSpecification(QualityProvider qualityProvider)
|
||||
{
|
||||
_qualityProvider = qualityProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
@ -25,7 +24,6 @@ public class DiskScanProvider
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly RecycleBinProvider _recycleBinProvider;
|
||||
|
||||
[Inject]
|
||||
public DiskScanProvider(DiskProvider diskProvider, EpisodeProvider episodeProvider,
|
||||
SeriesProvider seriesProvider, MediaFileProvider mediaFileProvider,
|
||||
ExternalNotificationProvider externalNotificationProvider, DownloadProvider downloadProvider,
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -20,7 +19,6 @@ public class BlackholeProvider : IDownloadClient
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public BlackholeProvider(ConfigProvider configProvider, HttpProvider httpProvider,
|
||||
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -19,7 +18,6 @@ public class PneumaticProvider : IDownloadClient
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public PneumaticProvider(ConfigProvider configProvider, HttpProvider httpProvider,
|
||||
DiskProvider diskProvider, UpgradeHistorySpecification upgradeHistorySpecification)
|
||||
{
|
||||
|
@ -6,7 +6,6 @@
|
||||
using System.Web;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
@ -21,7 +20,6 @@ public class SabProvider : IDownloadClient
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private readonly HttpProvider _httpProvider;
|
||||
|
||||
[Inject]
|
||||
public SabProvider(ConfigProvider configProvider, HttpProvider httpProvider)
|
||||
{
|
||||
_configProvider = configProvider;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -23,7 +22,6 @@ public class DownloadProvider
|
||||
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public DownloadProvider(SabProvider sabProvider, HistoryProvider historyProvider,
|
||||
EpisodeProvider episodeProvider, ExternalNotificationProvider externalNotificationProvider,
|
||||
ConfigProvider configProvider, BlackholeProvider blackholeProvider,
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -20,7 +19,6 @@ public class EpisodeProvider
|
||||
private readonly SeasonProvider _seasonProvider;
|
||||
private readonly IDatabase _database;
|
||||
|
||||
[Inject]
|
||||
public EpisodeProvider(IDatabase database, TvDbProvider tvDbProviderProvider,
|
||||
SeasonProvider seasonProvider)
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.ExternalNotification;
|
||||
@ -17,7 +16,6 @@ public class ExternalNotificationProvider
|
||||
|
||||
private IEnumerable<ExternalNotificationBase> _notifiers;
|
||||
|
||||
[Inject]
|
||||
public ExternalNotificationProvider(IDatabase database, IEnumerable<ExternalNotificationBase> notifiers)
|
||||
{
|
||||
_database = database;
|
||||
|
@ -3,7 +3,6 @@
|
||||
using System.Linq;
|
||||
using DataTables.Mvc.Core.Helpers;
|
||||
using DataTables.Mvc.Core.Models;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -18,7 +17,6 @@ public class HistoryProvider
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
|
||||
[Inject]
|
||||
public HistoryProvider(IDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
public class FileSharingTalk : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public FileSharingTalk(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.Net;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
@ -21,7 +20,6 @@ public abstract class IndexerBase
|
||||
protected static readonly Regex TitleSearchRegex = new Regex(@"[\W]", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
protected static readonly Regex RemoveThe = new Regex(@"^the\s", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
[Inject]
|
||||
protected IndexerBase(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
{
|
||||
_httpProvider = httpProvider;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -13,7 +12,6 @@ public class Newznab : IndexerBase
|
||||
{
|
||||
private readonly NewznabProvider _newznabProvider;
|
||||
|
||||
[Inject]
|
||||
public Newznab(HttpProvider httpProvider, ConfigProvider configProvider, NewznabProvider newznabProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
public class NzbClub : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public NzbClub(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
public class NzbIndex : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public NzbIndex(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
public class NzbsRUs : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public NzbsRUs(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
|
||||
{
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Model.Nzbx;
|
||||
@ -16,7 +15,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
class Nzbx : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public Nzbx(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -13,7 +12,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
class Omgwtfnzbs : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public Omgwtfnzbs(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
: base(httpProvider, configProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ServiceModel.Syndication;
|
||||
using System.Text.RegularExpressions;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -11,7 +10,6 @@ namespace NzbDrone.Core.Providers.Indexer
|
||||
{
|
||||
public class Wombles : IndexerBase
|
||||
{
|
||||
[Inject]
|
||||
public Wombles(HttpProvider httpProvider, ConfigProvider configProvider) : base(httpProvider, configProvider)
|
||||
{
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -16,7 +15,6 @@ public class IndexerProvider
|
||||
|
||||
private IEnumerable<IndexerBase> _indexers;
|
||||
|
||||
[Inject]
|
||||
public IndexerProvider(IDatabase database, IEnumerable<IndexerBase> indexers)
|
||||
{
|
||||
_database = database;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
@ -20,7 +19,6 @@ public class MediaFileProvider
|
||||
private readonly IDatabase _database;
|
||||
private readonly EpisodeProvider _episodeProvider;
|
||||
|
||||
[Inject]
|
||||
public MediaFileProvider(EpisodeProvider episodeProvider, ConfigProvider configProvider, IDatabase database)
|
||||
{
|
||||
_episodeProvider = episodeProvider;
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.ExternalNotification;
|
||||
@ -20,7 +19,6 @@ public class MetadataProvider
|
||||
private IEnumerable<MetadataBase> _metadataProviders;
|
||||
private readonly TvDbProvider _tvDbProvider;
|
||||
|
||||
[Inject]
|
||||
public MetadataProvider(IDatabase database, IEnumerable<MetadataBase> metadataProviders,
|
||||
TvDbProvider tvDbProvider)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Providers.Indexer;
|
||||
using NzbDrone.Core.Repository;
|
||||
@ -15,7 +14,6 @@ public class NewznabProvider
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private readonly IDatabase _database;
|
||||
|
||||
[Inject]
|
||||
public NewznabProvider(IDatabase database)
|
||||
{
|
||||
_database = database;
|
||||
|
@ -5,7 +5,6 @@
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
||||
@ -17,7 +16,6 @@ public class PlexProvider
|
||||
private readonly ConfigProvider _configProvider;
|
||||
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Inject]
|
||||
public PlexProvider(HttpProvider httpProvider, ConfigProvider configProvider)
|
||||
{
|
||||
_httpProvider = httpProvider;
|
||||
|
@ -3,7 +3,6 @@
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NLog;
|
||||
using Ninject;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Model;
|
||||
|
||||
@ -19,7 +18,6 @@ public class PostDownloadProvider
|
||||
private readonly SeriesProvider _seriesProvider;
|
||||
private readonly MetadataProvider _metadataProvider;
|
||||
|
||||
[Inject]
|
||||
public PostDownloadProvider(DiskProvider diskProvider, DiskScanProvider diskScanProvider,
|
||||
SeriesProvider seriesProvider, MetadataProvider metadataProvider)
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user