1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-26 01:27:00 +00:00

fixed update again.

This commit is contained in:
kay.one 2013-08-15 20:32:23 -07:00
parent 06f5ff7cb8
commit 2f20aeaec5
4 changed files with 13 additions and 9 deletions

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Messaging; using NzbDrone.Common.Messaging;
using TinyIoC; using TinyIoC;
@ -14,8 +15,10 @@ public abstract class ContainerBuilderBase
public IContainer Container { get; private set; } public IContainer Container { get; private set; }
protected ContainerBuilderBase(params string[] assemblies) protected ContainerBuilderBase(IStartupArguments args, params string[] assemblies)
{ {
_loadedTypes = new List<Type>(); _loadedTypes = new List<Type>();
foreach (var assembly in assemblies) foreach (var assembly in assemblies)
@ -25,6 +28,7 @@ protected ContainerBuilderBase(params string[] assemblies)
Container = new Container(new TinyIoCContainer(), _loadedTypes); Container = new Container(new TinyIoCContainer(), _loadedTypes);
AutoRegisterInterfaces(); AutoRegisterInterfaces();
Container.Register(args);
} }
private void AutoRegisterInterfaces() private void AutoRegisterInterfaces()

View file

@ -17,9 +17,8 @@ public static IContainer BuildContainer(StartupArguments args)
} }
private MainAppContainerBuilder(StartupArguments args) private MainAppContainerBuilder(StartupArguments args)
: base("NzbDrone.Host", "NzbDrone.Common", "NzbDrone.Core", "NzbDrone.Api") : base(args, "NzbDrone.Host", "NzbDrone.Common", "NzbDrone.Core", "NzbDrone.Api")
{ {
Container.Register<IStartupArguments>(args);
AutoRegisterImplementations<NzbDronePersistentConnection>(); AutoRegisterImplementations<NzbDronePersistentConnection>();

View file

@ -29,13 +29,13 @@ public static void Main(string[] args)
try try
{ {
Console.WriteLine("Starting NzbDrone Update Client"); Console.WriteLine("Starting NzbDrone Update Client");
IgnoreCertErrorPolicy.Register(); IgnoreCertErrorPolicy.Register();
GlobalExceptionHandlers.Register(); GlobalExceptionHandlers.Register();
new LogglyTarget().Register(LogLevel.Trace); new LogglyTarget().Register(LogLevel.Trace);
_container = UpdateContainerBuilder.Build(); _container = UpdateContainerBuilder.Build(new StartupArguments(args));
logger.Info("Updating NzbDrone to version {0}", BuildInfo.Version); logger.Info("Updating NzbDrone to version {0}", BuildInfo.Version);
_container.Resolve<UpdateApp>().Start(args); _container.Resolve<UpdateApp>().Start(args);

View file

@ -1,18 +1,19 @@
using NzbDrone.Common.Composition; using NzbDrone.Common.Composition;
using NzbDrone.Common.EnvironmentInfo;
namespace NzbDrone.Update namespace NzbDrone.Update
{ {
public class UpdateContainerBuilder : ContainerBuilderBase public class UpdateContainerBuilder : ContainerBuilderBase
{ {
private UpdateContainerBuilder() private UpdateContainerBuilder(IStartupArguments startupArguments)
: base("NzbDrone.Update", "NzbDrone.Common") : base(startupArguments, "NzbDrone.Update", "NzbDrone.Common")
{ {
} }
public static IContainer Build() public static IContainer Build(IStartupArguments startupArguments)
{ {
return new UpdateContainerBuilder().Container; return new UpdateContainerBuilder(startupArguments).Container;
} }
} }
} }