123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- public abstract class Volume
- {
-
-
-
- public abstract byte[] ReadSectors(long sectorIndex, int sectorCount);
- public abstract void WriteSectors(long sectorIndex, byte[] data);
-
- public byte[] ReadSector(long sectorIndex)
- {
- return ReadSectors(sectorIndex, 1);
- }
- public void CheckBoundaries(long sectorIndex, int sectorCount)
- {
- if (sectorIndex < 0 || sectorIndex + sectorCount - 1 >= this.TotalSectors)
- {
- throw new ArgumentOutOfRangeException("Attempted to access data outside of volume");
- }
- }
- public abstract int BytesPerSector
- {
- get;
- }
- public abstract long Size
- {
- get;
- }
- public abstract List<DiskExtent> Extents
- {
- get;
- }
- public long TotalSectors
- {
- get
- {
- return this.Size / this.BytesPerSector;
- }
- }
- }
|