mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-05 22:01:33 +00:00
52 lines
2.2 KiB
C#
52 lines
2.2 KiB
C#
using System.Text;
|
|
using SabreTools.Data.Models.LZ;
|
|
using SabreTools.Text.Extensions;
|
|
|
|
namespace SabreTools.Wrappers
|
|
{
|
|
public partial class LZKWAJ : IPrintable
|
|
{
|
|
#if NETCOREAPP
|
|
/// <inheritdoc/>
|
|
public string ExportJSON() => System.Text.Json.JsonSerializer.Serialize(Model, _jsonSerializerOptions);
|
|
#endif
|
|
|
|
/// <inheritdoc/>
|
|
public void PrintInformation(StringBuilder builder)
|
|
{
|
|
builder.AppendLine("LZ-compressed File, KWAJ Variant Information:");
|
|
builder.AppendLine("-------------------------");
|
|
builder.AppendLine();
|
|
|
|
Print(builder, Model.Header);
|
|
Print(builder, Model.HeaderExtensions ?? new());
|
|
}
|
|
|
|
private static void Print(StringBuilder builder, KWAJHeader header)
|
|
{
|
|
builder.AppendLine(" Header Information:");
|
|
builder.AppendLine(" -------------------------");
|
|
builder.AppendLine(header.Magic, " Magic number");
|
|
builder.AppendLine($" Compression type: {header.CompressionType} (0x{header.CompressionType:X})");
|
|
builder.AppendLine(header.DataOffset, " Data offset");
|
|
builder.AppendLine($" Header flags: {header.HeaderFlags} (0x{header.HeaderFlags:X})");
|
|
builder.AppendLine();
|
|
}
|
|
|
|
private static void Print(StringBuilder builder, KWAJHeaderExtensions header)
|
|
{
|
|
builder.AppendLine(" Header Extensions Information:");
|
|
builder.AppendLine(" -------------------------");
|
|
builder.AppendLine(header.DecompressedLength, " Decompressed length");
|
|
builder.AppendLine(header.UnknownPurpose, " Unknown purpose");
|
|
builder.AppendLine(header.UnknownDataLength, " Unknown data length");
|
|
builder.AppendLine(header.UnknownData, " Unknown data");
|
|
builder.AppendLine(header.FileName, " File name");
|
|
builder.AppendLine(header.FileExtension, " File extension");
|
|
builder.AppendLine(header.ArbitraryTextLength, " Arbitrary text length");
|
|
builder.AppendLine(header.ArbitraryText, " Arbitrary text");
|
|
builder.AppendLine();
|
|
}
|
|
}
|
|
}
|