jellyfin-server/MediaBrowser.Server.Startup.Common/Migrations/DeleteDlnaProfiles.cs

47 lines
1.2 KiB
C#
Raw Normal View History

using MediaBrowser.Common.IO;
using MediaBrowser.Controller;
2014-12-13 21:26:04 +00:00
using System.IO;
2015-10-04 04:23:11 +00:00
using CommonIO;
2014-12-13 21:26:04 +00:00
namespace MediaBrowser.Server.Startup.Common.Migrations
{
public class DeleteDlnaProfiles : IVersionMigration
{
private readonly IServerApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
2014-12-13 21:26:04 +00:00
public DeleteDlnaProfiles(IServerApplicationPaths appPaths, IFileSystem fileSystem)
2014-12-13 21:26:04 +00:00
{
_appPaths = appPaths;
_fileSystem = fileSystem;
2014-12-13 21:26:04 +00:00
}
public void Run()
{
RemoveProfile("Android");
RemoveProfile("Windows Phone");
RemoveProfile("Windows 8 RT");
}
private void RemoveProfile(string filename)
{
try
{
_fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system", filename + ".xml"));
2014-12-13 21:26:04 +00:00
}
catch
{
}
try
{
_fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user", filename + ".xml"));
2014-12-13 21:26:04 +00:00
}
catch
{
}
}
}
}