LinuxMount.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using System;
  2. using MediaBrowser.Model.IO;
  3. namespace IsoMounter
  4. {
  5. internal class LinuxMount : IIsoMount
  6. {
  7. #region Private Fields
  8. private readonly LinuxIsoManager linuxIsoManager;
  9. #endregion
  10. #region Constructor(s)
  11. internal LinuxMount(LinuxIsoManager isoManager, string isoPath, string mountFolder)
  12. {
  13. linuxIsoManager = isoManager;
  14. IsoPath = isoPath;
  15. MountedPath = mountFolder;
  16. }
  17. #endregion
  18. #region Interface Implementation for IDisposable
  19. // Flag: Has Dispose already been called?
  20. private bool disposed = false;
  21. public void Dispose()
  22. {
  23. // Dispose of unmanaged resources.
  24. Dispose(true);
  25. // Suppress finalization.
  26. GC.SuppressFinalize(this);
  27. }
  28. protected virtual void Dispose(bool disposing)
  29. {
  30. if (disposed)
  31. {
  32. return;
  33. }
  34. if (disposing)
  35. {
  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. }