mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-02-14 21:33:08 +00:00
Port PlayJ to new printing
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
@@ -388,164 +387,10 @@ namespace BinaryObjectScanner.Wrappers
|
||||
public override StringBuilder PrettyPrint()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.AppendLine("PlayJ Audio File Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
PrintAudioHeader(builder);
|
||||
PrintUnknownBlock1(builder);
|
||||
|
||||
if (Version == 0x00000000)
|
||||
{
|
||||
PrintUnknownValue2(builder);
|
||||
PrintUnknownBlock3(builder);
|
||||
}
|
||||
else if (Version == 0x0000000A)
|
||||
{
|
||||
PrintDataFiles(builder);
|
||||
}
|
||||
|
||||
Printing.PlayJAudioFile.Print(builder, _model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print audio header information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintAudioHeader(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Audio Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Signature: {Signature} (0x{Signature:X})");
|
||||
builder.AppendLine($" Version: {Version} (0x{Version:X})");
|
||||
if (Version == 0x00000000)
|
||||
{
|
||||
builder.AppendLine($" Track ID: {V1_TrackID} (0x{V1_TrackID:X})");
|
||||
builder.AppendLine($" Unknown offset 1: {V1_UnknownOffset1} (0x{V1_UnknownOffset1:X})");
|
||||
builder.AppendLine($" Unknown offset 2: {V1_UnknownOffset2} (0x{V1_UnknownOffset2:X})");
|
||||
builder.AppendLine($" Unknown offset 3: {V1_UnknownOffset3} (0x{V1_UnknownOffset3:X})");
|
||||
builder.AppendLine($" Unknown 1: {V1_Unknown1} (0x{V1_Unknown1:X})");
|
||||
builder.AppendLine($" Unknown 2: {V1_Unknown2} (0x{V1_Unknown2:X})");
|
||||
builder.AppendLine($" Year: {V1_Year} (0x{V1_Year:X})");
|
||||
builder.AppendLine($" Track number: {V1_TrackNumber} (0x{V1_TrackNumber:X})");
|
||||
builder.AppendLine($" Subgenre: {V1_Subgenre} (0x{V1_Subgenre:X})");
|
||||
builder.AppendLine($" Duration in seconds: {V1_Duration} (0x{V1_Duration:X})");
|
||||
}
|
||||
else if (Version == 0x0000000A)
|
||||
{
|
||||
builder.AppendLine($" Unknown 1: {V2_Unknown1} (0x{V2_Unknown1:X})");
|
||||
builder.AppendLine($" Unknown 2: {V2_Unknown2} (0x{V2_Unknown2:X})");
|
||||
builder.AppendLine($" Unknown 3: {V2_Unknown3} (0x{V2_Unknown3:X})");
|
||||
builder.AppendLine($" Unknown 4: {V2_Unknown4} (0x{V2_Unknown4:X})");
|
||||
builder.AppendLine($" Unknown 5: {V2_Unknown5} (0x{V2_Unknown5:X})");
|
||||
builder.AppendLine($" Unknown 6: {V2_Unknown6} (0x{V2_Unknown6:X})");
|
||||
builder.AppendLine($" Unknown Offset 1: {V2_UnknownOffset1} (0x{V2_UnknownOffset1:X})");
|
||||
builder.AppendLine($" Unknown 7: {V2_Unknown7} (0x{V2_Unknown7:X})");
|
||||
builder.AppendLine($" Unknown 8: {V2_Unknown8} (0x{V2_Unknown8:X})");
|
||||
builder.AppendLine($" Unknown 9: {V2_Unknown9} (0x{V2_Unknown9:X})");
|
||||
builder.AppendLine($" Unknown Offset 2: {V2_UnknownOffset2} (0x{V2_UnknownOffset2:X})");
|
||||
builder.AppendLine($" Unknown 10: {V2_Unknown10} (0x{V2_Unknown10:X})");
|
||||
builder.AppendLine($" Unknown 11: {V2_Unknown11} (0x{V2_Unknown11:X})");
|
||||
builder.AppendLine($" Unknown 12: {V2_Unknown12} (0x{V2_Unknown12:X})");
|
||||
builder.AppendLine($" Unknown 13: {V2_Unknown13} (0x{V2_Unknown13:X})");
|
||||
builder.AppendLine($" Unknown 14: {V2_Unknown14} (0x{V2_Unknown14:X})");
|
||||
builder.AppendLine($" Unknown 15: {V2_Unknown15} (0x{V2_Unknown15:X})");
|
||||
builder.AppendLine($" Unknown 16: {V2_Unknown16} (0x{V2_Unknown16:X})");
|
||||
builder.AppendLine($" Unknown 17: {V2_Unknown17} (0x{V2_Unknown17:X})");
|
||||
builder.AppendLine($" Track ID: {V2_TrackID} (0x{V2_TrackID:X})");
|
||||
builder.AppendLine($" Year: {V2_Year} (0x{V2_Year:X})");
|
||||
builder.AppendLine($" Track number: {V2_TrackNumber} (0x{V2_TrackNumber:X})");
|
||||
builder.AppendLine($" Unknown 18: {V2_Unknown18} (0x{V2_Unknown18:X})");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine($" Unrecognized version, not parsed...");
|
||||
}
|
||||
builder.AppendLine($" Track length: {TrackLength} (0x{TrackLength:X})");
|
||||
builder.AppendLine($" Track: {Track ?? "[NULL]"}");
|
||||
builder.AppendLine($" Artist length: {ArtistLength} (0x{ArtistLength:X})");
|
||||
builder.AppendLine($" Artist: {Artist ?? "[NULL]"}");
|
||||
builder.AppendLine($" Album length: {AlbumLength} (0x{AlbumLength:X})");
|
||||
builder.AppendLine($" Album: {Album ?? "[NULL]"}");
|
||||
builder.AppendLine($" Writer length: {WriterLength} (0x{WriterLength:X})");
|
||||
builder.AppendLine($" Writer: {Writer ?? "[NULL]"}");
|
||||
builder.AppendLine($" Publisher length: {PublisherLength} (0x{PublisherLength:X})");
|
||||
builder.AppendLine($" Publisher: {Publisher ?? "[NULL]"}");
|
||||
builder.AppendLine($" Label length: {LabelLength} (0x{LabelLength:X})");
|
||||
builder.AppendLine($" Label: {Label ?? "[NULL]"}");
|
||||
builder.AppendLine($" Comments length: {CommentsLength} (0x{CommentsLength:X})");
|
||||
builder.AppendLine($" Comments: {Comments ?? "[NULL]"}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown block 1 information
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownBlock1(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Unknown Block 1 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Length: {UB1_Length} (0x{UB1_Length:X})");
|
||||
builder.AppendLine($" Data: {(UB1_Data == null ? "[NULL]" : BitConverter.ToString(UB1_Data).Replace('-', ' '))}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown value 2 information (V1 only)
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownValue2(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Unknown Value 2 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Value: {UnknownValue2} (0x{UnknownValue2:X})");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print unknown block 3 information (V1 only)
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintUnknownBlock3(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Unknown Block 3 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Data: {(UB3_Data == null ? "[NULL]" : BitConverter.ToString(UB3_Data).Replace('-', ' '))}");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Print data files information (V2 only)
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
private void PrintDataFiles(StringBuilder builder)
|
||||
{
|
||||
builder.AppendLine(" Data Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine($" Data files count: {DataFilesCount} (0x{DataFilesCount:X})");
|
||||
if (DataFilesCount != 0 && DataFiles != null && DataFiles.Length != 0)
|
||||
{
|
||||
for (int i = 0; i < DataFiles.Length; i++)
|
||||
{
|
||||
var dataFile = DataFiles[i];
|
||||
builder.AppendLine($" Data File {i}:");
|
||||
if (dataFile == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" File name length: {dataFile.FileNameLength} (0x{dataFile.FileNameLength:X})");
|
||||
builder.AppendLine($" File name: {dataFile.FileName ?? "[NULL]"}");
|
||||
builder.AppendLine($" Data length: {dataFile.DataLength} (0x{dataFile.DataLength:X})");
|
||||
builder.AppendLine($" Data: {(dataFile.Data == null ? "[NULL]" : BitConverter.ToString(dataFile.Data).Replace('-', ' '))}");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in New Issue
Block a user