mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
More BZip documenting
This commit is contained in:
12
SabreTools.Serialization/Models/BZip2/Block.cs
Normal file
12
SabreTools.Serialization/Models/BZip2/Block.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace SabreTools.Data.Models.BZip2
|
||||
{
|
||||
public class Block
|
||||
{
|
||||
/// <summary>
|
||||
/// Block header
|
||||
/// </summary>
|
||||
public BlockHeader? Header { get; set; }
|
||||
|
||||
// TODO: Implement remaining structures
|
||||
}
|
||||
}
|
||||
37
SabreTools.Serialization/Models/BZip2/BlockHeader.cs
Normal file
37
SabreTools.Serialization/Models/BZip2/BlockHeader.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
namespace SabreTools.Data.Models.BZip2
|
||||
{
|
||||
public class BlockHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// A 48-bit integer value 31 41 59 26 53 59, which
|
||||
/// is the binary-coded decimal representation of
|
||||
/// pi. It is used to differentiate the block
|
||||
/// from the footer.
|
||||
/// </summary>
|
||||
/// <remarks>This may not be byte-aligned</remarks>
|
||||
public byte[]? Magic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The CRC-32 checksum of the uncompressed data contained
|
||||
/// in <see cref="BlockData"/>. It is the same checksum
|
||||
/// used in GZip, but is slightly different due to the
|
||||
/// bit-packing differences.
|
||||
/// </summary>
|
||||
public uint Crc32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Should be 0. Previous versions of BZip2 allowed
|
||||
/// the input data to be randomized to avoid
|
||||
/// pathological strings from causing the runtime
|
||||
/// to be exponential.
|
||||
/// </summary>
|
||||
/// <remarks>Actually a 1-bit value</remarks>
|
||||
public byte Randomized { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contains the origin pointer used in the BWT stage
|
||||
/// </summary>
|
||||
/// <remarks>Actually a 24-bit value</remarks>
|
||||
public uint OrigPtr { get; set; }
|
||||
}
|
||||
}
|
||||
26
SabreTools.Serialization/Models/BZip2/BlockTrees.cs
Normal file
26
SabreTools.Serialization/Models/BZip2/BlockTrees.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace SabreTools.Data.Models.BZip2
|
||||
{
|
||||
public class BlockTrees
|
||||
{
|
||||
// TODO: Implement SymMap
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the number of Huffman trees used in
|
||||
/// the HUFF stage. It must between 2 and 6.
|
||||
/// </summary>
|
||||
/// <remarks>Actually a 3-bit value</remarks>
|
||||
public byte NumTrees { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates the number of selectors used in the
|
||||
/// HUFF stage. There must be at least 1 selector
|
||||
/// defined.
|
||||
/// </summary>
|
||||
/// <remarks>Actually a 15-bit value</remarks>
|
||||
public ushort NumSels { get; set; }
|
||||
|
||||
// TODO: Implement Selectors
|
||||
|
||||
// TODO: Implement Trees
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,4 @@ namespace SabreTools.Data.Models.BZip2
|
||||
|
||||
public const string SignatureString = "BZh";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user