mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
Removed duplicated code from ContainerBuilders
This commit is contained in:
parent
8252a2a60f
commit
6ae5829439
@ -13,12 +13,15 @@ public abstract class ContainerBuilderBase
|
||||
{
|
||||
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 @@ public static IContainer BuildContainer(StartupContext args)
|
||||
var assemblies = new List<string>
|
||||
{
|
||||
"NzbDrone.Host",
|
||||
"NzbDrone.Common",
|
||||
"NzbDrone.Core",
|
||||
"NzbDrone.Api",
|
||||
"NzbDrone.SignalR"
|
||||
};
|
||||
|
||||
if (OsInfo.IsWindows)
|
||||
{
|
||||
assemblies.Add("NzbDrone.Windows");
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
assemblies.Add("NzbDrone.Mono");
|
||||
}
|
||||
|
||||
return new MainAppContainerBuilder(args, assemblies.ToArray()).Container;
|
||||
return new MainAppContainerBuilder(args, assemblies).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 @@ public static IContainer Build(IStartupContext startupContext)
|
||||
{
|
||||
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
Block a user