mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AaruFormat] Implement WriteMediaTag.
This commit is contained in:
@@ -33,10 +33,6 @@ public sealed partial class AaruFormat
|
||||
public bool SetImageInfo(ImageInfo imageInfo) => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteMediaTag(byte[] data, MediaTagType tag) => throw new NotImplementedException();
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteSectors(byte[] data, ulong sectorAddress, uint length) => throw new NotImplementedException();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
|
||||
namespace Aaru.Images;
|
||||
|
||||
@@ -33,6 +34,18 @@ public sealed partial class AaruFormat
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool WriteMediaTag(byte[] data, MediaTagType tag)
|
||||
{
|
||||
Status res = aaruf_write_media_tag(_context, data, tag, (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,
|
||||
@@ -50,4 +63,11 @@ public sealed partial class AaruFormat
|
||||
private static partial Status aaruf_write_sector_long(IntPtr context, ulong sectorAddress,
|
||||
[MarshalAs(UnmanagedType.I4)] bool negative, [In] byte[] data,
|
||||
SectorStatus sectorStatus, uint length);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_write_media_tag(void *context, const uint8_t *data, const int32_t type,
|
||||
// const uint32_t length)
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_write_media_tag", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_write_media_tag(IntPtr context, [In] byte[] data, MediaTagType type,
|
||||
uint length);
|
||||
}
|
||||
Reference in New Issue
Block a user