DeleteDlnaProfiles.cs 1.2 KB

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