DeleteDlnaProfiles.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using MediaBrowser.Common.IO;
  2. using MediaBrowser.Controller;
  3. using System.IO;
  4. using CommonIO;
  5. namespace MediaBrowser.Server.Startup.Common.Migrations
  6. {
  7. public class DeleteDlnaProfiles : IVersionMigration
  8. {
  9. private readonly IServerApplicationPaths _appPaths;
  10. private readonly IFileSystem _fileSystem;
  11. public DeleteDlnaProfiles(IServerApplicationPaths appPaths, IFileSystem fileSystem)
  12. {
  13. _appPaths = appPaths;
  14. _fileSystem = fileSystem;
  15. }
  16. public void Run()
  17. {
  18. RemoveProfile("Android");
  19. RemoveProfile("Windows Phone");
  20. RemoveProfile("Windows 8 RT");
  21. }
  22. private void RemoveProfile(string filename)
  23. {
  24. try
  25. {
  26. _fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "system", filename + ".xml"));
  27. }
  28. catch
  29. {
  30. }
  31. try
  32. {
  33. _fileSystem.DeleteFile(Path.Combine(_appPaths.ConfigurationDirectoryPath, "dlna", "user", filename + ".xml"));
  34. }
  35. catch
  36. {
  37. }
  38. }
  39. }
  40. }