DeleteDlnaProfiles.cs 1.0 KB

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