Add support for negative sectors to read and write sector calls in images.

This commit is contained in:
2025-10-23 03:07:43 +01:00
parent 0c19fe1b11
commit 69738f5f1a
289 changed files with 2676 additions and 1352 deletions

View File

@@ -54,45 +54,53 @@ public interface IMediaImage : IBaseImage
/// <summary>Reads a sector's user data.</summary>
/// <returns>The sector's user data.</returns>
/// <param name="sectorAddress">Sector address (LBA).</param>
/// <param name="negative"></param>
/// <param name="buffer"></param>
/// <param name="sectorStatus"></param>
ErrorNumber ReadSector(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus);
ErrorNumber ReadSector(ulong sectorAddress, bool negative, out byte[] buffer, out SectorStatus sectorStatus);
/// <summary>Reads a complete sector (user data + all tags).</summary>
/// <returns>The complete sector. Format depends on disk type.</returns>
/// <param name="sectorAddress">Sector address (LBA).</param>
/// <param name="negative"></param>
/// <param name="buffer"></param>
/// <param name="sectorStatus"></param>
ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer, out SectorStatus sectorStatus);
ErrorNumber ReadSectorLong(ulong sectorAddress, bool negative, out byte[] buffer, out SectorStatus sectorStatus);
/// <summary>Reads user data from several sectors.</summary>
/// <returns>The sectors user data.</returns>
/// <param name="sectorAddress">Starting sector address (LBA).</param>
/// <param name="negative"></param>
/// <param name="length">How many sectors to read.</param>
/// <param name="buffer"></param>
/// <param name="sectorStatus"></param>
ErrorNumber ReadSectors(ulong sectorAddress, uint length, out byte[] buffer, out SectorStatus[] sectorStatus);
ErrorNumber ReadSectors(ulong sectorAddress, bool negative, uint length, out byte[] buffer,
out SectorStatus[] sectorStatus);
/// <summary>Reads several complete sector (user data + all tags).</summary>
/// <returns>The complete sectors. Format depends on disk type.</returns>
/// <param name="sectorAddress">Starting sector address (LBA).</param>
/// <param name="negative"></param>
/// <param name="length">How many sectors to read.</param>
/// <param name="buffer"></param>
/// <param name="sectorStatus"></param>
ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, out byte[] buffer, out SectorStatus[] sectorStatus);
ErrorNumber ReadSectorsLong(ulong sectorAddress, bool negative, uint length, out byte[] buffer,
out SectorStatus[] sectorStatus);
/// <summary>Reads tag from several sectors.</summary>
/// <returns>The sectors tag.</returns>
/// <param name="sectorAddress">Starting sector address (LBA).</param>
/// <param name="negative"></param>
/// <param name="length">How many sectors to read.</param>
/// <param name="tag">Tag type.</param>
/// <param name="buffer"></param>
ErrorNumber ReadSectorsTag(ulong sectorAddress, uint length, SectorTagType tag, out byte[] buffer);
ErrorNumber ReadSectorsTag(ulong sectorAddress, bool negative, uint length, SectorTagType tag, out byte[] buffer);
/// <summary>Reads a sector's tag.</summary>
/// <returns>The sector's tag.</returns>
/// <param name="sectorAddress">Sector address (LBA).</param>
/// <param name="negative"></param>
/// <param name="tag">Tag type.</param>
/// <param name="buffer"></param>
ErrorNumber ReadSectorTag(ulong sectorAddress, SectorTagType tag, out byte[] buffer);
ErrorNumber ReadSectorTag(ulong sectorAddress, bool negative, SectorTagType tag, out byte[] buffer);
}