SimpleVolume.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. namespace DiskAccessLibrary.LogicalDiskManager
  11. {
  12. public class SimpleVolume : DynamicVolume
  13. {
  14. DynamicDiskExtent m_extent;
  15. public SimpleVolume(DynamicDiskExtent extent, Guid volumeGuid, Guid diskGroupGuid) : base(volumeGuid, diskGroupGuid)
  16. {
  17. m_extent = extent;
  18. }
  19. public override byte[] ReadSectors(long sectorIndex, int sectorCount)
  20. {
  21. return m_extent.ReadSectors(sectorIndex, sectorCount);
  22. }
  23. public override void WriteSectors(long sectorIndex, byte[] data)
  24. {
  25. m_extent.WriteSectors(sectorIndex, data);
  26. }
  27. public override int BytesPerSector
  28. {
  29. get
  30. {
  31. return m_extent.BytesPerSector;
  32. }
  33. }
  34. public override long Size
  35. {
  36. get
  37. {
  38. return m_extent.Size;
  39. }
  40. }
  41. public long FirstSector
  42. {
  43. get
  44. {
  45. return m_extent.FirstSector;
  46. }
  47. }
  48. public Disk Disk
  49. {
  50. get
  51. {
  52. return m_extent.Disk;
  53. }
  54. }
  55. public DynamicDiskExtent DiskExtent
  56. {
  57. get
  58. {
  59. return m_extent;
  60. }
  61. }
  62. public override List<DynamicColumn> Columns
  63. {
  64. get
  65. {
  66. List<DynamicDiskExtent> extents = new List<DynamicDiskExtent>();
  67. extents.Add(m_extent);
  68. List<DynamicColumn> result = new List<DynamicColumn>();
  69. result.Add(new DynamicColumn(extents));
  70. return result;
  71. }
  72. }
  73. }
  74. }