mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[ISO9660] Use new source generator based big endian marshaller
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
|
||||
@@ -36,12 +37,13 @@ public sealed partial class ISO9660
|
||||
#region Nested type: AmigaEntry
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct AmigaEntry
|
||||
[SwapEndian]
|
||||
partial struct AmigaEntry
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly byte length;
|
||||
public readonly byte version;
|
||||
public readonly AmigaFlags flags;
|
||||
public ushort signature;
|
||||
public byte length;
|
||||
public byte version;
|
||||
public AmigaFlags flags;
|
||||
|
||||
// Followed by AmigaProtection if present
|
||||
// Followed by length-prefixed string for comment if present
|
||||
@@ -52,12 +54,13 @@ public sealed partial class ISO9660
|
||||
#region Nested type: AmigaProtection
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct AmigaProtection
|
||||
[SwapEndian]
|
||||
partial struct AmigaProtection
|
||||
{
|
||||
public readonly byte User;
|
||||
public readonly byte Reserved;
|
||||
public readonly AmigaMultiuser Multiuser;
|
||||
public readonly AmigaAttributes Protection;
|
||||
public byte User;
|
||||
public byte Reserved;
|
||||
public AmigaMultiuser Multiuser;
|
||||
public AmigaAttributes Protection;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
|
||||
@@ -37,14 +38,15 @@ public sealed partial class ISO9660
|
||||
|
||||
// Big-endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct AppleHFSIconSystemUse
|
||||
[SwapEndian]
|
||||
partial struct AppleHFSIconSystemUse
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly AppleOldId id;
|
||||
public readonly uint type;
|
||||
public readonly uint creator;
|
||||
public ushort signature;
|
||||
public AppleOldId id;
|
||||
public uint type;
|
||||
public uint creator;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public readonly byte[] icon;
|
||||
public byte[] icon;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -53,13 +55,14 @@ public sealed partial class ISO9660
|
||||
|
||||
// Big-endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct AppleHFSOldSystemUse
|
||||
[SwapEndian]
|
||||
partial struct AppleHFSOldSystemUse
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly AppleOldId id;
|
||||
public readonly uint type;
|
||||
public readonly uint creator;
|
||||
public readonly ushort finder_flags;
|
||||
public ushort signature;
|
||||
public AppleOldId id;
|
||||
public uint type;
|
||||
public uint creator;
|
||||
public ushort finder_flags;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -68,14 +71,15 @@ public sealed partial class ISO9660
|
||||
|
||||
// Big-endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct AppleHFSSystemUse
|
||||
[SwapEndian]
|
||||
partial struct AppleHFSSystemUse
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly byte length;
|
||||
public readonly AppleId id;
|
||||
public readonly uint type;
|
||||
public readonly uint creator;
|
||||
public readonly AppleCommon.FinderFlags finder_flags;
|
||||
public ushort signature;
|
||||
public byte length;
|
||||
public AppleId id;
|
||||
public uint type;
|
||||
public uint creator;
|
||||
public AppleCommon.FinderFlags finder_flags;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -84,12 +88,13 @@ public sealed partial class ISO9660
|
||||
|
||||
// Big-endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct AppleHFSTypeCreatorSystemUse
|
||||
[SwapEndian]
|
||||
partial struct AppleHFSTypeCreatorSystemUse
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly AppleOldId id;
|
||||
public readonly uint type;
|
||||
public readonly uint creator;
|
||||
public ushort signature;
|
||||
public AppleOldId id;
|
||||
public uint type;
|
||||
public uint creator;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -89,21 +90,22 @@ public sealed partial class ISO9660
|
||||
#region Nested type: CdiDirectoryRecord
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct CdiDirectoryRecord
|
||||
[SwapEndian]
|
||||
partial struct CdiDirectoryRecord
|
||||
{
|
||||
public readonly byte length;
|
||||
public readonly byte xattr_len;
|
||||
public readonly uint reserved1;
|
||||
public readonly uint start_lbn;
|
||||
public readonly uint reserved2;
|
||||
public readonly uint size;
|
||||
public readonly HighSierraTimestamp date;
|
||||
public readonly byte reserved3;
|
||||
public readonly CdiFileFlags flags;
|
||||
public readonly ushort file_unit_size;
|
||||
public readonly ushort reserved4;
|
||||
public readonly ushort volume_sequence_number;
|
||||
public readonly byte name_len;
|
||||
public byte length;
|
||||
public byte xattr_len;
|
||||
public uint reserved1;
|
||||
public uint start_lbn;
|
||||
public uint reserved2;
|
||||
public uint size;
|
||||
public HighSierraTimestamp date;
|
||||
public byte reserved3;
|
||||
public CdiFileFlags flags;
|
||||
public ushort file_unit_size;
|
||||
public ushort reserved4;
|
||||
public ushort volume_sequence_number;
|
||||
public byte name_len;
|
||||
|
||||
// Followed by name[name_len] and then CdiSystemArea until length arrives
|
||||
}
|
||||
@@ -114,14 +116,15 @@ public sealed partial class ISO9660
|
||||
|
||||
// Follows filename on directory record
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct CdiSystemArea
|
||||
[SwapEndian]
|
||||
partial struct CdiSystemArea
|
||||
{
|
||||
public readonly ushort group;
|
||||
public readonly ushort owner;
|
||||
public readonly CdiAttributes attributes;
|
||||
public readonly ushort reserved1;
|
||||
public readonly byte file_no;
|
||||
public readonly byte reserved2;
|
||||
public ushort group;
|
||||
public ushort owner;
|
||||
public CdiAttributes attributes;
|
||||
public ushort reserved1;
|
||||
public byte file_no;
|
||||
public byte reserved2;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -129,74 +132,75 @@ public sealed partial class ISO9660
|
||||
#region Nested type: FileStructureVolumeDescriptor
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct FileStructureVolumeDescriptor
|
||||
[SwapEndian]
|
||||
partial struct FileStructureVolumeDescriptor
|
||||
{
|
||||
public readonly byte type;
|
||||
public byte type;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public readonly byte[] id;
|
||||
public readonly byte version;
|
||||
public readonly CdiVolumeFlags flags;
|
||||
public byte[] id;
|
||||
public byte version;
|
||||
public CdiVolumeFlags flags;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public readonly byte[] system_id;
|
||||
public byte[] system_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public readonly byte[] volume_id;
|
||||
public byte[] volume_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public readonly byte[] reserved1;
|
||||
public readonly uint volume_space_size;
|
||||
public byte[] reserved1;
|
||||
public uint volume_space_size;
|
||||
|
||||
// Only used in SVDs
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public readonly byte[] escape_sequences;
|
||||
public readonly ushort reserved2;
|
||||
public readonly ushort volume_set_size;
|
||||
public readonly ushort reserved3;
|
||||
public readonly ushort volume_sequence_number;
|
||||
public readonly ushort reserved4;
|
||||
public readonly ushort logical_block_size;
|
||||
public readonly uint reserved5;
|
||||
public readonly uint path_table_size;
|
||||
public readonly ulong reserved6;
|
||||
public readonly uint path_table_addr;
|
||||
public byte[] escape_sequences;
|
||||
public ushort reserved2;
|
||||
public ushort volume_set_size;
|
||||
public ushort reserved3;
|
||||
public ushort volume_sequence_number;
|
||||
public ushort reserved4;
|
||||
public ushort logical_block_size;
|
||||
public uint reserved5;
|
||||
public uint path_table_size;
|
||||
public ulong reserved6;
|
||||
public uint path_table_addr;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 38)]
|
||||
public readonly byte[] reserved7;
|
||||
public byte[] reserved7;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public readonly byte[] volume_set_id;
|
||||
public byte[] volume_set_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public readonly byte[] publisher_id;
|
||||
public byte[] publisher_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public readonly byte[] preparer_id;
|
||||
public byte[] preparer_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||
public readonly byte[] application_id;
|
||||
public byte[] application_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public readonly byte[] copyright_file_id;
|
||||
public byte[] copyright_file_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public readonly byte[] reserved8;
|
||||
public byte[] reserved8;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public readonly byte[] abstract_file_id;
|
||||
public byte[] abstract_file_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public readonly byte[] reserved9;
|
||||
public byte[] reserved9;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public readonly byte[] bibliographic_file_id;
|
||||
public byte[] bibliographic_file_id;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public readonly byte[] reserved10;
|
||||
public byte[] reserved10;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly byte[] creation_date;
|
||||
public readonly byte reserved11;
|
||||
public byte[] creation_date;
|
||||
public byte reserved11;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly byte[] modification_date;
|
||||
public readonly byte reserved12;
|
||||
public byte[] modification_date;
|
||||
public byte reserved12;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly byte[] expiration_date;
|
||||
public readonly byte reserved13;
|
||||
public byte[] expiration_date;
|
||||
public byte reserved13;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public readonly byte[] effective_date;
|
||||
public readonly byte reserved14;
|
||||
public readonly byte file_structure_version;
|
||||
public readonly byte reserved15;
|
||||
public byte[] effective_date;
|
||||
public byte reserved14;
|
||||
public byte file_structure_version;
|
||||
public byte reserved15;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
|
||||
public readonly byte[] application_data;
|
||||
public byte[] application_data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)]
|
||||
public readonly byte[] reserved16;
|
||||
public byte[] reserved16;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -112,12 +113,13 @@ public sealed partial class ISO9660
|
||||
|
||||
// There are two tables one in little endian one in big endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct HighSierraPathTableEntry
|
||||
[SwapEndian]
|
||||
partial struct HighSierraPathTableEntry
|
||||
{
|
||||
public readonly uint start_lbn;
|
||||
public readonly byte xattr_len;
|
||||
public readonly byte name_len;
|
||||
public readonly ushort parent_dirno;
|
||||
public uint start_lbn;
|
||||
public byte xattr_len;
|
||||
public byte name_len;
|
||||
public ushort parent_dirno;
|
||||
|
||||
// Followed by name[name_len]
|
||||
}
|
||||
@@ -198,14 +200,15 @@ public sealed partial class ISO9660
|
||||
#region Nested type: HighSierraTimestamp
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct HighSierraTimestamp
|
||||
[SwapEndian]
|
||||
partial struct HighSierraTimestamp
|
||||
{
|
||||
public readonly byte Years;
|
||||
public readonly byte Month;
|
||||
public readonly byte Day;
|
||||
public readonly byte Hour;
|
||||
public readonly byte Minute;
|
||||
public readonly byte Second;
|
||||
public byte Years;
|
||||
public byte Month;
|
||||
public byte Day;
|
||||
public byte Hour;
|
||||
public byte Minute;
|
||||
public byte Second;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -210,12 +211,13 @@ public sealed partial class ISO9660
|
||||
|
||||
// There are two tables one in little endian one in big endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct PathTableEntry
|
||||
[SwapEndian]
|
||||
partial struct PathTableEntry
|
||||
{
|
||||
public readonly byte name_len;
|
||||
public readonly byte xattr_len;
|
||||
public readonly uint start_lbn;
|
||||
public readonly ushort parent_dirno;
|
||||
public byte name_len;
|
||||
public byte xattr_len;
|
||||
public uint start_lbn;
|
||||
public ushort parent_dirno;
|
||||
|
||||
// Followed by name[name_len]
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
// ReSharper disable UnusedType.Local
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
|
||||
@@ -38,17 +39,18 @@ public sealed partial class ISO9660
|
||||
#region Nested type: ContinuationArea
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct ContinuationArea
|
||||
[SwapEndian]
|
||||
partial struct ContinuationArea
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly byte length;
|
||||
public readonly byte version;
|
||||
public readonly uint block;
|
||||
public readonly uint block_be;
|
||||
public readonly uint offset;
|
||||
public readonly uint offset_be;
|
||||
public readonly uint ca_length;
|
||||
public readonly uint ca_length_be;
|
||||
public ushort signature;
|
||||
public byte length;
|
||||
public byte version;
|
||||
public uint block;
|
||||
public uint block_be;
|
||||
public uint offset;
|
||||
public uint offset_be;
|
||||
public uint ca_length;
|
||||
public uint ca_length_be;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -82,15 +84,16 @@ public sealed partial class ISO9660
|
||||
#region Nested type: ReferenceArea
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct ReferenceArea
|
||||
[SwapEndian]
|
||||
partial struct ReferenceArea
|
||||
{
|
||||
public readonly ushort signature;
|
||||
public readonly byte length;
|
||||
public readonly byte version;
|
||||
public readonly byte id_len;
|
||||
public readonly byte des_len;
|
||||
public readonly byte src_len;
|
||||
public readonly byte ext_ver;
|
||||
public ushort signature;
|
||||
public byte length;
|
||||
public byte version;
|
||||
public byte id_len;
|
||||
public byte des_len;
|
||||
public byte src_len;
|
||||
public byte ext_ver;
|
||||
|
||||
// Follows extension identifier for id_len bytes
|
||||
// Follows extension descriptor for des_len bytes
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
|
||||
@@ -41,15 +42,16 @@ public sealed partial class ISO9660
|
||||
|
||||
// Big-endian
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct CdromXa
|
||||
[SwapEndian]
|
||||
partial struct CdromXa
|
||||
{
|
||||
public readonly ushort group;
|
||||
public readonly ushort user;
|
||||
public readonly XaAttributes attributes;
|
||||
public readonly ushort signature;
|
||||
public readonly byte filenumber;
|
||||
public ushort group;
|
||||
public ushort user;
|
||||
public XaAttributes attributes;
|
||||
public ushort signature;
|
||||
public byte filenumber;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public readonly byte[] reserved;
|
||||
public byte[] reserved;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user