made RegisterResources a Task
This commit is contained in:
parent
0268dcec05
commit
46480f1187
|
@ -154,30 +154,27 @@ namespace MediaBrowser.Common.Implementations
|
||||||
/// Inits this instance.
|
/// Inits this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public virtual Task Init()
|
public virtual async Task Init()
|
||||||
{
|
{
|
||||||
return Task.Run(() =>
|
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
|
||||||
{
|
|
||||||
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
|
|
||||||
|
|
||||||
Logger = LogManager.GetLogger("App");
|
|
||||||
|
|
||||||
DiscoverTypes();
|
Logger = LogManager.GetLogger("App");
|
||||||
|
|
||||||
LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info);
|
DiscoverTypes();
|
||||||
|
|
||||||
Logger.Info("Version {0} initializing", ApplicationVersion);
|
LogManager.ReloadLogger(ConfigurationManager.CommonConfiguration.EnableDebugLevelLogging ? LogSeverity.Debug : LogSeverity.Info);
|
||||||
|
|
||||||
Kernel = GetKernel();
|
Logger.Info("Version {0} initializing", ApplicationVersion);
|
||||||
|
|
||||||
RegisterResources();
|
Kernel = GetKernel();
|
||||||
|
|
||||||
FindParts();
|
await RegisterResources().ConfigureAwait(false);
|
||||||
|
|
||||||
Task.Run(() => ConfigureAutoRunAtStartup());
|
FindParts();
|
||||||
|
|
||||||
Kernel.Init();
|
Task.Run(() => ConfigureAutoRunAtStartup());
|
||||||
});
|
|
||||||
|
Kernel.Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -224,44 +221,47 @@ namespace MediaBrowser.Common.Implementations
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers resources that classes will depend on
|
/// Registers resources that classes will depend on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual void RegisterResources()
|
protected virtual Task RegisterResources()
|
||||||
{
|
{
|
||||||
RegisterSingleInstance(ConfigurationManager);
|
return Task.Run(() =>
|
||||||
RegisterSingleInstance<IApplicationHost>(this);
|
{
|
||||||
|
RegisterSingleInstance(ConfigurationManager);
|
||||||
|
RegisterSingleInstance<IApplicationHost>(this);
|
||||||
|
|
||||||
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
RegisterSingleInstance<IApplicationPaths>(ApplicationPaths);
|
||||||
|
|
||||||
var networkManager = new NetworkManager();
|
var networkManager = new NetworkManager();
|
||||||
|
|
||||||
var serverManager = new ServerManager.ServerManager(this, Kernel, networkManager, JsonSerializer, Logger, ConfigurationManager);
|
var serverManager = new ServerManager.ServerManager(this, Kernel, networkManager, JsonSerializer, Logger, ConfigurationManager);
|
||||||
|
|
||||||
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger, serverManager);
|
TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger, serverManager);
|
||||||
|
|
||||||
RegisterSingleInstance(JsonSerializer);
|
RegisterSingleInstance(JsonSerializer);
|
||||||
RegisterSingleInstance(XmlSerializer);
|
RegisterSingleInstance(XmlSerializer);
|
||||||
|
|
||||||
RegisterSingleInstance(LogManager);
|
RegisterSingleInstance(LogManager);
|
||||||
RegisterSingleInstance(Logger);
|
RegisterSingleInstance(Logger);
|
||||||
|
|
||||||
RegisterSingleInstance(Kernel);
|
RegisterSingleInstance(Kernel);
|
||||||
|
|
||||||
RegisterSingleInstance(TaskManager);
|
RegisterSingleInstance(TaskManager);
|
||||||
RegisterSingleInstance<IWebSocketServer>(() => new AlchemyServer(Logger));
|
RegisterSingleInstance<IWebSocketServer>(() => new AlchemyServer(Logger));
|
||||||
RegisterSingleInstance(ProtobufSerializer);
|
RegisterSingleInstance(ProtobufSerializer);
|
||||||
RegisterSingleInstance<IUdpServer>(new UdpServer(Logger), false);
|
RegisterSingleInstance<IUdpServer>(new UdpServer(Logger), false);
|
||||||
|
|
||||||
var httpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger);
|
var httpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger);
|
||||||
|
|
||||||
RegisterSingleInstance<IHttpClient>(httpClient);
|
RegisterSingleInstance<IHttpClient>(httpClient);
|
||||||
|
|
||||||
RegisterSingleInstance<INetworkManager>(networkManager);
|
RegisterSingleInstance<INetworkManager>(networkManager);
|
||||||
RegisterSingleInstance<IServerManager>(serverManager);
|
RegisterSingleInstance<IServerManager>(serverManager);
|
||||||
|
|
||||||
SecurityManager = new PluginSecurityManager(Kernel, httpClient, JsonSerializer, ApplicationPaths);
|
SecurityManager = new PluginSecurityManager(Kernel, httpClient, JsonSerializer, ApplicationPaths);
|
||||||
|
|
||||||
RegisterSingleInstance(SecurityManager);
|
RegisterSingleInstance(SecurityManager);
|
||||||
|
|
||||||
RegisterSingleInstance<IPackageManager>(new PackageManager(SecurityManager, networkManager, httpClient, ApplicationPaths, JsonSerializer, Logger));
|
RegisterSingleInstance<IPackageManager>(new PackageManager(SecurityManager, networkManager, httpClient, ApplicationPaths, JsonSerializer, Logger));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -95,9 +95,9 @@ namespace MediaBrowser.ServerApplication
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Registers resources that classes will depend on
|
/// Registers resources that classes will depend on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected override void RegisterResources()
|
protected override async Task RegisterResources()
|
||||||
{
|
{
|
||||||
base.RegisterResources();
|
await base.RegisterResources().ConfigureAwait(false);
|
||||||
|
|
||||||
RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);
|
RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common.Internal</id>
|
<id>MediaBrowser.Common.Internal</id>
|
||||||
<version>3.0.30</version>
|
<version>3.0.31</version>
|
||||||
<title>MediaBrowser.Common.Internal</title>
|
<title>MediaBrowser.Common.Internal</title>
|
||||||
<authors>Luke</authors>
|
<authors>Luke</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
|
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.30" />
|
<dependency id="MediaBrowser.Common" version="3.0.31" />
|
||||||
<dependency id="NLog" version="2.0.0.2000" />
|
<dependency id="NLog" version="2.0.0.2000" />
|
||||||
<dependency id="ServiceStack" version="3.9.38" />
|
<dependency id="ServiceStack" version="3.9.38" />
|
||||||
<dependency id="ServiceStack.Api.Swagger" version="3.9.38" />
|
<dependency id="ServiceStack.Api.Swagger" version="3.9.38" />
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Common</id>
|
<id>MediaBrowser.Common</id>
|
||||||
<version>3.0.30</version>
|
<version>3.0.31</version>
|
||||||
<title>MediaBrowser.Common</title>
|
<title>MediaBrowser.Common</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>MediaBrowser.Server.Core</id>
|
<id>MediaBrowser.Server.Core</id>
|
||||||
<version>3.0.30</version>
|
<version>3.0.31</version>
|
||||||
<title>Media Browser.Server.Core</title>
|
<title>Media Browser.Server.Core</title>
|
||||||
<authors>Media Browser Team</authors>
|
<authors>Media Browser Team</authors>
|
||||||
<owners>ebr,Luke,scottisafool</owners>
|
<owners>ebr,Luke,scottisafool</owners>
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||||
<copyright>Copyright © Media Browser 2013</copyright>
|
<copyright>Copyright © Media Browser 2013</copyright>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency id="MediaBrowser.Common" version="3.0.30" />
|
<dependency id="MediaBrowser.Common" version="3.0.31" />
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user