[DART] Use new source generator based big endian marshaller

This commit is contained in:
2025-10-21 10:31:58 +01:00
parent e613563359
commit 08c1a7f102
3 changed files with 8 additions and 6 deletions

View File

@@ -51,7 +51,7 @@ public sealed partial class Dart
var headerB = new byte[Marshal.SizeOf<Header>()]; var headerB = new byte[Marshal.SizeOf<Header>()];
stream.EnsureRead(headerB, 0, Marshal.SizeOf<Header>()); stream.EnsureRead(headerB, 0, Marshal.SizeOf<Header>());
Header header = Marshal.ByteArrayToStructureBigEndian<Header>(headerB); Header header = Marshal.ByteArrayToStructureBigEndianGenerated<Header>(headerB);
if(header.srcCmp > COMPRESS_NONE) return false; if(header.srcCmp > COMPRESS_NONE) return false;

View File

@@ -61,7 +61,7 @@ public sealed partial class Dart
var headerB = new byte[Marshal.SizeOf<Header>()]; var headerB = new byte[Marshal.SizeOf<Header>()];
stream.EnsureRead(headerB, 0, Marshal.SizeOf<Header>()); stream.EnsureRead(headerB, 0, Marshal.SizeOf<Header>());
Header header = Marshal.ByteArrayToStructureBigEndian<Header>(headerB); Header header = Marshal.ByteArrayToStructureBigEndianGenerated<Header>(headerB);
if(header.srcCmp > COMPRESS_NONE) return ErrorNumber.NotSupported; if(header.srcCmp > COMPRESS_NONE) return ErrorNumber.NotSupported;

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/ // ****************************************************************************/
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Aaru.CommonTypes.Attributes;
namespace Aaru.Images; namespace Aaru.Images;
@@ -39,11 +40,12 @@ public sealed partial class Dart
#region Nested type: Header #region Nested type: Header
[StructLayout(LayoutKind.Sequential, Pack = 1)] [StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Header [SwapEndian]
partial struct Header
{ {
public readonly byte srcCmp; public byte srcCmp;
public readonly byte srcType; public byte srcType;
public readonly short srcSize; public short srcSize;
} }
#endregion #endregion