mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AaruFormat] Implement WriteSectors.
This commit is contained in:
@@ -33,9 +33,6 @@ public sealed partial class AaruFormat
|
||||
public bool SetImageInfo(ImageInfo imageInfo) => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectors(byte[] data, ulong sectorAddress, uint length) => throw new NotImplementedException();
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length) => throw new NotImplementedException();
|
||||
|
||||
|
||||
@@ -58,6 +58,22 @@ public sealed partial class AaruFormat
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectors(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(!WriteSector(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,
|
||||
|
||||
Reference in New Issue
Block a user