diff --git a/Aaru.Images/AaruFormat/Read.cs b/Aaru.Images/AaruFormat/Read.cs index cedfeb293..af9eb572b 100644 --- a/Aaru.Images/AaruFormat/Read.cs +++ b/Aaru.Images/AaruFormat/Read.cs @@ -62,6 +62,23 @@ public sealed partial class AaruFormat return StatusToErrorNumber(res); } + /// + public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer) + { + buffer = null; + uint length = 0; + + Status res = aaruf_read_sector_long(_context, sectorAddress, false, buffer, ref length, out _); + + if(res != Status.BufferTooSmall) return StatusToErrorNumber(res); + + buffer = new byte[length]; + + res = aaruf_read_sector_long(_context, sectorAddress, false, buffer, ref length, out _); + + return StatusToErrorNumber(res); + } + #endregion // AARU_EXPORT int32_t AARU_CALL aaruf_read_media_tag(void *context, uint8_t *data, const int32_t tag, uint32_t *length) @@ -76,10 +93,18 @@ public sealed partial class AaruFormat private static partial Status aaruf_read_sector(IntPtr context, ulong sectorAddress, [MarshalAs(UnmanagedType.I4)] bool negative, byte[] data, ref uint length, out byte sectorStatus); - // AARU_EXPORT int32_t AARU_CALL aaruf_read_track_sector(void *context, uint8_t *data, const uint64_t sector_address, + + // AARU_EXPORT int32_t AARU_CALL aaruf_read_track_sector(void *context, uint8_t *data, const uint64_t sector_address, // uint32_t *length, const uint8_t track, uint8_t *sector_status) [LibraryImport("libaaruformat", EntryPoint = "aaruf_read_track_sector", SetLastError = true)] [UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])] private static partial Status aaruf_read_track_sector(IntPtr context, byte[] data, ulong sectorAddress, ref uint length, byte track, out byte sectorStatus); + // AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_long(void *context, const uint64_t sector_address, bool negative, + // uint8_t *data, uint32_t *length, uint8_t *sector_status) + [LibraryImport("libaaruformat", EntryPoint = "aaruf_read_sector_long", SetLastError = true)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])] + private static partial Status aaruf_read_sector_long(IntPtr context, ulong sectorAddress, + [MarshalAs(UnmanagedType.I4)] bool negative, byte[] data, + ref uint length, out byte sectorStatus); } \ No newline at end of file diff --git a/Aaru.Images/AaruFormat/Unimplemented.cs b/Aaru.Images/AaruFormat/Unimplemented.cs index 38837e432..6cac5d36d 100644 --- a/Aaru.Images/AaruFormat/Unimplemented.cs +++ b/Aaru.Images/AaruFormat/Unimplemented.cs @@ -21,9 +21,6 @@ public sealed partial class AaruFormat #region IWritableOpticalImage Members - /// - public ErrorNumber ReadSectorLong(ulong sectorAddress, out byte[] buffer) => throw new NotImplementedException(); - /// public ErrorNumber ReadSectors(ulong sectorAddress, uint length, out byte[] buffer) => throw new NotImplementedException();