diff --git a/SabreTools.Serialization/Models/CFB/Binary.cs b/SabreTools.Serialization/Models/CFB/Binary.cs
index 75786fba..d9e922f9 100644
--- a/SabreTools.Serialization/Models/CFB/Binary.cs
+++ b/SabreTools.Serialization/Models/CFB/Binary.cs
@@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.CFB
///
/// Compound file header
///
- public FileHeader? Header { get; set; }
+ public FileHeader Header { get; set; }
///
/// The FAT is the main allocator for space within a compound file.
@@ -22,10 +22,10 @@ namespace SabreTools.Data.Models.CFB
///
///
/// If Header Major Version is 3, there MUST be 128 fields specified to fill a 512-byte sector.
- ///
+ ///
/// If Header Major Version is 4, there MUST be 1,024 fields specified to fill a 4,096-byte sector
///
- public SectorNumber[]? FATSectorNumbers { get; set; }
+ public SectorNumber[] FATSectorNumbers { get; set; }
///
/// The mini FAT is used to allocate space in the mini stream.
@@ -35,10 +35,10 @@ namespace SabreTools.Data.Models.CFB
///
///
/// If Header Major Version is 3, there MUST be 128 fields specified to fill a 512-byte sector.
- ///
+ ///
/// If Header Major Version is 4, there MUST be 1,024 fields specified to fill a 4,096-byte sector
///
- public SectorNumber[]? MiniFATSectorNumbers { get; set; }
+ public SectorNumber[] MiniFATSectorNumbers { get; set; }
///
/// The DIFAT array is used to represent storage of the FAT sectors.
@@ -51,11 +51,11 @@ namespace SabreTools.Data.Models.CFB
///
/// If Header Major Version is 3, there MUST be 127 fields specified to
/// fill a 512-byte sector minus the "Next DIFAT Sector Location" field.
- ///
+ ///
/// If Header Major Version is 4, there MUST be 1,023 fields specified
/// to fill a 4,096-byte sector minus the "Next DIFAT Sector Location" field.
///
- public SectorNumber[]? DIFATSectorNumbers { get; set; }
+ public SectorNumber[] DIFATSectorNumbers { get; set; }
///
/// The directory entry array is an array of directory entries that
@@ -71,22 +71,22 @@ namespace SabreTools.Data.Models.CFB
/// two purposes. First, it provides a root parent for all objects that
/// are stationed at the root of the compound file. Second, its function
/// is overloaded to store the size and starting sector for the mini stream.
- ///
+ ///
/// The root directory entry behaves as both a stream and a storage object.
/// The root directory entry's Name field MUST contain the null-terminated
/// string "Root Entry" in Unicode UTF-16.
- ///
+ ///
/// The object class GUID (CLSID) that is stored in the root directory
/// entry can be used for COM activation of the document's application.
- ///
+ ///
/// The time stamps for the root storage are not maintained in the root
/// directory entry. Rather, the root storage's creation and modification
/// time stamps are normally stored on the file itself in the file system.
- ///
+ ///
/// The Creation Time field in the root storage directory entry MUST be
/// all zeroes. The Modified Time field in the root storage directory
/// entry MAY be all zeroes.
///
- public DirectoryEntry[]? DirectoryEntries { get; set; }
+ public DirectoryEntry[] DirectoryEntries { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/CFB/Constants.cs b/SabreTools.Serialization/Models/CFB/Constants.cs
index 17a102be..7cb86555 100644
--- a/SabreTools.Serialization/Models/CFB/Constants.cs
+++ b/SabreTools.Serialization/Models/CFB/Constants.cs
@@ -5,10 +5,10 @@ namespace SabreTools.Data.Models.CFB
public static class Constants
{
public static readonly byte[] SignatureBytes = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1];
-
+
public const ulong SignatureUInt64 = 0xE11AB1A1E011CFD0;
-
+
///
#region Class IDs
@@ -36,12 +36,12 @@ namespace SabreTools.Data.Models.CFB
/// The Summary Information Property Set
///
public static readonly Guid FMTID_SummaryInformation = new("F29F85E0-4FF9-1068-AB91-08002B27B3D9");
-
+
///
/// The DocumentSummaryInformation and UserDefined Property Sets
///
public static readonly Guid FMTID_DocSummaryInformation = new("D5CDD502-2E9C-101B-9397-08002B2CF9AE");
-
+
///
/// The DocumentSummaryInformation and UserDefined Property Sets
///
@@ -49,4 +49,4 @@ namespace SabreTools.Data.Models.CFB
#endregion
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/CFB/DirectoryEntry.cs b/SabreTools.Serialization/Models/CFB/DirectoryEntry.cs
index a6172d3a..537a6c5f 100644
--- a/SabreTools.Serialization/Models/CFB/DirectoryEntry.cs
+++ b/SabreTools.Serialization/Models/CFB/DirectoryEntry.cs
@@ -20,7 +20,7 @@ namespace SabreTools.Data.Models.CFB
///
/// 64 bytes
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
- public string? Name;
+ public string Name;
///
/// This field MUST match the length of the Directory Entry Name Unicode
@@ -139,4 +139,4 @@ namespace SabreTools.Data.Models.CFB
///
public ulong StreamSize;
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/CFB/Enums.cs b/SabreTools.Serialization/Models/CFB/Enums.cs
index 58978f47..5366ef27 100644
--- a/SabreTools.Serialization/Models/CFB/Enums.cs
+++ b/SabreTools.Serialization/Models/CFB/Enums.cs
@@ -471,4 +471,4 @@ namespace SabreTools.Data.Models.CFB
///
VT_BYREF = 0x4000
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Models/CFB/FileHeader.cs b/SabreTools.Serialization/Models/CFB/FileHeader.cs
index 75d04938..db1e50d6 100644
--- a/SabreTools.Serialization/Models/CFB/FileHeader.cs
+++ b/SabreTools.Serialization/Models/CFB/FileHeader.cs
@@ -128,6 +128,6 @@ namespace SabreTools.Data.Models.CFB
///
/// 109 entries
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 109)]
- public SectorNumber[]? DIFAT;
+ public SectorNumber[] DIFAT = new SectorNumber[109];
}
}
diff --git a/SabreTools.Serialization/Models/CFB/SummaryInformation.cs b/SabreTools.Serialization/Models/CFB/SummaryInformation.cs
index 523d11b7..d0e03536 100644
--- a/SabreTools.Serialization/Models/CFB/SummaryInformation.cs
+++ b/SabreTools.Serialization/Models/CFB/SummaryInformation.cs
@@ -75,7 +75,7 @@ namespace SabreTools.Data.Models.CFB
/// Properties
///
/// Each Variant might be followed by an index and offset value
- public Variant[]? Properties { get; set; }
+ public Variant[] Properties { get; set; }
#endregion
}
diff --git a/SabreTools.Serialization/Models/CFB/Variant.cs b/SabreTools.Serialization/Models/CFB/Variant.cs
index ced62522..97125977 100644
--- a/SabreTools.Serialization/Models/CFB/Variant.cs
+++ b/SabreTools.Serialization/Models/CFB/Variant.cs
@@ -40,6 +40,6 @@ namespace SabreTools.Data.Models.CFB
/// MUST contain an instance of the type, according to the value
/// in the field.
///
- public object? Union { get; set; }
+ public object Union { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/SabreTools.Serialization/Wrappers/CFB.Extraction.cs b/SabreTools.Serialization/Wrappers/CFB.Extraction.cs
index bbe6ca13..c7ad5146 100644
--- a/SabreTools.Serialization/Wrappers/CFB.Extraction.cs
+++ b/SabreTools.Serialization/Wrappers/CFB.Extraction.cs
@@ -63,7 +63,7 @@ namespace SabreTools.Serialization.Wrappers
return false;
// Ensure the output filename is trimmed
- string filename = entry.Name ?? $"entry{index}";
+ string filename = entry.Name.Length == 0 ? $"entry{index}" : entry.Name;
byte[] nameBytes = Encoding.UTF8.GetBytes(filename);
if (nameBytes[0] == 0xe4 && nameBytes[1] == 0xa1 && nameBytes[2] == 0x80)
filename = Encoding.UTF8.GetString(nameBytes, 3, nameBytes.Length - 3);
diff --git a/SabreTools.Serialization/Wrappers/CFB.Printing.cs b/SabreTools.Serialization/Wrappers/CFB.Printing.cs
index e12163a5..0f095feb 100644
--- a/SabreTools.Serialization/Wrappers/CFB.Printing.cs
+++ b/SabreTools.Serialization/Wrappers/CFB.Printing.cs
@@ -26,16 +26,10 @@ namespace SabreTools.Serialization.Wrappers
Print(builder, Model.DirectoryEntries);
}
- private static void Print(StringBuilder builder, FileHeader? header)
+ private static void Print(StringBuilder builder, FileHeader header)
{
builder.AppendLine(" File Header Information:");
builder.AppendLine(" -------------------------");
- if (header == null)
- {
- builder.AppendLine(" No file header");
- return;
- }
-
builder.AppendLine(header.Signature, " Signature");
builder.AppendLine(header.CLSID, " CLSID");
builder.AppendLine(header.MinorVersion, " Minor version");
@@ -54,7 +48,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine(header.FirstDIFATSectorLocation, " First DIFAT sector location");
builder.AppendLine(header.NumberOfDIFATSectors, " Number of DIFAT sectors");
builder.AppendLine(" DIFAT:");
- if (header.DIFAT == null || header.DIFAT.Length == 0)
+ if (header.DIFAT.Length == 0)
{
builder.AppendLine(" No DIFAT entries");
builder.AppendLine();
@@ -69,11 +63,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, SectorNumber[]? entries, string name)
+ private static void Print(StringBuilder builder, SectorNumber[] entries, string name)
{
builder.AppendLine($" {name} Sectors Information:");
builder.AppendLine(" -------------------------");
- if (entries == null || entries.Length == 0)
+ if (entries.Length == 0)
{
builder.AppendLine($" No {name} sectors");
builder.AppendLine();
@@ -88,7 +82,7 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
- private static void Print(StringBuilder builder, DirectoryEntry[]? entries)
+ private static void Print(StringBuilder builder, DirectoryEntry[] entries)
{
builder.AppendLine(" Directory Entries Information:");
builder.AppendLine(" -------------------------");
diff --git a/SabreTools.Serialization/Wrappers/CFB.cs b/SabreTools.Serialization/Wrappers/CFB.cs
index 6250b0b1..4a550935 100644
--- a/SabreTools.Serialization/Wrappers/CFB.cs
+++ b/SabreTools.Serialization/Wrappers/CFB.cs
@@ -18,16 +18,16 @@ namespace SabreTools.Serialization.Wrappers
#region Extension Properties
///
- public FileHeader? Header => Model.Header;
+ public FileHeader Header => Model.Header;
///
- public DirectoryEntry[]? DirectoryEntries => Model.DirectoryEntries;
+ public DirectoryEntry[] DirectoryEntries => Model.DirectoryEntries;
///
- public SectorNumber[]? FATSectorNumbers => Model.FATSectorNumbers;
+ public SectorNumber[] FATSectorNumbers => Model.FATSectorNumbers;
///
- public SectorNumber[]? MiniFATSectorNumbers => Model.MiniFATSectorNumbers;
+ public SectorNumber[] MiniFATSectorNumbers => Model.MiniFATSectorNumbers;
///
/// Byte array representing the mini stream