aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Common.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-12 22:46:44 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-12 22:46:44 -0500
commitd8d5dd487326dd3fccf4e9f30cd8f7e3783fcfda (patch)
treecf9950d32ee194d72a367c836a70dfb8f4e61401 /MediaBrowser.Common.Implementations
parentf55217406985ad21da44aa523353f33e3f720ccd (diff)
make channel access opt-in rather than opt out
Diffstat (limited to 'MediaBrowser.Common.Implementations')
-rw-r--r--MediaBrowser.Common.Implementations/BaseApplicationHost.cs2
-rw-r--r--MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs2
-rw-r--r--MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs24
-rw-r--r--MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs2
-rw-r--r--MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs2
-rw-r--r--MediaBrowser.Common.Implementations/Updates/InstallationManager.cs9
6 files changed, 32 insertions, 9 deletions
diff --git a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
index c98a6bd6c..0f89bd1a6 100644
--- a/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
+++ b/MediaBrowser.Common.Implementations/BaseApplicationHost.cs
@@ -475,7 +475,7 @@ namespace MediaBrowser.Common.Implementations
SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager);
RegisterSingleInstance(SecurityManager);
- InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager);
+ InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
RegisterSingleInstance(InstallationManager);
ZipClient = new ZipClient();
diff --git a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
index 1f82c5eb0..b925649fc 100644
--- a/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/MediaBrowser.Common.Implementations/HttpClientManager/HttpClientManager.cs
@@ -690,7 +690,7 @@ namespace MediaBrowser.Common.Implementations.HttpClientManager
{
try
{
- File.Delete(file);
+ _fileSystem.DeleteFile(file);
}
catch (IOException)
{
diff --git a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
index 68df0e52a..c54b053fd 100644
--- a/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
+++ b/MediaBrowser.Common.Implementations/IO/CommonFileSystem.cs
@@ -270,8 +270,8 @@ namespace MediaBrowser.Common.Implementations.IO
File.Copy(temp1, file2, true);
File.Copy(temp2, file1, true);
- File.Delete(temp1);
- File.Delete(temp2);
+ DeleteFile(temp1);
+ DeleteFile(temp2);
}
/// <summary>
@@ -409,5 +409,25 @@ namespace MediaBrowser.Common.Implementations.IO
//return Path.IsPathRooted(path);
}
+
+ public void DeleteFile(string path, bool sendToRecycleBin)
+ {
+ File.Delete(path);
+ }
+
+ public void DeleteDirectory(string path, bool recursive, bool sendToRecycleBin)
+ {
+ Directory.Delete(path, recursive);
+ }
+
+ public void DeleteFile(string path)
+ {
+ DeleteFile(path, false);
+ }
+
+ public void DeleteDirectory(string path, bool recursive)
+ {
+ DeleteDirectory(path, recursive, false);
+ }
}
}
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
index fcb7b159b..779f992d3 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteCacheFileTask.cs
@@ -125,7 +125,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{
try
{
- File.Delete(path);
+ _fileSystem.DeleteFile(path);
}
catch (IOException ex)
{
diff --git a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
index 3b0c02dc6..6b9bcbfc1 100644
--- a/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
+++ b/MediaBrowser.Common.Implementations/ScheduledTasks/Tasks/DeleteLogFileTask.cs
@@ -76,7 +76,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
cancellationToken.ThrowIfCancellationRequested();
- File.Delete(file.FullName);
+ _fileSystem.DeleteFile(file.FullName);
index++;
}
diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
index 47215aacf..264e63b47 100644
--- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
+++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Events;
using MediaBrowser.Common.Implementations.Security;
+using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Progress;
@@ -106,6 +107,7 @@ namespace MediaBrowser.Common.Implementations.Updates
private readonly IJsonSerializer _jsonSerializer;
private readonly ISecurityManager _securityManager;
private readonly IConfigurationManager _config;
+ private readonly IFileSystem _fileSystem;
/// <summary>
/// Gets the application host.
@@ -113,7 +115,7 @@ namespace MediaBrowser.Common.Implementations.Updates
/// <value>The application host.</value>
private readonly IApplicationHost _applicationHost;
- public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IConfigurationManager config)
+ public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IConfigurationManager config, IFileSystem fileSystem)
{
if (logger == null)
{
@@ -129,6 +131,7 @@ namespace MediaBrowser.Common.Implementations.Updates
_jsonSerializer = jsonSerializer;
_securityManager = securityManager;
_config = config;
+ _fileSystem = fileSystem;
_logger = logger;
}
@@ -570,7 +573,7 @@ namespace MediaBrowser.Common.Implementations.Updates
try
{
- File.Delete(tempFile);
+ _fileSystem.DeleteFile(tempFile);
}
catch (IOException e)
{
@@ -591,7 +594,7 @@ namespace MediaBrowser.Common.Implementations.Updates
// Remove it the quick way for now
_applicationHost.RemovePlugin(plugin);
- File.Delete(plugin.AssemblyFilePath);
+ _fileSystem.DeleteFile(plugin.AssemblyFilePath);
OnPluginUninstalled(plugin);