aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Startup.Common
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Startup.Common')
-rw-r--r--MediaBrowser.Server.Startup.Common/ApplicationHost.cs12
-rw-r--r--MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs8
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs11
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs9
-rw-r--r--MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs9
5 files changed, 29 insertions, 20 deletions
diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
index 013e9205a..654539870 100644
--- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
+++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs
@@ -365,11 +365,11 @@ namespace MediaBrowser.Server.Startup.Common
{
var migrations = new List<IVersionMigration>
{
- new MigrateUserFolders(ApplicationPaths),
+ new MigrateUserFolders(ApplicationPaths, FileSystemManager),
new RenameXbmcOptions(ServerConfigurationManager),
new RenameXmlOptions(ServerConfigurationManager),
- new DeprecatePlugins(ApplicationPaths),
- new DeleteDlnaProfiles(ApplicationPaths)
+ new DeprecatePlugins(ApplicationPaths, FileSystemManager),
+ new DeleteDlnaProfiles(ApplicationPaths, FileSystemManager)
};
foreach (var task in migrations)
@@ -435,7 +435,7 @@ namespace MediaBrowser.Server.Startup.Common
SyncRepository = await GetSyncRepository().ConfigureAwait(false);
RegisterSingleInstance(SyncRepository);
- UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer);
+ UserManager = new UserManager(LogManager.GetLogger("UserManager"), ServerConfigurationManager, UserRepository, XmlSerializer, NetworkManager, () => ImageProcessor, () => DtoService, () => ConnectManager, this, JsonSerializer, FileSystemManager, () => ChannelManager);
RegisterSingleInstance(UserManager);
LibraryManager = new LibraryManager(Logger, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager);
@@ -483,7 +483,7 @@ namespace MediaBrowser.Server.Startup.Common
TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager);
RegisterSingleInstance(TVSeriesManager);
- SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder);
+ SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager);
RegisterSingleInstance(SyncManager);
DtoService = new DtoService(Logger, LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this);
@@ -495,7 +495,7 @@ namespace MediaBrowser.Server.Startup.Common
ConnectManager = new ConnectManager(LogManager.GetLogger("Connect"), ApplicationPaths, JsonSerializer, encryptionManager, HttpClient, this, ServerConfigurationManager, UserManager, ProviderManager);
RegisterSingleInstance(ConnectManager);
- DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, Logger), UserManager, FileSystemManager, LibraryMonitor, ConfigurationManager, LogManager.GetLogger("DeviceManager"));
+ DeviceManager = new DeviceManager(new DeviceRepository(ApplicationPaths, JsonSerializer, Logger, FileSystemManager), UserManager, FileSystemManager, LibraryMonitor, ConfigurationManager, LogManager.GetLogger("DeviceManager"));
RegisterSingleInstance(DeviceManager);
SessionManager = new SessionManager(UserDataManager, Logger, UserRepository, LibraryManager, UserManager, musicManager, DtoService, ImageProcessor, ItemRepository, JsonSerializer, this, HttpClient, AuthenticationRepository, DeviceManager);
diff --git a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs
index 229fee18d..58e8e2da8 100644
--- a/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs
+++ b/MediaBrowser.Server.Startup.Common/FFMpeg/FFMpegDownloader.cs
@@ -129,7 +129,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
{
try
{
- Directory.Delete(path, true);
+ _fileSystem.DeleteDirectory(path, true);
}
catch (Exception ex)
{
@@ -272,7 +272,7 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
{
try
{
- File.Delete(path);
+ _fileSystem.DeleteFile(path);
}
catch (IOException ex)
{
@@ -380,10 +380,10 @@ namespace MediaBrowser.Server.Startup.Common.FFMpeg
}
Extract7zArchive(tempFile, fontsDirectory);
-
+
try
{
- File.Delete(tempFile);
+ _fileSystem.DeleteFile(tempFile);
}
catch (IOException ex)
{
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs b/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs
index 8fe841ffc..166c2627f 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller;
+using MediaBrowser.Common.IO;
+using MediaBrowser.Controller;
using System.IO;
namespace MediaBrowser.Server.Startup.Common.Migrations
@@ -6,10 +7,12 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
public class DeleteDlnaProfiles : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
+ private readonly IFileSystem _fileSystem;
- public DeleteDlnaProfiles(IServerApplicationPaths appPaths)
+ public DeleteDlnaProfiles(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
+ _fileSystem = fileSystem;
}
public void Run()
@@ -23,7 +26,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
{
try
{
- File.Delete(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system", filename + ".xml"));
+ _fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system", filename + ".xml"));
}
catch
{
@@ -31,7 +34,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
}
try
{
- File.Delete(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user", filename + ".xml"));
+ _fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user", filename + ".xml"));
}
catch
{
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs b/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs
index ce4665b26..afdd4e623 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/DeprecatePlugins.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller;
+using MediaBrowser.Common.IO;
+using MediaBrowser.Controller;
using System.IO;
namespace MediaBrowser.Server.Startup.Common.Migrations
@@ -6,10 +7,12 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
public class DeprecatePlugins : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
+ private readonly IFileSystem _fileSystem;
- public DeprecatePlugins(IServerApplicationPaths appPaths)
+ public DeprecatePlugins(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
+ _fileSystem = fileSystem;
}
public void Run()
@@ -21,7 +24,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
{
try
{
- File.Delete(Path.Combine(_appPaths.PluginsPath, filename));
+ _fileSystem.DeleteFile(Path.Combine(_appPaths.PluginsPath, filename));
}
catch
{
diff --git a/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs b/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs
index 5e3df5701..cb566d6cf 100644
--- a/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs
+++ b/MediaBrowser.Server.Startup.Common/Migrations/MigrateUserFolders.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller;
+using MediaBrowser.Common.IO;
+using MediaBrowser.Controller;
using System;
using System.IO;
using System.Linq;
@@ -8,10 +9,12 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
public class MigrateUserFolders : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
+ private readonly IFileSystem _fileSystem;
- public MigrateUserFolders(IServerApplicationPaths appPaths)
+ public MigrateUserFolders(IServerApplicationPaths appPaths, IFileSystem fileSystem)
{
_appPaths = appPaths;
+ _fileSystem = fileSystem;
}
public void Run()
@@ -25,7 +28,7 @@ namespace MediaBrowser.Server.Startup.Common.Migrations
foreach (var folder in folders)
{
- Directory.Delete(folder.FullName, true);
+ _fileSystem.DeleteDirectory(folder.FullName, true);
}
}
catch (IOException)