add ApplicationPath to app paths interface to hide implementation

This commit is contained in:
Luke Pulverenti
2013-12-04 09:52:38 -05:00
parent 40959a816f
commit 4e79eaf65e
13 changed files with 110 additions and 38 deletions

View File

@@ -33,7 +33,7 @@ namespace MediaBrowser.Common.Implementations
/// </summary>
/// <typeparam name="TApplicationPathsType">The type of the T application paths type.</typeparam>
public abstract class BaseApplicationHost<TApplicationPathsType> : IApplicationHost
where TApplicationPathsType : class, IApplicationPaths, new()
where TApplicationPathsType : class, IApplicationPaths
{
/// <summary>
/// Occurs when [has pending restart changed].
@@ -83,7 +83,7 @@ namespace MediaBrowser.Common.Implementations
/// <summary>
/// The json serializer
/// </summary>
public readonly IJsonSerializer JsonSerializer = new JsonSerializer();
public IJsonSerializer JsonSerializer { get; private set; }
/// <summary>
/// The _XML serializer
@@ -153,7 +153,7 @@ namespace MediaBrowser.Common.Implementations
protected IInstallationManager InstallationManager { get; private set; }
protected IFileSystem FileSystemManager { get; private set; }
/// <summary>
/// Gets or sets the zip client.
/// </summary>
@@ -181,6 +181,8 @@ namespace MediaBrowser.Common.Implementations
/// <returns>Task.</returns>
public virtual async Task Init()
{
JsonSerializer = CreateJsonSerializer();
IsFirstRun = !ConfigurationManager.CommonConfiguration.IsStartupWizardCompleted;
Logger = LogManager.GetLogger("App");
@@ -212,6 +214,11 @@ namespace MediaBrowser.Common.Implementations
}
protected virtual IJsonSerializer CreateJsonSerializer()
{
return new JsonSerializer();
}
private void SetHttpLimit()
{
try
@@ -224,7 +231,7 @@ namespace MediaBrowser.Common.Implementations
Logger.ErrorException("Error setting http limit", ex);
}
}
/// <summary>
/// Installs the iso mounters.
/// </summary>

View File

@@ -20,21 +20,23 @@ namespace MediaBrowser.Common.Implementations
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationPaths" /> class.
/// </summary>
/// <param name="useDebugPath">if set to <c>true</c> [use debug paths].</param>
protected BaseApplicationPaths(bool useDebugPath)
protected BaseApplicationPaths(bool useDebugPath, string applicationPath)
{
_useDebugPath = useDebugPath;
ApplicationPath = applicationPath;
}
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationPaths"/> class.
/// </summary>
/// <param name="programDataPath">The program data path.</param>
protected BaseApplicationPaths(string programDataPath)
protected BaseApplicationPaths(string programDataPath, string applicationPath)
{
_programDataPath = programDataPath;
ApplicationPath = applicationPath;
}
public string ApplicationPath { get; private set; }
/// <summary>
/// The _program data path
/// </summary>

View File

@@ -80,7 +80,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
using (Stream stream = File.OpenRead(file))
{
return ServiceStack.Text.JsonSerializer.DeserializeFromStream(type, stream);
return DeserializeFromStream(stream, type);
}
}
@@ -101,7 +101,7 @@ namespace MediaBrowser.Common.Implementations.Serialization
using (Stream stream = File.OpenRead(file))
{
return ServiceStack.Text.JsonSerializer.DeserializeFromStream<T>(stream);
return DeserializeFromStream<T>(stream);
}
}