Files
SabreTools.IO/SabreTools.IO.Test/Extensions/TestStructArrays.cs

60 lines
1.7 KiB
C#
Raw Normal View History

2024-04-28 22:58:42 -04:00
using System.Runtime.InteropServices;
namespace SabreTools.IO.Test.Extensions
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
internal struct TestStructArrays
{
/// <summary>
/// 4 entry byte array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? ByteArray;
/// <summary>
/// 4 entry int array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public int[]? IntArray;
2024-11-25 15:03:07 -05:00
/// <summary>
/// 4 entry int array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public TestEnum[]? EnumArray;
2024-04-28 22:58:42 -04:00
/// <summary>
/// 4 entry struct array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public TestStructPoint[]? StructArray;
2024-04-28 23:47:33 -04:00
/// <summary>
/// Length of <see cref="LPByteArray"/>
/// </summary>
public ushort LPByteArrayLength;
/// <summary>
/// 4 entry byte array whose length is defined by <see cref="LPByteArrayLength"/>
/// </summary>
2024-11-25 15:03:07 -05:00
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4)]
2024-04-28 23:47:33 -04:00
public byte[]? LPByteArray;
2024-04-28 22:58:42 -04:00
// /// <summary>
// /// 4 entry nested byte array
// /// </summary>
// /// <remarks>This will likely fail</remarks>
// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
// public byte[][]? NestedByteArray;
}
/// <summary>
/// Struct for nested tests
/// </summary>
internal struct TestStructPoint
{
public ushort X;
public ushort Y;
}
}