Added IProgress to Kernel.Init

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-07-30 00:06:05 -04:00
parent 5d88dc8575
commit 882e20e9a5
4 changed files with 40 additions and 6 deletions

View File

@@ -11,13 +11,14 @@ using MediaBrowser.Common.Json;
using MediaBrowser.Common.Logging;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Progress;
namespace MediaBrowser.Common.Kernel
{
/// <summary>
/// Represents a shared base kernel for both the UI and server apps
/// </summary>
public abstract class BaseKernel<TConfigurationType>
public abstract class BaseKernel<TConfigurationType> : IDisposable
where TConfigurationType : BaseApplicationConfiguration, new()
{
/// <summary>
@@ -76,12 +77,12 @@ namespace MediaBrowser.Common.Kernel
Logger.LoggerInstance = new FileLogger(Path.Combine(ProgramDataPath, "Logs"));
}
public virtual void Init()
public virtual void Init(IProgress<TaskProgress> progress)
{
ReloadConfiguration();
ReloadHttpServer();
ReloadComposableParts();
}
@@ -206,13 +207,18 @@ namespace MediaBrowser.Common.Kernel
/// Restarts the Http Server, or starts it if not currently running
/// </summary>
private void ReloadHttpServer()
{
DisposeHttpServer();
HttpServer = new HttpServer("http://+:" + Configuration.HttpServerPortNumber + "/mediabrowser/");
}
private void DisposeHttpServer()
{
if (HttpServer != null)
{
HttpServer.Dispose();
}
HttpServer = new HttpServer("http://+:" + Configuration.HttpServerPortNumber + "/mediabrowser/");
}
/// <summary>
@@ -234,5 +240,10 @@ namespace MediaBrowser.Common.Kernel
return null;
}
public void Dispose()
{
DisposeHttpServer();
}
}
}