From 6c8d9192985036acb3d1fe626ed57980bb862d6a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 31 Oct 2013 10:03:23 -0400 Subject: replace file system calls with IFileSystem when needed --- .../BaseApplicationHost.cs | 23 ++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'MediaBrowser.Common.Implementations/BaseApplicationHost.cs') diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs index daa664a38..ee22b7baa 100644 --- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs +++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs @@ -1,5 +1,4 @@ -using System.Net; -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Events; using MediaBrowser.Common.Implementations.Archiving; using MediaBrowser.Common.Implementations.IO; @@ -7,6 +6,7 @@ using MediaBrowser.Common.Implementations.ScheduledTasks; using MediaBrowser.Common.Implementations.Security; using MediaBrowser.Common.Implementations.Serialization; using MediaBrowser.Common.Implementations.Updates; +using MediaBrowser.Common.IO; using MediaBrowser.Common.Net; using MediaBrowser.Common.Plugins; using MediaBrowser.Common.ScheduledTasks; @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net; using System.Net.Http; using System.Reflection; using System.Threading; @@ -150,15 +151,17 @@ namespace MediaBrowser.Common.Implementations /// Gets or sets the installation manager. /// /// The installation manager. - protected IInstallationManager InstallationManager { get; set; } + protected IInstallationManager InstallationManager { get; private set; } + protected IFileSystem FileSystemManager { get; private set; } + /// /// Gets or sets the zip client. /// /// The zip client. - protected IZipClient ZipClient { get; set; } + protected IZipClient ZipClient { get; private set; } - protected IIsoManager IsoManager { get; set; } + protected IIsoManager IsoManager { get; private set; } /// /// Initializes a new instance of the class. @@ -347,7 +350,10 @@ namespace MediaBrowser.Common.Implementations RegisterSingleInstance(TaskManager); - HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, CreateHttpClient); + FileSystemManager = CreateFileSystemManager(); + RegisterSingleInstance(FileSystemManager); + + HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, CreateHttpClient, FileSystemManager); RegisterSingleInstance(HttpClient); NetworkManager = CreateNetworkManager(); @@ -367,6 +373,11 @@ namespace MediaBrowser.Common.Implementations }); } + protected virtual IFileSystem CreateFileSystemManager() + { + return new CommonFileSystem(Logger, true); + } + protected abstract HttpClient CreateHttpClient(bool enableHttpCompression); /// -- cgit v1.2.3