mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-02-04 05:36:12 +00:00
XZP model cleanup
This commit is contained in:
@@ -14,4 +14,4 @@ namespace SabreTools.Data.Models.XZP
|
||||
|
||||
public const uint FooterSignatureUInt32 = 0x587a4674;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace SabreTools.Data.Models.XZP
|
||||
|
||||
public uint NameOffset { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public uint TimeCreated { get; set; }
|
||||
}
|
||||
|
||||
@@ -9,31 +9,31 @@ namespace SabreTools.Data.Models.XZP
|
||||
/// <summary>
|
||||
/// Header data
|
||||
/// </summary>
|
||||
public Header? Header { get; set; }
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Directory entries data
|
||||
/// </summary>
|
||||
public DirectoryEntry[]? DirectoryEntries { get; set; }
|
||||
public DirectoryEntry[] DirectoryEntries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preload directory entries data
|
||||
/// </summary>
|
||||
public DirectoryEntry[]? PreloadDirectoryEntries { get; set; }
|
||||
public DirectoryEntry[] PreloadDirectoryEntries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Preload directory mappings data
|
||||
/// </summary>
|
||||
public DirectoryMapping[]? PreloadDirectoryMappings { get; set; }
|
||||
public DirectoryMapping[] PreloadDirectoryMappings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Directory items data
|
||||
/// </summary>
|
||||
public DirectoryItem[]? DirectoryItems { get; set; }
|
||||
public DirectoryItem[] DirectoryItems { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Footer data
|
||||
/// </summary>
|
||||
public Footer? Footer { get; set; }
|
||||
public Footer Footer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.XZP
|
||||
/// </summary>
|
||||
/// <remarks>4 bytes</remarks>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
|
||||
public string? Signature;
|
||||
public string Signature;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.XZP
|
||||
/// </summary>
|
||||
/// <remarks>4 bytes</remarks>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
|
||||
public string? Signature;
|
||||
public string Signature;
|
||||
|
||||
public uint Version;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public bool Extract(string outputDirectory, bool includeDebug)
|
||||
{
|
||||
// If we have no directory entries
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
if (DirectoryEntries.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through and extract all files to the output
|
||||
@@ -32,11 +32,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public bool ExtractFile(int index, string outputDirectory, bool includeDebug)
|
||||
{
|
||||
// If we have no directory entries
|
||||
if (DirectoryEntries == null || DirectoryEntries.Length == 0)
|
||||
if (DirectoryEntries.Length == 0)
|
||||
return false;
|
||||
|
||||
// If we have no directory items
|
||||
if (DirectoryItems == null || DirectoryItems.Length == 0)
|
||||
if (DirectoryItems.Length == 0)
|
||||
return false;
|
||||
|
||||
// If the directory entry index is invalid
|
||||
|
||||
@@ -26,17 +26,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.Signature, " Signature");
|
||||
builder.AppendLine(header.Version, " Version");
|
||||
builder.AppendLine(header.PreloadDirectoryEntryCount, " Preload directory entry count");
|
||||
@@ -49,11 +42,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[]? entries, string prefix)
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[] entries, string prefix)
|
||||
{
|
||||
builder.AppendLine($" {prefix} Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory entries");
|
||||
builder.AppendLine();
|
||||
@@ -73,11 +66,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryMapping[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryMapping[] entries)
|
||||
{
|
||||
builder.AppendLine(" Preload Directory Mappings Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No preload directory mappings");
|
||||
builder.AppendLine();
|
||||
@@ -95,11 +88,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryItem[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryItem[] entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory items");
|
||||
builder.AppendLine();
|
||||
@@ -120,17 +113,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 header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(footer.FileLength, " File length");
|
||||
builder.AppendLine(footer.Signature, " Signature");
|
||||
builder.AppendLine();
|
||||
|
||||
@@ -14,10 +14,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="Models.XZP.File.DirectoryEntries"/>
|
||||
public Data.Models.XZP.DirectoryEntry[]? DirectoryEntries => Model.DirectoryEntries;
|
||||
public Data.Models.XZP.DirectoryEntry[] DirectoryEntries => Model.DirectoryEntries;
|
||||
|
||||
/// <inheritdoc cref="Models.XZP.File.DirectoryItems"/>
|
||||
public Data.Models.XZP.DirectoryItem[]? DirectoryItems => Model.DirectoryItems;
|
||||
public Data.Models.XZP.DirectoryItem[] DirectoryItems => Model.DirectoryItems;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user