Slight re-work of ApplicationPaths so that we can have inherited versions for the UI and Server

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti
2012-08-18 16:38:02 -04:00
parent a508a997d9
commit 59a3dcc8c1
11 changed files with 312 additions and 329 deletions

View File

@@ -18,14 +18,17 @@ namespace MediaBrowser.Common.Kernel
/// <summary>
/// Represents a shared base kernel for both the UI and server apps
/// </summary>
public abstract class BaseKernel<TConfigurationType> : IDisposable
public abstract class BaseKernel<TConfigurationType, TApplicationPathsType> : IDisposable
where TConfigurationType : BaseApplicationConfiguration, new()
where TApplicationPathsType : BaseApplicationPaths, new()
{
/// <summary>
/// Gets the current configuration
/// </summary>
public TConfigurationType Configuration { get; private set; }
public TApplicationPathsType ApplicationPaths { get; private set; }
/// <summary>
/// Gets the list of currently loaded plugins
/// </summary>
@@ -45,7 +48,7 @@ namespace MediaBrowser.Common.Kernel
public BaseKernel()
{
ApplicationPaths = new TApplicationPathsType();
}
public virtual void Init(IProgress<TaskProgress> progress)
@@ -149,13 +152,13 @@ namespace MediaBrowser.Common.Kernel
//Configuration information for anything other than server-specific configuration will have to come via the API... -ebr
// Deserialize config
if (!File.Exists(ApplicationPaths.ConfigurationPath))
if (!File.Exists(ApplicationPaths.SystemConfigurationFilePath))
{
Configuration = new TConfigurationType();
}
else
{
Configuration = JsonSerializer.DeserializeFromFile<TConfigurationType>(ApplicationPaths.ConfigurationPath);
Configuration = XmlSerializer.DeserializeFromFile<TConfigurationType>(ApplicationPaths.SystemConfigurationFilePath);
}
Logger.LoggerInstance.LogSeverity = Configuration.LogSeverity;