Files
SabreTools.Models/Compression/LZX/AlignedOffsetBlock.cs

93 lines
2.6 KiB
C#
Raw Permalink Normal View History

2023-09-04 00:12:49 -04:00
namespace SabreTools.Models.Compression.LZX
2023-09-04 00:11:04 -04:00
{
/// <summary>
/// An aligned offset block is identical to the verbatim block except for the presence of the aligned offset
/// tree preceding the other trees.
/// </summary>
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
public class AlignedOffsetBlock
{
/// <summary>
/// Generic block header
/// </summary>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public BlockHeader Header;
2023-09-04 21:14:41 -04:00
#else
public BlockHeader? Header;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Aligned offset tree
/// </summary>
/// <remarks>8 elements, 3 bits each</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public byte[] AlignedOffsetTree;
2023-09-04 21:14:41 -04:00
#else
public byte[]? AlignedOffsetTree;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Pretree for first 256 elements of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public byte[] PretreeFirst256;
2023-09-04 21:14:41 -04:00
#else
public byte[]? PretreeFirst256;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Path lengths of first 256 elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public int[] PathLengthsFirst256;
2023-09-04 21:14:41 -04:00
#else
public int[]? PathLengthsFirst256;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Pretree for remainder of main tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public byte[] PretreeRemainder;
2023-09-04 21:14:41 -04:00
#else
public byte[]? PretreeRemainder;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Path lengths of remaining elements of main tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public int[] PathLengthsRemainder;
2023-09-04 21:14:41 -04:00
#else
public int[]? PathLengthsRemainder;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Pretree for length tree
/// </summary>
/// <remarks>20 elements, 4 bits each</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public byte[] PretreeLengthTree;
2023-09-04 21:14:41 -04:00
#else
public byte[]? PretreeLengthTree;
#endif
2023-09-04 00:11:04 -04:00
/// <summary>
/// Path lengths of elements in length tree
/// </summary>
/// <remarks>Encoded using pretree</remarks>
2023-09-04 21:14:41 -04:00
#if NET48
2023-09-04 00:11:04 -04:00
public int[] PathLengthsLengthTree;
2023-09-04 21:14:41 -04:00
#else
public int[]? PathLengthsLengthTree;
#endif
2023-09-04 00:11:04 -04:00
// Entry Comments Size
// ---------------------------------------------------------------------------------------
// Token sequence (matches and literals) Specified in section 2.6 Variable
}
}