2024-04-24 18:53:10 -04:00
|
|
|
using System.Text;
|
2025-09-26 13:06:18 -04:00
|
|
|
using SabreTools.Data.Models.BFPK;
|
2026-03-24 19:42:36 -04:00
|
|
|
using SabreTools.Text.Extensions;
|
2024-04-24 18:53:10 -04:00
|
|
|
|
2026-03-18 16:37:59 -04:00
|
|
|
namespace SabreTools.Wrappers
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
2025-10-29 08:53:14 -04:00
|
|
|
public partial class BFPK : IPrintable
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
2025-10-29 08:53:14 -04:00
|
|
|
#if NETCOREAPP
|
2024-04-24 18:53:10 -04:00
|
|
|
/// <inheritdoc/>
|
2025-10-29 08:53:14 -04:00
|
|
|
public string ExportJSON() => System.Text.Json.JsonSerializer.Serialize(Model, _jsonSerializerOptions);
|
|
|
|
|
#endif
|
2024-04-24 18:53:10 -04:00
|
|
|
|
2025-10-29 08:53:14 -04:00
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public void PrintInformation(StringBuilder builder)
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
|
|
|
|
builder.AppendLine("BFPK Information:");
|
|
|
|
|
builder.AppendLine("-------------------------");
|
|
|
|
|
builder.AppendLine();
|
|
|
|
|
|
2025-10-29 09:23:45 -04:00
|
|
|
Print(builder, Model.Header);
|
|
|
|
|
Print(builder, Model.Files);
|
2024-04-24 18:53:10 -04:00
|
|
|
}
|
|
|
|
|
|
2025-10-30 20:57:35 -04:00
|
|
|
private static void Print(StringBuilder builder, Header header)
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
|
|
|
|
builder.AppendLine(" Header Information:");
|
|
|
|
|
builder.AppendLine(" -------------------------");
|
|
|
|
|
builder.AppendLine(header.Magic, " Magic");
|
|
|
|
|
builder.AppendLine(header.Version, " Version");
|
|
|
|
|
builder.AppendLine(header.Files, " Files");
|
|
|
|
|
builder.AppendLine();
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-30 20:57:35 -04:00
|
|
|
private static void Print(StringBuilder builder, FileEntry[] entries)
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
|
|
|
|
builder.AppendLine(" File Table Information:");
|
|
|
|
|
builder.AppendLine(" -------------------------");
|
2025-10-30 20:57:35 -04:00
|
|
|
if (entries.Length == 0)
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
|
|
|
|
builder.AppendLine(" No file table items");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-29 21:35:56 -05:00
|
|
|
for (int i = 0; i < entries.Length; i++)
|
2024-04-24 18:53:10 -04:00
|
|
|
{
|
2024-11-29 21:35:56 -05:00
|
|
|
var entry = entries[i];
|
2024-04-24 18:53:10 -04:00
|
|
|
|
2024-11-29 21:35:56 -05:00
|
|
|
builder.AppendLine($" File Table Entry {i}");
|
2024-04-24 18:53:10 -04:00
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-07-24 09:31:28 -04:00
|
|
|
}
|