From c7d461d59e9636e865558c90eaac87483400ae9a Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 23 Aug 2025 05:04:32 +0100 Subject: [PATCH] [ZOO] Fix resharper reordering structures. --- Aaru.Archives/Zoo/Structs.cs | 139 ++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/Aaru.Archives/Zoo/Structs.cs b/Aaru.Archives/Zoo/Structs.cs index 0ae8a2cff..095b71e18 100644 --- a/Aaru.Archives/Zoo/Structs.cs +++ b/Aaru.Archives/Zoo/Structs.cs @@ -41,68 +41,69 @@ public sealed partial class Zoo { #region Nested type: Direntry - record Direntry + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] + readonly struct Direntry { - /// length of comment, 0 if none - ushort cmt_size; - /// points to comment; zero if none - int comment; + /// tag -- redundancy check + public readonly uint zoo_tag; + /// type of directory entry. always 1 for now + public readonly byte type; + /// 0 = no packing, 1 = normal LZW + public readonly byte packing_method; + /// pos'n of next directory entry + public readonly int next; + /// position of this file + public readonly int offset; /// DOS format date - ushort date; - /// will be 1 if deleted, 0 if not - byte deleted; - /// CRC of directory entry - ushort dir_crc; - /// length of directory name - byte dirlen; - /// directory name - [MarshalAs(UnmanagedType.ByValArray, SizeConst = PATHSIZE)] - byte[] dirname; - /// File attributes -- 24 bits - uint fattr; + public readonly ushort date; + /// DOS format time + public readonly ushort time; /// CRC of this file - ushort file_crc; + public readonly ushort file_crc; + public readonly int org_size; + public readonly int size_now; + public readonly byte major_ver; + /// minimum version needed to extract + public readonly byte minor_ver; + /// will be 1 if deleted, 0 if not + public readonly byte deleted; + /// file structure if any + public readonly byte struc; + /// points to comment; zero if none + public readonly int comment; + /// length of comment, 0 if none + public readonly ushort cmt_size; /// filename [MarshalAs(UnmanagedType.ByValArray, SizeConst = FNAMESIZE)] - byte[] fname; - /// long filename - [MarshalAs(UnmanagedType.ByValArray, SizeConst = LFNAMESIZE)] - char lfname; - byte major_ver; - /// minimum version needed to extract - byte minor_ver; + public readonly byte[] fname; + + /// length of variable part of dir entry + public readonly int var_dir_len; + /// timezone where file was archived + public readonly byte tz; + /// CRC of directory entry + public readonly ushort dir_crc; /* fields for variable part of directory entry follow */ /// length of long filename - byte namlen; - /// pos'n of next directory entry - int next; - /// position of this file - int offset; - int org_size; - /// 0 = no packing, 1 = normal LZW - byte packing_method; - int size_now; - /// file structure if any - byte struc; + public readonly byte namlen; + /// length of directory name + public readonly byte dirlen; + /// long filename + [MarshalAs(UnmanagedType.ByValArray, SizeConst = LFNAMESIZE)] + public readonly char lfname; + /// directory name + [MarshalAs(UnmanagedType.ByValArray, SizeConst = PATHSIZE)] + public readonly byte[] dirname; /// Filesystem ID - ushort system_id; - /// DOS format time - ushort time; - /// type of directory entry. always 1 for now - byte type; - /// timezone where file was archived - byte tz; - - /// length of variable part of dir entry - int var_dir_len; - /// file version number if any - ushort version_no; + public readonly ushort system_id; + /// File attributes -- 24 bits + public readonly uint fattr; /// version flag bits -- one byte in archive - ushort vflag; - /// tag -- redundancy check - uint zoo_tag; + public readonly ushort vflag; + /// file version number if any + public readonly ushort version_no; } #endregion @@ -110,28 +111,28 @@ public sealed partial class Zoo #region Nested type: ZooHeader [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] - record ZooHeader + readonly struct ZooHeader { - /// length of archive comment - ushort acmt_len; - /// position of archive comment - int acmt_pos; - byte major_ver; - /// minimum version to extract all files - byte minor_ver; /// archive header text [MarshalAs(UnmanagedType.ByValArray, SizeConst = SIZ_TEXT)] - byte[] text; - /// type of archive header - byte type; - /// byte in archive; data about versions - ushort vdata; - /// for consistency checking of zoo_start - int zoo_minus; - /// where the archive's data starts - int zoo_start; + public readonly byte[] text; /// identifies archives - uint zoo_tag; + public readonly uint zoo_tag; + /// where the archive's data starts + public readonly int zoo_start; + /// for consistency checking of zoo_start + public readonly int zoo_minus; + public readonly byte major_ver; + /// minimum version to extract all files + public readonly byte minor_ver; + /// type of archive header + public readonly byte type; + /// position of archive comment + public readonly int acmt_pos; + /// length of archive comment + public readonly ushort acmt_len; + /// byte in archive; data about versions + public readonly ushort vdata; } #endregion