diff --git a/Aaru.Images/AaruFormat/Unimplemented.cs b/Aaru.Images/AaruFormat/Unimplemented.cs index e930c9c01..7d56d6008 100644 --- a/Aaru.Images/AaruFormat/Unimplemented.cs +++ b/Aaru.Images/AaruFormat/Unimplemented.cs @@ -37,9 +37,6 @@ public sealed partial class AaruFormat public bool WriteMediaTag(byte[] data, MediaTagType tag) => throw new NotImplementedException(); - /// - public bool WriteSectorLong(byte[] data, ulong sectorAddress) => throw new NotImplementedException(); - /// public bool WriteSectors(byte[] data, ulong sectorAddress, uint length) => throw new NotImplementedException(); diff --git a/Aaru.Images/AaruFormat/Write.cs b/Aaru.Images/AaruFormat/Write.cs index 025c1e770..27d231ccf 100644 --- a/Aaru.Images/AaruFormat/Write.cs +++ b/Aaru.Images/AaruFormat/Write.cs @@ -20,6 +20,19 @@ public sealed partial class AaruFormat return false; } + /// + public bool WriteSectorLong(byte[] data, ulong sectorAddress) + { + Status res = + aaruf_write_sector_long(_context, sectorAddress, false, data, SectorStatus.Dumped, (uint)data.Length); + + if(res == Status.Ok) return true; + + ErrorMessage = StatusToErrorMessage(res); + + return false; + } + #endregion // AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_address, bool negative, @@ -29,4 +42,12 @@ public sealed partial class AaruFormat private static partial Status aaruf_write_sector(IntPtr context, ulong sectorAddress, [MarshalAs(UnmanagedType.I4)] bool negative, [In] byte[] data, SectorStatus sectorStatus, uint length); + + // AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t sector_address, bool negative, + // const uint8_t *data, uint8_t sector_status, uint32_t length) + [LibraryImport("libaaruformat", EntryPoint = "aaruf_write_sector_long", SetLastError = true)] + [UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])] + private static partial Status aaruf_write_sector_long(IntPtr context, ulong sectorAddress, + [MarshalAs(UnmanagedType.I4)] bool negative, [In] byte[] data, + SectorStatus sectorStatus, uint length); } \ No newline at end of file