LinuxMount.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using MediaBrowser.Model.IO;
  3. namespace IsoMounter
  4. {
  5. /// <summary>
  6. /// Class LinuxMount.
  7. /// </summary>
  8. internal class LinuxMount : IIsoMount
  9. {
  10. private readonly LinuxIsoManager _linuxIsoManager;
  11. private bool _disposed = false;
  12. /// <summary>
  13. /// Initializes a new instance of the <see cref="LinuxMount" /> class.
  14. /// </summary>
  15. /// <param name="isoManager">The ISO manager that mounted this ISO file.</param>
  16. /// <param name="isoPath">The path to the ISO file.</param>
  17. /// <param name="mountFolder">The folder the ISO is mounted in.</param>
  18. internal LinuxMount(LinuxIsoManager isoManager, string isoPath, string mountFolder)
  19. {
  20. _linuxIsoManager = isoManager;
  21. IsoPath = isoPath;
  22. MountedPath = mountFolder;
  23. }
  24. /// <inheritdoc />
  25. public string IsoPath { get; }
  26. /// <inheritdoc />
  27. public string MountedPath { get; }
  28. /// <inheritdoc />
  29. public void Dispose()
  30. {
  31. Dispose(true);
  32. GC.SuppressFinalize(this);
  33. }
  34. /// <summary>
  35. /// Releases the unmanaged resources and disposes of the managed resources used.
  36. /// </summary>
  37. /// <param name="disposing">Whether or not the managed resources should be disposed.</param>
  38. protected virtual void Dispose(bool disposing)
  39. {
  40. if (_disposed)
  41. {
  42. return;
  43. }
  44. _linuxIsoManager.OnUnmount(this);
  45. _disposed = true;
  46. }
  47. }
  48. }