2015-01-13 03:46:44 +00:00
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
|
using MediaBrowser.Controller;
|
2014-12-13 21:26:04 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Server.Startup.Common.Migrations
|
|
|
|
|
{
|
|
|
|
|
public class DeleteDlnaProfiles : IVersionMigration
|
|
|
|
|
{
|
|
|
|
|
private readonly IServerApplicationPaths _appPaths;
|
2015-01-13 03:46:44 +00:00
|
|
|
|
private readonly IFileSystem _fileSystem;
|
2014-12-13 21:26:04 +00:00
|
|
|
|
|
2015-01-13 03:46:44 +00:00
|
|
|
|
public DeleteDlnaProfiles(IServerApplicationPaths appPaths, IFileSystem fileSystem)
|
2014-12-13 21:26:04 +00:00
|
|
|
|
{
|
|
|
|
|
_appPaths = appPaths;
|
2015-01-13 03:46:44 +00:00
|
|
|
|
_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
|
|
|
|
|
{
|
2015-01-13 03:46:44 +00:00
|
|
|
|
_fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system", filename + ".xml"));
|
2014-12-13 21:26:04 +00:00
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
2015-01-13 03:46:44 +00:00
|
|
|
|
_fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user", filename + ".xml"));
|
2014-12-13 21:26:04 +00:00
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|