mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-19 15:25:18 +00:00
PFF model cleanup
This commit is contained in:
@@ -9,16 +9,16 @@ namespace SabreTools.Data.Models.PFF
|
||||
/// <summary>
|
||||
/// Archive header
|
||||
/// </summary>
|
||||
public Header? Header { get; set; }
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Segments
|
||||
/// </summary>
|
||||
public Segment[]? Segments { get; set; }
|
||||
public Segment[] Segments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Footer
|
||||
/// </summary>
|
||||
public Footer? Footer { get; set; }
|
||||
public Footer Footer { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace SabreTools.Data.Models.PFF
|
||||
public static readonly byte[] Version0SignatureBytes = [0x50, 0x46, 0x46, 0x30];
|
||||
|
||||
public const string Version0SignatureString = "PFF0";
|
||||
|
||||
|
||||
public const uint Version0HSegmentSize = 0x00000020;
|
||||
|
||||
// Version 1 not confirmed
|
||||
@@ -33,4 +33,4 @@ namespace SabreTools.Data.Models.PFF
|
||||
|
||||
public const string FooterKingTag = "KING";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,6 @@ namespace SabreTools.Data.Models.PFF
|
||||
/// King tag
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
|
||||
public string? KingTag;
|
||||
public string KingTag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace SabreTools.Data.Models.PFF
|
||||
/// </summary>
|
||||
/// <remarks>Versions 2 and 3 share the same signature but different header sizes</remarks>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
|
||||
public string? Signature;
|
||||
public string Signature;
|
||||
|
||||
/// <summary>
|
||||
/// Number of files
|
||||
@@ -37,4 +37,4 @@ namespace SabreTools.Data.Models.PFF
|
||||
/// </summary>
|
||||
public uint FileListOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,4 +43,4 @@ namespace SabreTools.Data.Models.PFF
|
||||
/// <remarks>Only for version 4</remarks>
|
||||
public uint CompressionLevel { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,17 +23,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
Print(builder, Model.Footer);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.HeaderSize, " Header size");
|
||||
builder.AppendLine(header.Signature, " Signature");
|
||||
builder.AppendLine(header.NumberOfFiles, " Number of files");
|
||||
@@ -42,11 +35,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Segment[]? entries)
|
||||
private static void Print(StringBuilder builder, Segment[] entries)
|
||||
{
|
||||
builder.AppendLine(" Segments Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No segments");
|
||||
builder.AppendLine();
|
||||
@@ -70,17 +63,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Footer? footer)
|
||||
private static void Print(StringBuilder builder, Footer footer)
|
||||
{
|
||||
builder.AppendLine(" Footer Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (footer == null)
|
||||
{
|
||||
builder.AppendLine(" No footer");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(footer.SystemIP, " System IP");
|
||||
builder.AppendLine(footer.Reserved, " Reserved");
|
||||
builder.AppendLine(footer.KingTag, " King tag");
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <summary>
|
||||
/// Number of files in the archive
|
||||
/// </summary>
|
||||
public long FileCount => Model.Header?.NumberOfFiles ?? 0;
|
||||
public long FileCount => Model.Header.NumberOfFiles;
|
||||
|
||||
/// <inheritdoc cref="Archive.Segments"/>
|
||||
public Segment[] Segments => Model.Segments ?? [];
|
||||
public Segment[] Segments => Model.Segments;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user