mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-05 22:01:33 +00:00
59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using System.Text;
|
|
using SabreTools.Data.Models.BFPK;
|
|
using SabreTools.Text.Extensions;
|
|
|
|
namespace SabreTools.Wrappers
|
|
{
|
|
public partial class BFPK : IPrintable
|
|
{
|
|
#if NETCOREAPP
|
|
/// <inheritdoc/>
|
|
public string ExportJSON() => System.Text.Json.JsonSerializer.Serialize(Model, _jsonSerializerOptions);
|
|
#endif
|
|
|
|
/// <inheritdoc/>
|
|
public void PrintInformation(StringBuilder builder)
|
|
{
|
|
builder.AppendLine("BFPK Information:");
|
|
builder.AppendLine("-------------------------");
|
|
builder.AppendLine();
|
|
|
|
Print(builder, Model.Header);
|
|
Print(builder, Model.Files);
|
|
}
|
|
|
|
private static void Print(StringBuilder builder, Header header)
|
|
{
|
|
builder.AppendLine(" Header Information:");
|
|
builder.AppendLine(" -------------------------");
|
|
builder.AppendLine(header.Magic, " Magic");
|
|
builder.AppendLine(header.Version, " Version");
|
|
builder.AppendLine(header.Files, " Files");
|
|
builder.AppendLine();
|
|
}
|
|
|
|
private static void Print(StringBuilder builder, FileEntry[] entries)
|
|
{
|
|
builder.AppendLine(" File Table Information:");
|
|
builder.AppendLine(" -------------------------");
|
|
if (entries.Length == 0)
|
|
{
|
|
builder.AppendLine(" No file table items");
|
|
return;
|
|
}
|
|
|
|
for (int i = 0; i < entries.Length; i++)
|
|
{
|
|
var entry = entries[i];
|
|
|
|
builder.AppendLine($" File Table Entry {i}");
|
|
builder.AppendLine(entry.NameSize, " Name size");
|
|
builder.AppendLine(entry.Name, " Name");
|
|
builder.AppendLine(entry.UncompressedSize, " Uncompressed size");
|
|
builder.AppendLine(entry.Offset, " Offset");
|
|
builder.AppendLine(entry.CompressedSize, " Compressed size");
|
|
}
|
|
}
|
|
}
|
|
}
|