mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-05 22:01:33 +00:00
51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System.Text;
|
|
using SabreTools.Data.Models.SecuROM;
|
|
using SabreTools.Text.Extensions;
|
|
|
|
namespace SabreTools.Wrappers
|
|
{
|
|
public partial class SecuROMDFA : IPrintable
|
|
{
|
|
#if NETCOREAPP
|
|
/// <inheritdoc/>
|
|
public string ExportJSON() => System.Text.Json.JsonSerializer.Serialize(Model, _jsonSerializerOptions);
|
|
#endif
|
|
|
|
/// <inheritdoc/>
|
|
public void PrintInformation(StringBuilder builder)
|
|
{
|
|
builder.AppendLine("SecuROM DFA File Information:");
|
|
builder.AppendLine("-------------------------");
|
|
builder.AppendLine(Model.Signature, "Signature");
|
|
builder.AppendLine(Model.BlockOrHeaderSize, "Block or header size");
|
|
builder.AppendLine();
|
|
|
|
Print(builder, Model.Entries);
|
|
}
|
|
|
|
private static void Print(StringBuilder builder, DFAEntry[] entries)
|
|
{
|
|
builder.AppendLine(" Entries Information:");
|
|
builder.AppendLine(" -------------------------");
|
|
if (entries.Length == 0)
|
|
{
|
|
builder.AppendLine(" No entries");
|
|
builder.AppendLine();
|
|
return;
|
|
}
|
|
|
|
for (int i = 0; i < entries.Length; i++)
|
|
{
|
|
var entry = entries[i];
|
|
|
|
builder.AppendLine($" Entry {i}");
|
|
builder.AppendLine(entry.Name, " Name");
|
|
builder.AppendLine(entry.Length, " Length");
|
|
builder.AppendLine(entry.Value, " Value");
|
|
}
|
|
|
|
builder.AppendLine();
|
|
}
|
|
}
|
|
}
|