1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Register Types in Updater

This commit is contained in:
Mark McDowall 2013-01-03 18:29:55 -08:00
parent be2a5ea754
commit 05aed27923
2 changed files with 9 additions and 12 deletions

View File

@ -3,10 +3,8 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using Autofac;
using Autofac.Core;
using DeskMetrics;
using NLog;
using NzbDrone.Common;
using NzbDrone.Core.Instrumentation;
@ -19,10 +17,7 @@
using NzbDrone.Core.Repository;
using PetaPoco;
using SignalR;
using SignalR.Hosting.AspNet;
using SignalR.Infrastructure;
using Connection = NzbDrone.Core.Datastore.Connection;
using Xbmc = NzbDrone.Core.Providers.ExternalNotification.Xbmc;
namespace NzbDrone.Core
{

View File

@ -12,7 +12,7 @@ public class Program
{
private readonly UpdateProvider _updateProvider;
private readonly ProcessProvider _processProvider;
private static IContainer _kernel;
private static IContainer _container;
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
@ -27,11 +27,13 @@ public static void Main(string[] args)
try
{
Console.WriteLine("Starting NzbDrone Update Client");
_kernel = new ContainerBuilder().Build();
var builder = new ContainerBuilder();
builder.RegisterAssemblyTypes(typeof(UpdateProvider).Assembly).SingleInstance();
_container = builder.Build();
InitLoggers();
logger.Info("Updating NzbDrone to version {0}", _kernel.Resolve<EnvironmentProvider>().Version);
_kernel.Resolve<Program>().Start(args);
logger.Info("Updating NzbDrone to version {0}", _container.Resolve<EnvironmentProvider>().Version);
_container.Resolve<Program>().Start(args);
}
catch (Exception e)
{
@ -46,8 +48,8 @@ private static void TransferUpdateLogs()
{
try
{
var environmentProvider = _kernel.Resolve<EnvironmentProvider>();
var diskProvider = _kernel.Resolve<DiskProvider>();
var environmentProvider = _container.Resolve<EnvironmentProvider>();
var diskProvider = _container.Resolve<DiskProvider>();
logger.Info("Copying log files to application directory.");
diskProvider.CopyDirectory(environmentProvider.GetSandboxLogFolder(), environmentProvider.GetUpdateLogFolder());
}
@ -59,7 +61,7 @@ private static void TransferUpdateLogs()
private static void InitLoggers()
{
ReportingService.RestProvider = _kernel.Resolve<RestProvider>();
ReportingService.RestProvider = _container.Resolve<RestProvider>();
ReportingService.SetupExceptronDriver();
LogConfiguration.RegisterRemote();