diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/Constants.cs b/SabreTools.Serialization/Models/AdvancedInstaller/Constants.cs index 27644cb2..a1f29c4c 100644 --- a/SabreTools.Serialization/Models/AdvancedInstaller/Constants.cs +++ b/SabreTools.Serialization/Models/AdvancedInstaller/Constants.cs @@ -6,4 +6,4 @@ namespace SabreTools.Data.Models.AdvancedInstaller public const string SignatureString = "ADVINSTSFX"; } -} \ No newline at end of file +} diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/FileEntry.cs b/SabreTools.Serialization/Models/AdvancedInstaller/FileEntry.cs index 16a6fac8..0a4f168c 100644 --- a/SabreTools.Serialization/Models/AdvancedInstaller/FileEntry.cs +++ b/SabreTools.Serialization/Models/AdvancedInstaller/FileEntry.cs @@ -56,6 +56,6 @@ namespace SabreTools.Data.Models.AdvancedInstaller /// /// Unicode-encoded file name /// - public string? Name { get; set; } + public string Name { get; set; } } } diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs b/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs index ba6d97eb..180dd88c 100644 --- a/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs +++ b/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs @@ -32,7 +32,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller /// /// /// Only seen when the preceeding two fields exist - /// + /// /// Observed values: /// - 01 00 00 00 /// @@ -80,7 +80,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller /// Hex string that looks like a key or other identifier /// /// 32 bytes - public string? HexString { get; set; } + public string HexString { get; set; } /// /// Unknown @@ -89,7 +89,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller /// Offset pointer to /// 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 /// /// "ADVINSTSFX" /// - public string? Signature { get; set; } + public string Signature { get; set; } /// /// Unknown, always 0? Padding? diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs b/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs index b943d30d..bd054b72 100644 --- a/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs +++ b/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs @@ -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. /// @@ -19,11 +19,11 @@ namespace SabreTools.Data.Models.AdvancedInstaller /// /// Set of file entries /// - public FileEntry[]? Entries { get; set; } + public FileEntry[] Entries { get; set; } /// /// Footer representing the central directory /// - public Footer? Footer { get; set; } + public Footer Footer { get; set; } } } diff --git a/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs b/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs index c729d483..8c5b892a 100644 --- a/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/PortableExecutable.Extraction.cs @@ -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 == '/')