mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-16 05:45:03 +00:00
Port NCF to new printing
This commit is contained in:
406
BinaryObjectScanner.Printing/NCF.cs
Normal file
406
BinaryObjectScanner.Printing/NCF.cs
Normal file
@@ -0,0 +1,406 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.NCF;
|
||||
|
||||
namespace BinaryObjectScanner.Printing
|
||||
{
|
||||
public static class NCF
|
||||
{
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("NCF Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Header
|
||||
Print(builder, file.Header);
|
||||
|
||||
// Directory and Directory Maps
|
||||
Print(builder, file.DirectoryHeader);
|
||||
Print(builder, file.DirectoryEntries);
|
||||
// TODO: Should we print out the entire string table?
|
||||
Print(builder, file.DirectoryInfo1Entries);
|
||||
Print(builder, file.DirectoryInfo2Entries);
|
||||
Print(builder, file.DirectoryCopyEntries);
|
||||
Print(builder, file.DirectoryLocalEntries);
|
||||
Print(builder, file.UnknownHeader);
|
||||
Print(builder, file.UnknownEntries);
|
||||
|
||||
// Checksums and Checksum Maps
|
||||
Print(builder, file.ChecksumHeader);
|
||||
Print(builder, file.ChecksumMapHeader);
|
||||
Print(builder, file.ChecksumMapEntries);
|
||||
Print(builder, file.ChecksumEntries);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Dummy0, " Dummy 0");
|
||||
builder.AppendLine(header.MajorVersion, " Major version");
|
||||
builder.AppendLine(header.MinorVersion, " Minor version");
|
||||
builder.AppendLine(header.CacheID, " Cache ID");
|
||||
builder.AppendLine(header.LastVersionPlayed, " Last version played");
|
||||
builder.AppendLine(header.Dummy1, " Dummy 1");
|
||||
builder.AppendLine(header.Dummy2, " Dummy 2");
|
||||
builder.AppendLine(header.FileSize, " File size");
|
||||
builder.AppendLine(header.BlockSize, " Block size");
|
||||
builder.AppendLine(header.BlockCount, " Block count");
|
||||
builder.AppendLine(header.Dummy3, " Dummy 3");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No directory header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Dummy0, " Dummy 0");
|
||||
builder.AppendLine(header.CacheID, " Cache ID");
|
||||
builder.AppendLine(header.LastVersionPlayed, " Last version played");
|
||||
builder.AppendLine(header.ItemCount, " Item count");
|
||||
builder.AppendLine(header.FileCount, " File count");
|
||||
builder.AppendLine(header.ChecksumDataLength, " Checksum data length");
|
||||
builder.AppendLine(header.DirectorySize, " Directory size");
|
||||
builder.AppendLine(header.NameSize, " Name size");
|
||||
builder.AppendLine(header.Info1Count, " Info 1 count");
|
||||
builder.AppendLine(header.CopyCount, " Copy count");
|
||||
builder.AppendLine(header.LocalCount, " Local count");
|
||||
builder.AppendLine(header.Dummy1, " Dummy 1");
|
||||
builder.AppendLine(header.Dummy2, " Dummy 2");
|
||||
builder.AppendLine(header.Checksum, " Checksum");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.NameOffset, " Name offset");
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.ItemSize, " Item size");
|
||||
builder.AppendLine(entry.ChecksumIndex, " Checksum index");
|
||||
builder.AppendLine($" Directory flags: {entry.DirectoryFlags} (0x{entry.DirectoryFlags:X})");
|
||||
builder.AppendLine(entry.ParentIndex, " Parent index");
|
||||
builder.AppendLine(entry.NextIndex, " Next index");
|
||||
builder.AppendLine(entry.FirstIndex, " First index");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory info 1 entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory info 2 entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory copy entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory local entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.DirectoryIndex, " Directory index");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, UnknownHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, UnknownHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No unknown header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Dummy0, " Dummy 0");
|
||||
builder.AppendLine(header.Dummy1, " Dummy 1");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, UnknownEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, UnknownEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No unknown entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Unknown Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.Dummy0, " Dummy 0");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No checksum header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Dummy0, " Dummy 0");
|
||||
builder.AppendLine(header.ChecksumSize, " Checksum size");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumMapHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumMapHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No checksum map header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Dummy0, " Dummy 0");
|
||||
builder.AppendLine(header.Dummy1, " Dummy 1");
|
||||
builder.AppendLine(header.ItemCount, " Item count");
|
||||
builder.AppendLine(header.ChecksumCount, " Checksum count");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No checksum map entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.ChecksumCount, " Checksum count");
|
||||
builder.AppendLine(entry.FirstChecksumIndex, " First checksum index");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No checksum entries");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.Checksum, " Checksum");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -453,370 +453,10 @@ namespace BinaryObjectScanner.Wrappers
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("NCF Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
// Header
|
||||
PrintHeader(builder);
|
||||
|
||||
// Directory and Directory Maps
|
||||
PrintDirectoryHeader(builder);
|
||||
PrintDirectoryEntries(builder);
|
||||
// TODO: Should we print out the entire string table?
|
||||
PrintDirectoryInfo1Entries(builder);
|
||||
PrintDirectoryInfo2Entries(builder);
|
||||
PrintDirectoryCopyEntries(builder);
|
||||
PrintDirectoryLocalEntries(builder);
|
||||
PrintUnknownHeader(builder);
|
||||
PrintUnknownEntries(builder);
|
||||
|
||||
// Checksums and Checksum Maps
|
||||
PrintChecksumHeader(builder);
|
||||
PrintChecksumMapHeader(builder);
|
||||
PrintChecksumMapEntries(builder);
|
||||
PrintChecksumEntries(builder);
|
||||
|
||||
Printing.NCF.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($" Dummy 0: {Dummy0} (0x{Dummy0:X})");
|
||||
builder.AppendLine($" Major version: {MajorVersion} (0x{MajorVersion:X})");
|
||||
builder.AppendLine($" Minor version: {MinorVersion} (0x{MinorVersion:X})");
|
||||
builder.AppendLine($" Cache ID: {CacheID} (0x{CacheID:X})");
|
||||
builder.AppendLine($" Last version played: {LastVersionPlayed} (0x{LastVersionPlayed:X})");
|
||||
builder.AppendLine($" Dummy 1: {Dummy1} (0x{Dummy1:X})");
|
||||
builder.AppendLine($" Dummy 2: {Dummy2} (0x{Dummy2:X})");
|
||||
builder.AppendLine($" File size: {FileSize} (0x{FileSize:X})");
|
||||
builder.AppendLine($" Block size: {BlockSize} (0x{BlockSize:X})");
|
||||
builder.AppendLine($" Block count: {BlockCount} (0x{BlockCount:X})");
|
||||
builder.AppendLine($" Dummy 3: {Dummy3} (0x{Dummy3:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryHeader(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Dummy 0: {DH_Dummy0} (0x{DH_Dummy0:X})");
|
||||
builder.AppendLine($" Cache ID: {DH_CacheID} (0x{DH_CacheID:X})");
|
||||
builder.AppendLine($" Last version played: {DH_LastVersionPlayed} (0x{DH_LastVersionPlayed:X})");
|
||||
builder.AppendLine($" Item count: {DH_ItemCount} (0x{DH_ItemCount:X})");
|
||||
builder.AppendLine($" File count: {DH_FileCount} (0x{DH_FileCount:X})");
|
||||
builder.AppendLine($" Checksum data length: {DH_ChecksumDataLength} (0x{DH_ChecksumDataLength:X})");
|
||||
builder.AppendLine($" Directory size: {DH_DirectorySize} (0x{DH_DirectorySize:X})");
|
||||
builder.AppendLine($" Name size: {DH_NameSize} (0x{DH_NameSize:X})");
|
||||
builder.AppendLine($" Info 1 count: {DH_Info1Count} (0x{DH_Info1Count:X})");
|
||||
builder.AppendLine($" Copy count: {DH_CopyCount} (0x{DH_CopyCount:X})");
|
||||
builder.AppendLine($" Local count: {DH_LocalCount} (0x{DH_LocalCount:X})");
|
||||
builder.AppendLine($" Dummy 1: {DH_Dummy1} (0x{DH_Dummy1:X})");
|
||||
builder.AppendLine($" Dummy 2: {DH_Dummy2} (0x{DH_Dummy2:X})");
|
||||
builder.AppendLine($" Checksum: {DH_Checksum} (0x{DH_Checksum:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryEntries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryEntries.Length; i++)
|
||||
{
|
||||
var directoryEntry = DirectoryEntries[i];
|
||||
builder.AppendLine($" Directory Entry {i}");
|
||||
if (directoryEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Name offset: {directoryEntry.NameOffset} (0x{directoryEntry.NameOffset:X})");
|
||||
builder.AppendLine($" Name: {directoryEntry.Name}");
|
||||
builder.AppendLine($" Item size: {directoryEntry.ItemSize} (0x{directoryEntry.ItemSize:X})");
|
||||
builder.AppendLine($" Checksum index: {directoryEntry.ChecksumIndex} (0x{directoryEntry.ChecksumIndex:X})");
|
||||
builder.AppendLine($" Directory flags: {directoryEntry.DirectoryFlags} (0x{directoryEntry.DirectoryFlags:X})");
|
||||
builder.AppendLine($" Parent index: {directoryEntry.ParentIndex} (0x{directoryEntry.ParentIndex:X})");
|
||||
builder.AppendLine($" Next index: {directoryEntry.NextIndex} (0x{directoryEntry.NextIndex:X})");
|
||||
builder.AppendLine($" First index: {directoryEntry.FirstIndex} (0x{directoryEntry.FirstIndex:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory info 1 entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryInfo1Entries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryInfo1Entries == null || DirectoryInfo1Entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory info 1 entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryInfo1Entries.Length; i++)
|
||||
{
|
||||
var directoryInfoEntry = DirectoryInfo1Entries[i];
|
||||
builder.AppendLine($" Directory Info 1 Entry {i}");
|
||||
if (directoryInfoEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory info 2 entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryInfo2Entries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryInfo2Entries == null || DirectoryInfo2Entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory info 2 entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryInfo2Entries.Length; i++)
|
||||
{
|
||||
var directoryInfoEntry = DirectoryInfo2Entries[i];
|
||||
builder.AppendLine($" Directory Info 2 Entry {i}");
|
||||
if (directoryInfoEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Dummy 0: {directoryInfoEntry.Dummy0} (0x{directoryInfoEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory copy entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryCopyEntries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryCopyEntries == null || DirectoryCopyEntries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory copy entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryCopyEntries.Length; i++)
|
||||
{
|
||||
var directoryCopyEntry = DirectoryCopyEntries[i];
|
||||
builder.AppendLine($" Directory Copy Entry {i}");
|
||||
if (directoryCopyEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory index: {directoryCopyEntry.DirectoryIndex} (0x{directoryCopyEntry.DirectoryIndex:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print directory local entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDirectoryLocalEntries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (DirectoryLocalEntries == null || DirectoryLocalEntries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory local entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < DirectoryLocalEntries.Length; i++)
|
||||
{
|
||||
var directoryLocalEntry = DirectoryLocalEntries[i];
|
||||
builder.AppendLine($" Directory Local Entry {i}");
|
||||
if (directoryLocalEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Directory index: {directoryLocalEntry.DirectoryIndex} (0x{directoryLocalEntry.DirectoryIndex:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownHeader(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Unknown Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Dummy 0: {UH_Dummy0} (0x{UH_Dummy0:X})");
|
||||
builder.AppendLine($" Dummy 1: {UH_Dummy1} (0x{UH_Dummy1:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownEntries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Unknown Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (UnknownEntries == null || UnknownEntries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No unknown entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < UnknownEntries.Length; i++)
|
||||
{
|
||||
var unknownEntry = UnknownEntries[i];
|
||||
builder.AppendLine($" Unknown Entry {i}");
|
||||
if (unknownEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Dummy 0: {unknownEntry.Dummy0} (0x{unknownEntry.Dummy0:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumHeader(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Checksum Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Dummy 0: {CH_Dummy0} (0x{CH_Dummy0:X})");
|
||||
builder.AppendLine($" Checksum size: {CH_ChecksumSize} (0x{CH_ChecksumSize:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum map header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumMapHeader(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Dummy 0: {CMH_Dummy0} (0x{CMH_Dummy0:X})");
|
||||
builder.AppendLine($" Dummy 1: {CMH_Dummy1} (0x{CMH_Dummy1:X})");
|
||||
builder.AppendLine($" Item count: {CMH_ItemCount} (0x{CMH_ItemCount:X})");
|
||||
builder.AppendLine($" Checksum count: {CMH_ChecksumCount} (0x{CMH_ChecksumCount:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum map entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumMapEntries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ChecksumMapEntries == null || ChecksumMapEntries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No checksum map entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ChecksumMapEntries.Length; i++)
|
||||
{
|
||||
var checksumMapEntry = ChecksumMapEntries[i];
|
||||
builder.AppendLine($" Checksum Map Entry {i}");
|
||||
if (checksumMapEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Checksum count: {checksumMapEntry.ChecksumCount} (0x{checksumMapEntry.ChecksumCount:X})");
|
||||
builder.AppendLine($" First checksum index: {checksumMapEntry.FirstChecksumIndex} (0x{checksumMapEntry.FirstChecksumIndex:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print checksum entries information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintChecksumEntries(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (ChecksumEntries == null || ChecksumEntries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No checksum entries");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < ChecksumEntries.Length; i++)
|
||||
{
|
||||
var checksumEntry = ChecksumEntries[i];
|
||||
builder.AppendLine($" Checksum Entry {i}");
|
||||
if (checksumEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Checksum: {checksumEntry.Checksum} (0x{checksumEntry.Checksum:X})");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user