From 6c7175e33d258ff2e65735f68cb05f110a8d2306 Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Mon, 23 Jul 2012 11:05:30 -0400 Subject: Added an api call to pull down user configuration --- MediaBrowser.Common/Kernel/BaseKernel.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'MediaBrowser.Common/Kernel/BaseKernel.cs') diff --git a/MediaBrowser.Common/Kernel/BaseKernel.cs b/MediaBrowser.Common/Kernel/BaseKernel.cs index d6c13ce38..47e5d2c94 100644 --- a/MediaBrowser.Common/Kernel/BaseKernel.cs +++ b/MediaBrowser.Common/Kernel/BaseKernel.cs @@ -12,7 +12,8 @@ namespace MediaBrowser.Common.Kernel /// /// Represents a shared base kernel for both the UI and server apps /// - public abstract class BaseKernel + public abstract class BaseKernel + where TConfigurationContorllerType : ConfigurationController, new() where TConfigurationType : BaseConfiguration, new() { /// @@ -23,7 +24,7 @@ namespace MediaBrowser.Common.Kernel /// /// Gets the current configuration /// - public TConfigurationType Configuration { get; private set; } + public TConfigurationContorllerType ConfigurationController { get; private set; } /// /// Both the UI and server will have a built-in HttpServer. @@ -38,19 +39,12 @@ namespace MediaBrowser.Common.Kernel /// protected KernelContext KernelContext { get { return KernelContext.Server; } } - protected virtual string HttpServerUrlPrefix - { - get - { - return "http://+:" + Configuration.HttpServerPortNumber + "/mediabrowser/"; - } - } - public BaseKernel() { ProgramDataPath = GetProgramDataPath(); PluginController = new PluginController() { PluginsPath = Path.Combine(ProgramDataPath, "Plugins") }; + ConfigurationController = new TConfigurationContorllerType() { Path = Path.Combine(ProgramDataPath, "config.js") }; Logger.LoggerInstance = new FileLogger(Path.Combine(ProgramDataPath, "Logs")); } @@ -67,7 +61,6 @@ namespace MediaBrowser.Common.Kernel /// /// Gets the path to the application's ProgramDataFolder /// - /// private string GetProgramDataPath() { string programDataPath = ConfigurationManager.AppSettings["ProgramDataPath"]; @@ -94,9 +87,9 @@ namespace MediaBrowser.Common.Kernel private void ReloadConfiguration() { // Deserialize config - Configuration = GetConfiguration(ProgramDataPath); + ConfigurationController.Reload(); - Logger.LoggerInstance.LogSeverity = Configuration.LogSeverity; + Logger.LoggerInstance.LogSeverity = ConfigurationController.Configuration.LogSeverity; } private void ReloadHttpServer() @@ -106,7 +99,7 @@ namespace MediaBrowser.Common.Kernel HttpServer.Dispose(); } - HttpServer = new HttpServer("http://+:" + Configuration.HttpServerPortNumber + "/mediabrowser/"); + HttpServer = new HttpServer("http://+:" + ConfigurationController.Configuration.HttpServerPortNumber + "/mediabrowser/"); } protected virtual void ReloadPlugins() -- cgit v1.2.3