mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-17 06:14:59 +00:00
Port WAD to new printing
This commit is contained in:
@@ -155,107 +155,10 @@ namespace BinaryObjectScanner.Wrappers
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("WAD Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintHeader(builder);
|
||||
PrintLumps(builder);
|
||||
PrintLumpInfos(builder);
|
||||
|
||||
Printing.WAD.Print(builder, _model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintHeader(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature}");
|
||||
builder.AppendLine($" Lump count: {LumpCount} (0x{LumpCount:X})");
|
||||
builder.AppendLine($" Lump offset: {LumpOffset} (0x{LumpOffset:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print lumps information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintLumps(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (Lumps == null || Lumps.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No lumps");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < Lumps.Length; i++)
|
||||
{
|
||||
var lump = Lumps[i];
|
||||
builder.AppendLine($" Lump {i}");
|
||||
if (lump == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Offset: {lump.Offset} (0x{lump.Offset:X})");
|
||||
builder.AppendLine($" Disk length: {lump.DiskLength} (0x{lump.DiskLength:X})");
|
||||
builder.AppendLine($" Length: {lump.Length} (0x{lump.Length:X})");
|
||||
builder.AppendLine($" Type: {lump.Type} (0x{lump.Type:X})");
|
||||
builder.AppendLine($" Compression: {lump.Compression} (0x{lump.Compression:X})");
|
||||
builder.AppendLine($" Padding 0: {lump.Padding0} (0x{lump.Padding0:X})");
|
||||
builder.AppendLine($" Padding 1: {lump.Padding1} (0x{lump.Padding1:X})");
|
||||
builder.AppendLine($" Name: {lump.Name ?? "[NULL]"}");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print lump infos information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintLumpInfos(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Lump Infos Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (LumpInfos == null || LumpInfos.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No lump infos");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < LumpInfos.Length; i++)
|
||||
{
|
||||
var lumpInfo = LumpInfos[i];
|
||||
builder.AppendLine($" Lump Info {i}");
|
||||
if (lumpInfo == null)
|
||||
{
|
||||
builder.AppendLine(" Lump is compressed");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine($" Name: {lumpInfo.Name ?? "[NULL]"}");
|
||||
builder.AppendLine($" Width: {lumpInfo.Width} (0x{lumpInfo.Width:X})");
|
||||
builder.AppendLine($" Height: {lumpInfo.Height} (0x{lumpInfo.Height:X})");
|
||||
builder.AppendLine($" Pixel offset: {lumpInfo.PixelOffset} (0x{lumpInfo.PixelOffset:X})");
|
||||
// TODO: Print unknown data?
|
||||
// TODO: Print pixel data?
|
||||
builder.AppendLine($" Palette size: {lumpInfo.PaletteSize} (0x{lumpInfo.PaletteSize:X})");
|
||||
// TODO: Print palette data?
|
||||
}
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user