mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-17 11:43:02 +00:00
AdvancedInstaller model cleanup
This commit is contained in:
@@ -6,4 +6,4 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
|
||||
public const string SignatureString = "ADVINSTSFX";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// <summary>
|
||||
/// Unicode-encoded file name
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only seen when the preceeding two fields exist
|
||||
///
|
||||
///
|
||||
/// Observed values:
|
||||
/// - 01 00 00 00
|
||||
/// </remarks>
|
||||
@@ -80,7 +80,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// Hex string that looks like a key or other identifier
|
||||
/// </summary>
|
||||
/// <remarks>32 bytes</remarks>
|
||||
public string? HexString { get; set; }
|
||||
public string HexString { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unknown
|
||||
@@ -89,7 +89,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// Offset pointer to <see cref="FileDataStart"/>
|
||||
/// relative to the end of the signature if no filename
|
||||
/// exists.
|
||||
///
|
||||
///
|
||||
/// Observed values:
|
||||
/// - 32 00 00 00 (No original filename)
|
||||
/// - 13 02 00 00 (Original filename)
|
||||
@@ -99,7 +99,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// <summary>
|
||||
/// "ADVINSTSFX"
|
||||
/// </summary>
|
||||
public string? Signature { get; set; }
|
||||
public string Signature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unknown, always 0? Padding?
|
||||
|
||||
@@ -5,12 +5,12 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// Advanced Installer SFX file. These SFX files store
|
||||
/// all files uncompressed sequentially in the overlay
|
||||
/// of an executable.
|
||||
///
|
||||
///
|
||||
/// The design is similar to the end of central directory
|
||||
/// in a PKZIP file. The footer needs to be read before
|
||||
/// the entry table as both the pointer to the start of
|
||||
/// the table as well as the entry count are included there.
|
||||
///
|
||||
///
|
||||
/// The layout of this is derived from the layout in the
|
||||
/// physical file.
|
||||
/// </summary>
|
||||
@@ -19,11 +19,11 @@ namespace SabreTools.Data.Models.AdvancedInstaller
|
||||
/// <summary>
|
||||
/// Set of file entries
|
||||
/// </summary>
|
||||
public FileEntry[]? Entries { get; set; }
|
||||
public FileEntry[] Entries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Footer representing the central directory
|
||||
/// </summary>
|
||||
public Footer? Footer { get; set; }
|
||||
public Footer Footer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
// Try to deserialize the source data
|
||||
var deserializer = new Readers.AdvancedInstaller();
|
||||
var sfx = deserializer.Deserialize(_dataSource);
|
||||
if (sfx?.Entries == null)
|
||||
if (sfx == null || sfx.Entries.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through the entries and extract
|
||||
@@ -80,7 +80,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
continue;
|
||||
|
||||
// Ensure directory separators are consistent
|
||||
string filename = entry.Name ?? $"FILE_{i}";
|
||||
string filename = entry.Name.Length == 0 ? $"FILE_{i}" : entry.Name;
|
||||
if (Path.DirectorySeparatorChar == '\\')
|
||||
filename = filename.Replace('/', '\\');
|
||||
else if (Path.DirectorySeparatorChar == '/')
|
||||
|
||||
Reference in New Issue
Block a user