[AaruFormat] Implement WriteSectorsLong.

This commit is contained in:
2025-10-12 11:55:21 +01:00
parent 2791eb6f7a
commit 9f78a3ff34
2 changed files with 16 additions and 3 deletions

View File

@@ -33,9 +33,6 @@ public sealed partial class AaruFormat
public bool SetImageInfo(ImageInfo imageInfo) => throw new NotImplementedException();
/// <inheritdoc />
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length) => throw new NotImplementedException();
/// <inheritdoc />
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag) =>
throw new NotImplementedException();

View File

@@ -74,6 +74,22 @@ public sealed partial class AaruFormat
return true;
}
/// <inheritdoc />
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length)
{
var sectorSize = (uint)(data.Length / length);
for(uint i = 0; i < length; i++)
{
var sectorData = new byte[sectorSize];
Array.Copy(data, i * sectorSize, sectorData, 0, sectorSize);
if(!WriteSectorLong(sectorData, sectorAddress + i)) return false;
}
return true;
}
#endregion
// AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_address, bool negative,