mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AaruFormat] Implement WriteSectorsTag.
This commit is contained in:
@@ -25,19 +25,12 @@ public sealed partial class AaruFormat
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize) => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool SetDumpHardware(List<DumpHardware> dumpHardware) => throw new NotImplementedException();
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool SetImageInfo(ImageInfo imageInfo) => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool? VerifySector(ulong sectorAddress) => throw new NotImplementedException();
|
||||
|
||||
@@ -45,7 +38,6 @@ public sealed partial class AaruFormat
|
||||
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
|
||||
out List<ulong> unknownLbas) => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag, out byte[] buffer) =>
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -90,6 +90,22 @@ public sealed partial class AaruFormat
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectorsTag(byte[] data, ulong sectorAddress, uint length, SectorTagType tag)
|
||||
{
|
||||
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(!WriteSectorTag(sectorData, sectorAddress + i, tag)) 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