mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[AaruFormat] Retrieve image information about negative and overflow sectors.
This commit is contained in:
@@ -251,6 +251,16 @@ public sealed partial class AaruFormat
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_readable_media_tags(IntPtr context, byte[] buffer, ref nuint length);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_get_negative_sectors(const void *context, uint16_t *sectors);
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_negative_sectors", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_negative_sectors(IntPtr context, ref ushort sectors);
|
||||
|
||||
// AARU_EXPORT int32_t AARU_CALL aaruf_get_overflow_sectors(const void *context, uint16_t *sectors);
|
||||
[LibraryImport("libaaruformat", EntryPoint = "aaruf_get_overflow_sectors", SetLastError = true)]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvStdcall)])]
|
||||
private static partial Status aaruf_get_overflow_sectors(IntPtr context, ref ushort sectors);
|
||||
|
||||
#region IWritableOpticalImage Members
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -64,9 +64,8 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
{
|
||||
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
}
|
||||
if(sectorTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
|
||||
sizet_length = 0;
|
||||
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
|
||||
@@ -80,9 +79,8 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
{
|
||||
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
}
|
||||
if(mediaTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
|
||||
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
|
||||
|
||||
@@ -243,6 +241,16 @@ public sealed partial class AaruFormat
|
||||
|
||||
SetMetadataFromTags();
|
||||
|
||||
ushort negativeSectors = 0;
|
||||
|
||||
ret = aaruf_get_negative_sectors(_context, ref negativeSectors);
|
||||
if(ret == Status.Ok) _imageInfo.NegativeSectors = negativeSectors;
|
||||
|
||||
ushort overflowSectors = 0;
|
||||
|
||||
ret = aaruf_get_overflow_sectors(_context, ref overflowSectors);
|
||||
if(ret == Status.Ok) _imageInfo.OverflowSectors = overflowSectors;
|
||||
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
|
||||
@@ -288,8 +288,9 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
if(sectorTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
{
|
||||
if(sectorTagsBuffer[i] != 0) _imageInfo.ReadableSectorTags.Add((SectorTagType)i);
|
||||
}
|
||||
|
||||
sizet_length = 0;
|
||||
ret = aaruf_get_readable_media_tags(_context, null, ref sizet_length);
|
||||
@@ -313,8 +314,9 @@ public sealed partial class AaruFormat
|
||||
|
||||
// Convert array of booleans to List of enums
|
||||
for(nuint i = 0; i < sizet_length; i++)
|
||||
if(mediaTagsBuffer[i] != 0)
|
||||
_imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
{
|
||||
if(mediaTagsBuffer[i] != 0) _imageInfo.ReadableMediaTags.Add((MediaTagType)i);
|
||||
}
|
||||
|
||||
ret = aaruf_get_media_sequence(_context, out int sequence, out int lastSequence);
|
||||
|
||||
@@ -475,6 +477,16 @@ public sealed partial class AaruFormat
|
||||
|
||||
SetMetadataFromTags();
|
||||
|
||||
ushort infoNegativeSectors = 0;
|
||||
|
||||
ret = aaruf_get_negative_sectors(_context, ref infoNegativeSectors);
|
||||
if(ret == Status.Ok) _imageInfo.NegativeSectors = infoNegativeSectors;
|
||||
|
||||
ushort infoOverflowSectors = 0;
|
||||
|
||||
ret = aaruf_get_overflow_sectors(_context, ref infoOverflowSectors);
|
||||
if(ret == Status.Ok) _imageInfo.OverflowSectors = infoOverflowSectors;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user