Removed duplicated code from ContainerBuilders
This commit is contained in:
parent
8252a2a60f
commit
6ae5829439
|
@ -13,12 +13,15 @@ namespace NzbDrone.Common.Composition
|
|||
{
|
||||
private readonly List<Type> _loadedTypes;
|
||||
|
||||
public IContainer Container { get; private set; }
|
||||
protected IContainer Container { get; }
|
||||
|
||||
protected ContainerBuilderBase(IStartupContext args, params string[] assemblies)
|
||||
protected ContainerBuilderBase(IStartupContext args, List<string> assemblies)
|
||||
{
|
||||
_loadedTypes = new List<Type>();
|
||||
|
||||
assemblies.Add(OsInfo.IsWindows ? "NzbDrone.Windows" : "NzbDrone.Mono");
|
||||
assemblies.Add("NzbDrone.Common");
|
||||
|
||||
foreach (var assembly in assemblies)
|
||||
{
|
||||
_loadedTypes.AddRange(Assembly.Load(assembly).GetTypes());
|
||||
|
|
|
@ -15,26 +15,15 @@ namespace NzbDrone.Host
|
|||
var assemblies = new List<string>
|
||||
{
|
||||
"NzbDrone.Host",
|
||||
"NzbDrone.Common",
|
||||
"NzbDrone.Core",
|
||||
"NzbDrone.Api",
|
||||
"NzbDrone.SignalR"
|
||||
};
|
||||
|
||||
if (OsInfo.IsWindows)
|
||||
{
|
||||
assemblies.Add("NzbDrone.Windows");
|
||||
return new MainAppContainerBuilder(args, assemblies).Container;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
assemblies.Add("NzbDrone.Mono");
|
||||
}
|
||||
|
||||
return new MainAppContainerBuilder(args, assemblies.ToArray()).Container;
|
||||
}
|
||||
|
||||
private MainAppContainerBuilder(StartupContext args, string[] assemblies)
|
||||
private MainAppContainerBuilder(StartupContext args, List<string> assemblies)
|
||||
: base(args, assemblies)
|
||||
{
|
||||
AutoRegisterImplementations<NzbDronePersistentConnection>();
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace NzbDrone.Update
|
|||
{
|
||||
public class UpdateContainerBuilder : ContainerBuilderBase
|
||||
{
|
||||
private UpdateContainerBuilder(IStartupContext startupContext, string[] assemblies)
|
||||
private UpdateContainerBuilder(IStartupContext startupContext, List<string> assemblies)
|
||||
: base(startupContext, assemblies)
|
||||
{
|
||||
Container.Register<IHttpDispatcher, FallbackHttpDispatcher>();
|
||||
|
@ -17,22 +17,10 @@ namespace NzbDrone.Update
|
|||
{
|
||||
var assemblies = new List<string>
|
||||
{
|
||||
"NzbDrone.Update",
|
||||
"NzbDrone.Common"
|
||||
"NzbDrone.Update"
|
||||
};
|
||||
|
||||
if (OsInfo.IsWindows)
|
||||
{
|
||||
assemblies.Add("NzbDrone.Windows");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
assemblies.Add("NzbDrone.Mono");
|
||||
}
|
||||
|
||||
return new UpdateContainerBuilder(startupContext, assemblies.ToArray()).Container;
|
||||
return new UpdateContainerBuilder(startupContext, assemblies).Container;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue