LinuxMount.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using MediaBrowser.Model.IO;
  3. using Microsoft.Extensions.Logging;
  4. using MediaBrowser.Model.System;
  5. namespace IsoMounter
  6. {
  7. internal class LinuxMount : IIsoMount
  8. {
  9. #region Private Fields
  10. private readonly LinuxIsoManager linuxIsoManager;
  11. #endregion
  12. #region Constructor(s)
  13. internal LinuxMount(LinuxIsoManager isoManager, string isoPath, string mountFolder)
  14. {
  15. linuxIsoManager = isoManager;
  16. IsoPath = isoPath;
  17. MountedPath = mountFolder;
  18. }
  19. #endregion
  20. #region Interface Implementation for IDisposable
  21. // Flag: Has Dispose already been called?
  22. private bool disposed = false;
  23. public void Dispose()
  24. {
  25. // Dispose of unmanaged resources.
  26. Dispose(true);
  27. // Suppress finalization.
  28. GC.SuppressFinalize(this);
  29. }
  30. protected virtual void Dispose(bool disposing)
  31. {
  32. if (disposed) {
  33. return;
  34. }
  35. if (disposing) {
  36. //
  37. // Free managed objects here.
  38. //
  39. linuxIsoManager.OnUnmount(this);
  40. }
  41. //
  42. // Free any unmanaged objects here.
  43. //
  44. disposed = true;
  45. }
  46. #endregion
  47. #region Interface Implementation for IIsoMount
  48. public string IsoPath { get; private set; }
  49. public string MountedPath { get; private set; }
  50. #endregion
  51. }
  52. }