SpannedVolume.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using Utilities;
  11. namespace DiskAccessLibrary.LogicalDiskManager
  12. {
  13. public class SpannedVolume : DynamicVolume
  14. {
  15. private DynamicColumn m_column;
  16. public SpannedVolume(DynamicColumn column, Guid volumeGuid, Guid diskGroupGuid) : base(volumeGuid, diskGroupGuid)
  17. {
  18. m_column = column;
  19. }
  20. public override byte[] ReadSectors(long sectorIndex, int sectorCount)
  21. {
  22. CheckBoundaries(sectorIndex, sectorCount);
  23. return m_column.ReadSectors(sectorIndex, sectorCount);
  24. }
  25. public override void WriteSectors(long sectorIndex, byte[] data)
  26. {
  27. CheckBoundaries(sectorIndex, data.Length / this.BytesPerSector);
  28. m_column.WriteSectors(sectorIndex, data);
  29. }
  30. public override List<DynamicColumn> Columns
  31. {
  32. get
  33. {
  34. List<DynamicColumn> result = new List<DynamicColumn>();
  35. result.Add(m_column);
  36. return result;
  37. }
  38. }
  39. public override long Size
  40. {
  41. get
  42. {
  43. return m_column.Size;
  44. }
  45. }
  46. }
  47. }