made RegisterResources a Task
This commit is contained in:
parent
0268dcec05
commit
46480f1187
|
@ -154,30 +154,27 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// Inits this instance.
|
||||
/// </summary>
|
||||
/// <returns>Task.</returns>
|
||||
public virtual Task Init()
|
||||
public virtual async Task Init()
|
||||
{
|
||||
return Task.Run(() =>
|
||||
{
|
||||
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
|
||||
|
||||
Logger = LogManager.GetLogger("App");
|
||||
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
|
||||
|
||||
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>
|
||||
|
@ -224,44 +221,47 @@ namespace MediaBrowser.Common.Implementations
|
|||
/// <summary>
|
||||
/// Registers resources that classes will depend on
|
||||
/// </summary>
|
||||
protected virtual void RegisterResources()
|
||||
protected virtual Task RegisterResources()
|
||||
{
|
||||
RegisterSingleInstance(ConfigurationManager);
|
||||
RegisterSingleInstance<IApplicationHost>(this);
|
||||
return Task.Run(() =>
|
||||
{
|
||||
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(XmlSerializer);
|
||||
RegisterSingleInstance(JsonSerializer);
|
||||
RegisterSingleInstance(XmlSerializer);
|
||||
|
||||
RegisterSingleInstance(LogManager);
|
||||
RegisterSingleInstance(Logger);
|
||||
RegisterSingleInstance(LogManager);
|
||||
RegisterSingleInstance(Logger);
|
||||
|
||||
RegisterSingleInstance(Kernel);
|
||||
RegisterSingleInstance(Kernel);
|
||||
|
||||
RegisterSingleInstance(TaskManager);
|
||||
RegisterSingleInstance<IWebSocketServer>(() => new AlchemyServer(Logger));
|
||||
RegisterSingleInstance(ProtobufSerializer);
|
||||
RegisterSingleInstance<IUdpServer>(new UdpServer(Logger), false);
|
||||
RegisterSingleInstance(TaskManager);
|
||||
RegisterSingleInstance<IWebSocketServer>(() => new AlchemyServer(Logger));
|
||||
RegisterSingleInstance(ProtobufSerializer);
|
||||
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<IServerManager>(serverManager);
|
||||
RegisterSingleInstance<INetworkManager>(networkManager);
|
||||
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>
|
||||
|
|
|
@ -95,9 +95,9 @@ namespace MediaBrowser.ServerApplication
|
|||
/// <summary>
|
||||
/// Registers resources that classes will depend on
|
||||
/// </summary>
|
||||
protected override void RegisterResources()
|
||||
protected override async Task RegisterResources()
|
||||
{
|
||||
base.RegisterResources();
|
||||
await base.RegisterResources().ConfigureAwait(false);
|
||||
|
||||
RegisterSingleInstance<IServerApplicationPaths>(ApplicationPaths);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.30</version>
|
||||
<version>3.0.31</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<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>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<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="ServiceStack" 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">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.30</version>
|
||||
<version>3.0.31</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.30</version>
|
||||
<version>3.0.31</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.30" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.31" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user