From 432c1663fb90ba8bc68161a535a939438aaecb71 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Tue, 21 Oct 2025 11:21:25 +0100 Subject: [PATCH] [NeXT disklabel] Use new source generator based big endian marshaller --- Aaru.Partitions/NeXT.cs | 211 ++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 105 deletions(-) diff --git a/Aaru.Partitions/NeXT.cs b/Aaru.Partitions/NeXT.cs index f497b885e..ee4e098e4 100644 --- a/Aaru.Partitions/NeXT.cs +++ b/Aaru.Partitions/NeXT.cs @@ -39,6 +39,7 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.Attributes; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; @@ -51,7 +52,7 @@ namespace Aaru.Partitions; /// Implements decoding of NeXT disklabels [SuppressMessage("ReSharper", "UnusedMember.Local")] [SuppressMessage("ReSharper", "UnusedType.Local")] -public sealed class NeXTDisklabel : IPartition +public sealed partial class NeXTDisklabel : IPartition { /// "NeXT" const uint NEXT_MAGIC1 = 0x4E655854; @@ -79,7 +80,7 @@ public sealed class NeXTDisklabel : IPartition /// public bool GetInformation(IMediaImage imagePlugin, out List partitions, ulong sectorOffset) { - bool magicFound = false; + var magicFound = false; byte[] labelSector; uint sectorSize = imagePlugin.Info.SectorSize is 2352 or 2448 ? 2048 : imagePlugin.Info.SectorSize; @@ -98,7 +99,7 @@ public sealed class NeXTDisklabel : IPartition if(errno != ErrorNumber.NoError) continue; - uint magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00); + var magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00); if(magic != NEXT_MAGIC1 && magic != NEXT_MAGIC2 && magic != NEXT_MAGIC3) continue; @@ -118,10 +119,10 @@ public sealed class NeXTDisklabel : IPartition if(errno != ErrorNumber.NoError) return false; - Label label = Marshal.ByteArrayToStructureBigEndian