diff --git a/SabreTools.Serialization/Extensions/PortableExecutable.cs b/SabreTools.Serialization/Extensions/PortableExecutable.cs index 816b7bba..b9551b0d 100644 --- a/SabreTools.Serialization/Extensions/PortableExecutable.cs +++ b/SabreTools.Serialization/Extensions/PortableExecutable.cs @@ -121,7 +121,7 @@ namespace SabreTools.Data.Extensions obj.Offset = data.ReadUInt32LittleEndian(ref offset); obj.Timestamp = data.ReadUInt32LittleEndian(ref offset); obj.Age = data.ReadUInt32LittleEndian(ref offset); - obj.PdbFileName = data.ReadNullTerminatedAnsiString(ref offset); + obj.PdbFileName = data.ReadNullTerminatedAnsiString(ref offset) ?? string.Empty; return obj; } @@ -142,7 +142,7 @@ namespace SabreTools.Data.Extensions obj.GUID = data.ReadGuid(ref offset); obj.Age = data.ReadUInt32LittleEndian(ref offset); - obj.PathAndFileName = data.ReadNullTerminatedUTF8String(ref offset); + obj.PathAndFileName = data.ReadNullTerminatedUTF8String(ref offset) ?? string.Empty; return obj; } @@ -260,7 +260,7 @@ namespace SabreTools.Data.Extensions offset += sizeof(ushort); // Read the menu resource as a string - dialogTemplateExtended.MenuResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplateExtended.MenuResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -292,7 +292,7 @@ namespace SabreTools.Data.Extensions offset += sizeof(ushort); // Read the class resource as a string - dialogTemplateExtended.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplateExtended.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -319,7 +319,7 @@ namespace SabreTools.Data.Extensions else { // Read the title resource as a string - dialogTemplateExtended.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplateExtended.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -340,7 +340,7 @@ namespace SabreTools.Data.Extensions dialogTemplateExtended.Weight = entry.Data.ReadUInt16LittleEndian(ref offset); dialogTemplateExtended.Italic = entry.Data.ReadByte(ref offset); dialogTemplateExtended.CharSet = entry.Data.ReadByte(ref offset); - dialogTemplateExtended.Typeface = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplateExtended.Typeface = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; } // Align to the DWORD boundary if we're not at the end @@ -392,7 +392,7 @@ namespace SabreTools.Data.Extensions offset += sizeof(ushort); // Read the class resource as a string - dialogItemTemplate.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogItemTemplate.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -418,7 +418,7 @@ namespace SabreTools.Data.Extensions else { // Read the title resource as a string - dialogItemTemplate.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogItemTemplate.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -482,7 +482,7 @@ namespace SabreTools.Data.Extensions offset += sizeof(ushort); // Read the menu resource as a string - dialogTemplate.MenuResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplate.MenuResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -518,7 +518,7 @@ namespace SabreTools.Data.Extensions offset += sizeof(ushort); // Read the class resource as a string - dialogTemplate.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplate.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -549,7 +549,7 @@ namespace SabreTools.Data.Extensions else { // Read the title resource as a string - dialogTemplate.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplate.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -569,7 +569,7 @@ namespace SabreTools.Data.Extensions dialogTemplate.PointSizeValue = entry.Data.ReadUInt16LittleEndian(ref offset); // Read the font name as a string - dialogTemplate.Typeface = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogTemplate.Typeface = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; } // Align to the DWORD boundary if we're not at the end @@ -620,7 +620,7 @@ namespace SabreTools.Data.Extensions offset += sizeof(ushort); // Read the class resource as a string - dialogItemTemplate.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogItemTemplate.ClassResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -646,7 +646,7 @@ namespace SabreTools.Data.Extensions else { // Read the title resource as a string - dialogItemTemplate.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + dialogItemTemplate.TitleResource = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the WORD boundary if we're not at the end entry.Data.AlignToBoundary(ref offset, 2); @@ -738,8 +738,8 @@ namespace SabreTools.Data.Extensions dirEntry.Entry.Reserved = entry.Data.ReadUInt32LittleEndian(ref offset); // TODO: Determine how to read these two? Immediately after? - dirEntry.Entry.DeviceName = entry.Data.ReadNullTerminatedAnsiString(ref offset); - dirEntry.Entry.FaceName = entry.Data.ReadNullTerminatedAnsiString(ref offset); + dirEntry.Entry.DeviceName = entry.Data.ReadNullTerminatedAnsiString(ref offset) ?? string.Empty; + dirEntry.Entry.FaceName = entry.Data.ReadNullTerminatedAnsiString(ref offset) ?? string.Empty; fontGroupHeader.DE[i] = dirEntry; } @@ -927,7 +927,7 @@ namespace SabreTools.Data.Extensions stringFileInfo.Length = data.ReadUInt16LittleEndian(ref offset); stringFileInfo.ValueLength = data.ReadUInt16LittleEndian(ref offset); stringFileInfo.ResourceType = (VersionResourceType)data.ReadUInt16LittleEndian(ref offset); - stringFileInfo.Key = data.ReadNullTerminatedUnicodeString(ref offset); + stringFileInfo.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; if (stringFileInfo.Key != "StringFileInfo") { offset -= 6 + ((stringFileInfo.Key?.Length ?? 0 + 1) * 2); @@ -945,7 +945,7 @@ namespace SabreTools.Data.Extensions stringTable.Length = data.ReadUInt16LittleEndian(ref offset); stringTable.ValueLength = data.ReadUInt16LittleEndian(ref offset); stringTable.ResourceType = (VersionResourceType)data.ReadUInt16LittleEndian(ref offset); - stringTable.Key = data.ReadNullTerminatedUnicodeString(ref offset); + stringTable.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the DWORD boundary if we're not at the end data.AlignToBoundary(ref offset, 4); @@ -959,7 +959,7 @@ namespace SabreTools.Data.Extensions stringData.Length = data.ReadUInt16LittleEndian(ref offset); stringData.ValueLength = data.ReadUInt16LittleEndian(ref offset); stringData.ResourceType = (VersionResourceType)data.ReadUInt16LittleEndian(ref offset); - stringData.Key = data.ReadNullTerminatedUnicodeString(ref offset); + stringData.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; // Align to the DWORD boundary if we're not at the end data.AlignToBoundary(ref offset, 4); @@ -1036,7 +1036,7 @@ namespace SabreTools.Data.Extensions varFileInfo.Length = data.ReadUInt16LittleEndian(ref offset); varFileInfo.ValueLength = data.ReadUInt16LittleEndian(ref offset); varFileInfo.ResourceType = (VersionResourceType)data.ReadUInt16LittleEndian(ref offset); - varFileInfo.Key = data.ReadNullTerminatedUnicodeString(ref offset); + varFileInfo.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; if (varFileInfo.Key != "VarFileInfo") return null; @@ -1051,7 +1051,7 @@ namespace SabreTools.Data.Extensions varData.Length = data.ReadUInt16LittleEndian(ref offset); varData.ValueLength = data.ReadUInt16LittleEndian(ref offset); varData.ResourceType = (VersionResourceType)data.ReadUInt16LittleEndian(ref offset); - varData.Key = data.ReadNullTerminatedUnicodeString(ref offset); + varData.Key = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; if (varData.Key != "Translation") { offset -= 6 + ((varData.Key?.Length ?? 0 + 1) * 2); @@ -1101,7 +1101,7 @@ namespace SabreTools.Data.Extensions versionInfo.Length = entry.Data.ReadUInt16LittleEndian(ref offset); versionInfo.ValueLength = entry.Data.ReadUInt16LittleEndian(ref offset); versionInfo.ResourceType = (VersionResourceType)entry.Data.ReadUInt16LittleEndian(ref offset); - versionInfo.Key = entry.Data.ReadNullTerminatedUnicodeString(ref offset); + versionInfo.Key = entry.Data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; if (versionInfo.Key != "VS_VERSION_INFO") return null; @@ -1204,7 +1204,7 @@ namespace SabreTools.Data.Extensions obj.State = (MenuFlags)data.ReadUInt32LittleEndian(ref offset); obj.ID = data.ReadUInt32LittleEndian(ref offset); obj.Flags = (MenuFlags)data.ReadUInt32LittleEndian(ref offset); - obj.MenuText = data.ReadNullTerminatedUnicodeString(ref offset); + obj.MenuText = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; return obj; } @@ -1253,7 +1253,7 @@ namespace SabreTools.Data.Extensions var obj = new NormalMenuItem(); obj.NormalResInfo = (MenuFlags)data.ReadUInt32LittleEndian(ref offset); - obj.NormalMenuText = data.ReadNullTerminatedUnicodeString(ref offset); + obj.NormalMenuText = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; return obj; } @@ -1272,7 +1272,7 @@ namespace SabreTools.Data.Extensions obj.PopupState = (MenuFlags)data.ReadUInt32LittleEndian(ref offset); obj.PopupID = data.ReadUInt32LittleEndian(ref offset); obj.PopupResInfo = (MenuFlags)data.ReadUInt32LittleEndian(ref offset); - obj.PopupMenuText = data.ReadNullTerminatedUnicodeString(ref offset); + obj.PopupMenuText = data.ReadNullTerminatedUnicodeString(ref offset) ?? string.Empty; return obj; } diff --git a/SabreTools.Serialization/Models/AACS/CopyrightRecord.cs b/SabreTools.Serialization/Models/AACS/CopyrightRecord.cs index 1be349af..f9bc44fc 100644 --- a/SabreTools.Serialization/Models/AACS/CopyrightRecord.cs +++ b/SabreTools.Serialization/Models/AACS/CopyrightRecord.cs @@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.AACS /// Null-terminated ASCII string representing the copyright /// [MarshalAs(UnmanagedType.LPStr)] - public string Copyright; + public string Copyright = string.Empty; } } diff --git a/SabreTools.Serialization/Models/AACS/DriveRevocationListRecord.cs b/SabreTools.Serialization/Models/AACS/DriveRevocationListRecord.cs index 4ef5da19..3e8d030e 100644 --- a/SabreTools.Serialization/Models/AACS/DriveRevocationListRecord.cs +++ b/SabreTools.Serialization/Models/AACS/DriveRevocationListRecord.cs @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.AACS /// /// Revocation list entries /// - public DriveRevocationSignatureBlock[] SignatureBlocks { get; set; } + public DriveRevocationSignatureBlock[] SignatureBlocks { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/DriveRevocationSignatureBlock.cs b/SabreTools.Serialization/Models/AACS/DriveRevocationSignatureBlock.cs index 8bd7d246..35eb8bf7 100644 --- a/SabreTools.Serialization/Models/AACS/DriveRevocationSignatureBlock.cs +++ b/SabreTools.Serialization/Models/AACS/DriveRevocationSignatureBlock.cs @@ -12,6 +12,6 @@ namespace SabreTools.Data.Models.AACS /// A list of 8-byte Host Drive List Entry fields, the length of this /// list being equal to the number in the signature block. /// - public DriveRevocationListEntry[] EntryFields { get; set; } + public DriveRevocationListEntry[] EntryFields { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/EndOfMediaKeyBlockRecord.cs b/SabreTools.Serialization/Models/AACS/EndOfMediaKeyBlockRecord.cs index 98c7b488..680083cb 100644 --- a/SabreTools.Serialization/Models/AACS/EndOfMediaKeyBlockRecord.cs +++ b/SabreTools.Serialization/Models/AACS/EndOfMediaKeyBlockRecord.cs @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.AACS /// must refuse to use the Media Key. /// /// -4 bytes - public byte[] SignatureData { get; set; } + public byte[] SignatureData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/ExplicitSubsetDifferenceRecord.cs b/SabreTools.Serialization/Models/AACS/ExplicitSubsetDifferenceRecord.cs index 41a907d8..5f1e489a 100644 --- a/SabreTools.Serialization/Models/AACS/ExplicitSubsetDifferenceRecord.cs +++ b/SabreTools.Serialization/Models/AACS/ExplicitSubsetDifferenceRecord.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.AACS /// /// In this record, each subset-difference is encoded with 5 bytes. /// - public SubsetDifference[] SubsetDifferences { get; set; } + public SubsetDifference[] SubsetDifferences { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/GenericRecord.cs b/SabreTools.Serialization/Models/AACS/GenericRecord.cs index 9711fb4d..7651652a 100644 --- a/SabreTools.Serialization/Models/AACS/GenericRecord.cs +++ b/SabreTools.Serialization/Models/AACS/GenericRecord.cs @@ -8,6 +8,6 @@ namespace SabreTools.Data.Models.AACS /// /// Unparsed data comprising the record after the header /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/HostRevocationListRecord.cs b/SabreTools.Serialization/Models/AACS/HostRevocationListRecord.cs index 7f2f2e09..87005d80 100644 --- a/SabreTools.Serialization/Models/AACS/HostRevocationListRecord.cs +++ b/SabreTools.Serialization/Models/AACS/HostRevocationListRecord.cs @@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.AACS /// /// Revocation list entries /// - public HostRevocationSignatureBlock[] SignatureBlocks { get; set; } + public HostRevocationSignatureBlock[] SignatureBlocks { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/HostRevocationSignatureBlock.cs b/SabreTools.Serialization/Models/AACS/HostRevocationSignatureBlock.cs index 94885a73..d74e5986 100644 --- a/SabreTools.Serialization/Models/AACS/HostRevocationSignatureBlock.cs +++ b/SabreTools.Serialization/Models/AACS/HostRevocationSignatureBlock.cs @@ -12,6 +12,6 @@ namespace SabreTools.Data.Models.AACS /// A list of 8-byte Host Revocation List Entry fields, the length of this /// list being equal to the number in the signature block. /// - public HostRevocationListEntry[] EntryFields { get; set; } + public HostRevocationListEntry[] EntryFields { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/MediaKeyBlock.cs b/SabreTools.Serialization/Models/AACS/MediaKeyBlock.cs index 3f0b8614..ac47175c 100644 --- a/SabreTools.Serialization/Models/AACS/MediaKeyBlock.cs +++ b/SabreTools.Serialization/Models/AACS/MediaKeyBlock.cs @@ -9,6 +9,6 @@ namespace SabreTools.Data.Models.AACS /// /// Records /// - public Record[] Records { get; set; } + public Record[] Records { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/MediaKeyDataRecord.cs b/SabreTools.Serialization/Models/AACS/MediaKeyDataRecord.cs index 22037d5f..8ea5cf19 100644 --- a/SabreTools.Serialization/Models/AACS/MediaKeyDataRecord.cs +++ b/SabreTools.Serialization/Models/AACS/MediaKeyDataRecord.cs @@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.AACS /// record. This 16 bytes is the ciphertext value C in the media /// key calculation. /// - public byte[][] MediaKeyData { get; set; } + public byte[][] MediaKeyData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AACS/SubsetDifferenceIndexRecord.cs b/SabreTools.Serialization/Models/AACS/SubsetDifferenceIndexRecord.cs index d87068df..86ece010 100644 --- a/SabreTools.Serialization/Models/AACS/SubsetDifferenceIndexRecord.cs +++ b/SabreTools.Serialization/Models/AACS/SubsetDifferenceIndexRecord.cs @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.AACS /// Subset-Difference record, with 0 being the start of the record. /// // UInt24 not UInt32 - public uint[] Offsets { get; set; } + public uint[] Offsets { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/FileEntry.cs b/SabreTools.Serialization/Models/AdvancedInstaller/FileEntry.cs index 0a4f168c..3e84fa62 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; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs b/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs index 180dd88c..1a331464 100644 --- a/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs +++ b/SabreTools.Serialization/Models/AdvancedInstaller/Footer.cs @@ -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; } = string.Empty; /// /// Unknown @@ -99,7 +99,7 @@ namespace SabreTools.Data.Models.AdvancedInstaller /// /// "ADVINSTSFX" /// - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// /// Unknown, always 0? Padding? diff --git a/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs b/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs index bd054b72..022e219f 100644 --- a/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs +++ b/SabreTools.Serialization/Models/AdvancedInstaller/SFX.cs @@ -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; } = new(); } } diff --git a/SabreTools.Serialization/Models/BDPlus/SVM.cs b/SabreTools.Serialization/Models/BDPlus/SVM.cs index e66d066d..8eaff26c 100644 --- a/SabreTools.Serialization/Models/BDPlus/SVM.cs +++ b/SabreTools.Serialization/Models/BDPlus/SVM.cs @@ -9,7 +9,7 @@ namespace SabreTools.Data.Models.BDPlus /// "BDSVM_CC" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string Signature; + public string Signature = string.Empty; /// /// Unknown data @@ -45,6 +45,6 @@ namespace SabreTools.Data.Models.BDPlus /// /// bytes of data /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BFPK/Archive.cs b/SabreTools.Serialization/Models/BFPK/Archive.cs index a10a53c6..b80a22d7 100644 --- a/SabreTools.Serialization/Models/BFPK/Archive.cs +++ b/SabreTools.Serialization/Models/BFPK/Archive.cs @@ -9,11 +9,11 @@ /// /// Header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Files /// - public FileEntry[] Files { get; set; } + public FileEntry[] Files { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BFPK/FileEntry.cs b/SabreTools.Serialization/Models/BFPK/FileEntry.cs index 02ca4790..7094b0d4 100644 --- a/SabreTools.Serialization/Models/BFPK/FileEntry.cs +++ b/SabreTools.Serialization/Models/BFPK/FileEntry.cs @@ -14,7 +14,7 @@ /// /// Name /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Uncompressed size diff --git a/SabreTools.Serialization/Models/BFPK/Header.cs b/SabreTools.Serialization/Models/BFPK/Header.cs index b1cf2666..ba68bfd6 100644 --- a/SabreTools.Serialization/Models/BFPK/Header.cs +++ b/SabreTools.Serialization/Models/BFPK/Header.cs @@ -13,7 +13,7 @@ namespace SabreTools.Data.Models.BFPK /// "BFPK" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Magic; + public string Magic = string.Empty; /// /// Version diff --git a/SabreTools.Serialization/Models/BSP/AmbientIndexLump.cs b/SabreTools.Serialization/Models/BSP/AmbientIndexLump.cs index f1a49208..b3fac278 100644 --- a/SabreTools.Serialization/Models/BSP/AmbientIndexLump.cs +++ b/SabreTools.Serialization/Models/BSP/AmbientIndexLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Indicies /// - public LeafAmbientIndex[] Indicies { get; set; } + public LeafAmbientIndex[] Indicies { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/AmbientLightingLump.cs b/SabreTools.Serialization/Models/BSP/AmbientLightingLump.cs index c7004194..d262afc2 100644 --- a/SabreTools.Serialization/Models/BSP/AmbientLightingLump.cs +++ b/SabreTools.Serialization/Models/BSP/AmbientLightingLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Lightings /// - public LeafAmbientLighting[] Lightings { get; set; } + public LeafAmbientLighting[] Lightings { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BrushesLump.cs b/SabreTools.Serialization/Models/BSP/BrushesLump.cs index abc10f16..e73da7dc 100644 --- a/SabreTools.Serialization/Models/BSP/BrushesLump.cs +++ b/SabreTools.Serialization/Models/BSP/BrushesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Brushes /// - public Brush[] Brushes { get; set; } + public Brush[] Brushes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BrushsidesLump.cs b/SabreTools.Serialization/Models/BSP/BrushsidesLump.cs index c156f689..838c34f8 100644 --- a/SabreTools.Serialization/Models/BSP/BrushsidesLump.cs +++ b/SabreTools.Serialization/Models/BSP/BrushsidesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Brushsides /// - public Brushside[] Brushsides { get; set; } + public Brushside[] Brushsides { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BspFacesLump.cs b/SabreTools.Serialization/Models/BSP/BspFacesLump.cs index 5620435e..7b4bc35d 100644 --- a/SabreTools.Serialization/Models/BSP/BspFacesLump.cs +++ b/SabreTools.Serialization/Models/BSP/BspFacesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Faces /// - public BspFace[] Faces { get; set; } + public BspFace[] Faces { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BspFile.cs b/SabreTools.Serialization/Models/BSP/BspFile.cs index 0649fe31..510dc073 100644 --- a/SabreTools.Serialization/Models/BSP/BspFile.cs +++ b/SabreTools.Serialization/Models/BSP/BspFile.cs @@ -10,84 +10,84 @@ namespace SabreTools.Data.Models.BSP /// /// Header data /// - public BspHeader Header { get; set; } + public BspHeader Header { get; set; } = new(); #region Lumps /// /// LUMP_ENTITIES [0] /// - public EntitiesLump Entities { get; set; } + public EntitiesLump Entities { get; set; } = new(); /// /// LUMP_PLANES [1] /// - public PlanesLump PlanesLump { get; set; } + public PlanesLump PlanesLump { get; set; } = new(); /// /// LUMP_TEXTURES [2] /// - public TextureLump TextureLump { get; set; } + public TextureLump TextureLump { get; set; } = new(); /// /// LUMP_VERTICES [3] /// - public VerticesLump VerticesLump { get; set; } + public VerticesLump VerticesLump { get; set; } = new(); /// /// LUMP_VISIBILITY [4] /// - public VisibilityLump VisibilityLump { get; set; } + public VisibilityLump VisibilityLump { get; set; } = new(); /// /// LUMP_NODES [5] /// - public BspNodesLump NodesLump { get; set; } + public BspNodesLump NodesLump { get; set; } = new(); /// /// LUMP_TEXINFO [6] /// - public BspTexinfoLump TexinfoLump { get; set; } + public BspTexinfoLump TexinfoLump { get; set; } = new(); /// /// LUMP_FACES [7] /// - public BspFacesLump FacesLump { get; set; } + public BspFacesLump FacesLump { get; set; } = new(); /// /// LUMP_LIGHTING [8] /// - public LightmapLump LightmapLump { get; set; } + public LightmapLump LightmapLump { get; set; } = new(); /// /// LUMP_CLIPNODES [9] /// s - public ClipnodesLump ClipnodesLump { get; set; } + public ClipnodesLump ClipnodesLump { get; set; } = new(); /// /// LUMP_LEAVES [10] /// - public BspLeavesLump LeavesLump { get; set; } + public BspLeavesLump LeavesLump { get; set; } = new(); /// /// LUMP_MARKSURFACES [11] /// - public MarksurfacesLump MarksurfacesLump { get; set; } + public MarksurfacesLump MarksurfacesLump { get; set; } = new(); /// /// LUMP_EDGES [12] /// - public EdgesLump EdgesLump { get; set; } + public EdgesLump EdgesLump { get; set; } = new(); /// /// LUMP_SURFEDGES [13] /// - public SurfedgesLump SurfedgesLump { get; set; } + public SurfedgesLump SurfedgesLump { get; set; } = new(); /// /// LUMP_MODELS [14] /// - public BspModelsLump ModelsLump { get; set; } + public BspModelsLump ModelsLump { get; set; } = new(); #endregion } diff --git a/SabreTools.Serialization/Models/BSP/BspLeavesLump.cs b/SabreTools.Serialization/Models/BSP/BspLeavesLump.cs index 18755b9f..3bdcab33 100644 --- a/SabreTools.Serialization/Models/BSP/BspLeavesLump.cs +++ b/SabreTools.Serialization/Models/BSP/BspLeavesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Leaves /// - public BspLeaf[] Leaves { get; set; } + public BspLeaf[] Leaves { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BspModel.cs b/SabreTools.Serialization/Models/BSP/BspModel.cs index 496e1879..80127f03 100644 --- a/SabreTools.Serialization/Models/BSP/BspModel.cs +++ b/SabreTools.Serialization/Models/BSP/BspModel.cs @@ -27,17 +27,17 @@ namespace SabreTools.Data.Models.BSP /// /// Defines bounding box /// - public Vector3D Mins; + public Vector3D Mins = new(); /// /// Defines bounding box /// - public Vector3D Maxs; + public Vector3D Maxs = new(); /// /// Coordinates to move the coordinate system /// - public Vector3D OriginVector; + public Vector3D OriginVector = new(); /// /// Index into nodes array diff --git a/SabreTools.Serialization/Models/BSP/BspModelsLump.cs b/SabreTools.Serialization/Models/BSP/BspModelsLump.cs index ffb68c50..18986840 100644 --- a/SabreTools.Serialization/Models/BSP/BspModelsLump.cs +++ b/SabreTools.Serialization/Models/BSP/BspModelsLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Model /// - public BspModel[] Models { get; set; } + public BspModel[] Models { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BspNodesLump.cs b/SabreTools.Serialization/Models/BSP/BspNodesLump.cs index c3494ad8..a4f62602 100644 --- a/SabreTools.Serialization/Models/BSP/BspNodesLump.cs +++ b/SabreTools.Serialization/Models/BSP/BspNodesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Nodes /// - public BspNode[] Nodes { get; set; } + public BspNode[] Nodes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/BspTexinfo.cs b/SabreTools.Serialization/Models/BSP/BspTexinfo.cs index dd70cc2e..3add88b2 100644 --- a/SabreTools.Serialization/Models/BSP/BspTexinfo.cs +++ b/SabreTools.Serialization/Models/BSP/BspTexinfo.cs @@ -22,7 +22,7 @@ namespace SabreTools.Data.Models.BSP /// /// S-vector /// - public Vector3D SVector; + public Vector3D SVector = new(); /// /// Texture shift in the S direction @@ -32,7 +32,7 @@ namespace SabreTools.Data.Models.BSP /// /// T-vector /// - public Vector3D TVector; + public Vector3D TVector = new(); /// /// Texture shift in the T direction diff --git a/SabreTools.Serialization/Models/BSP/BspTexinfoLump.cs b/SabreTools.Serialization/Models/BSP/BspTexinfoLump.cs index daec0cdd..145c4ea7 100644 --- a/SabreTools.Serialization/Models/BSP/BspTexinfoLump.cs +++ b/SabreTools.Serialization/Models/BSP/BspTexinfoLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Texinfos /// - public BspTexinfo[] Texinfos { get; set; } + public BspTexinfo[] Texinfos { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/ClipnodesLump.cs b/SabreTools.Serialization/Models/BSP/ClipnodesLump.cs index d14f3fdb..085fc97b 100644 --- a/SabreTools.Serialization/Models/BSP/ClipnodesLump.cs +++ b/SabreTools.Serialization/Models/BSP/ClipnodesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Clipnodes /// - public Clipnode[] Clipnodes { get; set; } + public Clipnode[] Clipnodes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/CompressedLightCube.cs b/SabreTools.Serialization/Models/BSP/CompressedLightCube.cs index 68a30625..7b2e62fb 100644 --- a/SabreTools.Serialization/Models/BSP/CompressedLightCube.cs +++ b/SabreTools.Serialization/Models/BSP/CompressedLightCube.cs @@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.BSP public class CompressedLightCube { [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] - public ColorRGBExp32[] Colors; + public ColorRGBExp32[] Colors = new ColorRGBExp32[6]; } } diff --git a/SabreTools.Serialization/Models/BSP/CubemapsLump.cs b/SabreTools.Serialization/Models/BSP/CubemapsLump.cs index c33e86f7..37084535 100644 --- a/SabreTools.Serialization/Models/BSP/CubemapsLump.cs +++ b/SabreTools.Serialization/Models/BSP/CubemapsLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Cubemaps /// - public Cubemap[] Cubemaps { get; set; } + public Cubemap[] Cubemaps { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/DispInfo.cs b/SabreTools.Serialization/Models/BSP/DispInfo.cs index 25bcdd87..5298b958 100644 --- a/SabreTools.Serialization/Models/BSP/DispInfo.cs +++ b/SabreTools.Serialization/Models/BSP/DispInfo.cs @@ -25,7 +25,7 @@ namespace SabreTools.Data.Models.BSP /// /// Start position used for orientation /// - public Vector3D StartPosition; + public Vector3D StartPosition = new(); /// /// Index into LUMP_DISP_VERTS. diff --git a/SabreTools.Serialization/Models/BSP/DispInfosLump.cs b/SabreTools.Serialization/Models/BSP/DispInfosLump.cs index d442c9cb..1dffd861 100644 --- a/SabreTools.Serialization/Models/BSP/DispInfosLump.cs +++ b/SabreTools.Serialization/Models/BSP/DispInfosLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Infos /// - public DispInfo[] Infos { get; set; } + public DispInfo[] Infos { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/DispTrisLump.cs b/SabreTools.Serialization/Models/BSP/DispTrisLump.cs index 7ed90805..3673a9a5 100644 --- a/SabreTools.Serialization/Models/BSP/DispTrisLump.cs +++ b/SabreTools.Serialization/Models/BSP/DispTrisLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Tris /// - public DispTri[] Tris { get; set; } + public DispTri[] Tris { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/DispVert.cs b/SabreTools.Serialization/Models/BSP/DispVert.cs index 76c2fcd3..267dc319 100644 --- a/SabreTools.Serialization/Models/BSP/DispVert.cs +++ b/SabreTools.Serialization/Models/BSP/DispVert.cs @@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.BSP /// /// Vector field defining displacement volume. /// - public Vector3D Vec; + public Vector3D Vec = new(); /// /// Displacement distances. diff --git a/SabreTools.Serialization/Models/BSP/DispVertsLump.cs b/SabreTools.Serialization/Models/BSP/DispVertsLump.cs index 96923400..6fac9bfe 100644 --- a/SabreTools.Serialization/Models/BSP/DispVertsLump.cs +++ b/SabreTools.Serialization/Models/BSP/DispVertsLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Verts /// - public DispVert[] Verts { get; set; } + public DispVert[] Verts { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/EdgesLump.cs b/SabreTools.Serialization/Models/BSP/EdgesLump.cs index 1b137c03..20e0c91d 100644 --- a/SabreTools.Serialization/Models/BSP/EdgesLump.cs +++ b/SabreTools.Serialization/Models/BSP/EdgesLump.cs @@ -7,6 +7,6 @@ namespace SabreTools.Data.Models.BSP /// /// Edge /// - public Edge[] Edges { get; set; } + public Edge[] Edges { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/EntitiesLump.cs b/SabreTools.Serialization/Models/BSP/EntitiesLump.cs index 7cbeec0e..38acdcb3 100644 --- a/SabreTools.Serialization/Models/BSP/EntitiesLump.cs +++ b/SabreTools.Serialization/Models/BSP/EntitiesLump.cs @@ -7,6 +7,6 @@ namespace SabreTools.Data.Models.BSP /// /// Entities /// - public Entity[] Entities { get; set; } + public Entity[] Entities { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/Entity.cs b/SabreTools.Serialization/Models/BSP/Entity.cs index 563b6e1f..8f770fd1 100644 --- a/SabreTools.Serialization/Models/BSP/Entity.cs +++ b/SabreTools.Serialization/Models/BSP/Entity.cs @@ -23,6 +23,6 @@ namespace SabreTools.Data.Models.BSP /// /// Entity attributes /// - public List> Attributes { get; set; } + public List> Attributes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/GameLump.cs b/SabreTools.Serialization/Models/BSP/GameLump.cs index fb833140..f1a07ba4 100644 --- a/SabreTools.Serialization/Models/BSP/GameLump.cs +++ b/SabreTools.Serialization/Models/BSP/GameLump.cs @@ -12,11 +12,11 @@ namespace SabreTools.Data.Models.BSP /// /// Number of game lumps /// - public int LumpCount; + public int LumpCount { get; set; } /// /// /// - public GameLumpDirectory[] Directories; + public GameLumpDirectory[] Directories { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/LeafAmbientLighting.cs b/SabreTools.Serialization/Models/BSP/LeafAmbientLighting.cs index bc96a9d8..a0b862e0 100644 --- a/SabreTools.Serialization/Models/BSP/LeafAmbientLighting.cs +++ b/SabreTools.Serialization/Models/BSP/LeafAmbientLighting.cs @@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.BSP [StructLayout(LayoutKind.Sequential)] public sealed class LeafAmbientLighting { - public CompressedLightCube? Cube; + public CompressedLightCube Cube = new(); /// /// Fixed point fraction of leaf bounds diff --git a/SabreTools.Serialization/Models/BSP/LeafBrushesLump.cs b/SabreTools.Serialization/Models/BSP/LeafBrushesLump.cs index fe75c234..38851313 100644 --- a/SabreTools.Serialization/Models/BSP/LeafBrushesLump.cs +++ b/SabreTools.Serialization/Models/BSP/LeafBrushesLump.cs @@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.BSP /// /// Map /// - public ushort[] Map { get; set; } + public ushort[] Map { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/LeafFacesLump.cs b/SabreTools.Serialization/Models/BSP/LeafFacesLump.cs index 94b45fad..c4d993dc 100644 --- a/SabreTools.Serialization/Models/BSP/LeafFacesLump.cs +++ b/SabreTools.Serialization/Models/BSP/LeafFacesLump.cs @@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.BSP /// /// Map /// - public ushort[] Map { get; set; } + public ushort[] Map { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/LightmapLump.cs b/SabreTools.Serialization/Models/BSP/LightmapLump.cs index afd1808a..334defef 100644 --- a/SabreTools.Serialization/Models/BSP/LightmapLump.cs +++ b/SabreTools.Serialization/Models/BSP/LightmapLump.cs @@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.BSP /// Lightmap RGB values /// /// Array of 3-byte values - public byte[][] Lightmap { get; set; } + public byte[][] Lightmap { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/MarksurfacesLump.cs b/SabreTools.Serialization/Models/BSP/MarksurfacesLump.cs index fffcd030..13880796 100644 --- a/SabreTools.Serialization/Models/BSP/MarksurfacesLump.cs +++ b/SabreTools.Serialization/Models/BSP/MarksurfacesLump.cs @@ -14,6 +14,6 @@ namespace SabreTools.Data.Models.BSP /// /// Marksurfaces /// - public ushort[] Marksurfaces { get; set; } + public ushort[] Marksurfaces { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/MipTexture.cs b/SabreTools.Serialization/Models/BSP/MipTexture.cs index 91e5e0f9..d7084e10 100644 --- a/SabreTools.Serialization/Models/BSP/MipTexture.cs +++ b/SabreTools.Serialization/Models/BSP/MipTexture.cs @@ -23,7 +23,7 @@ namespace SabreTools.Data.Models.BSP /// Name of texture /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAXTEXTURENAME)] - public string? Name; + public string Name = string.Empty; /// /// Extends of the texture @@ -39,6 +39,6 @@ namespace SabreTools.Data.Models.BSP /// Offsets to texture mipmaps BSPMIPTEX /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MIPLEVELS)] - public uint[] Offsets; + public uint[] Offsets = new uint[Constants.MIPLEVELS]; } } diff --git a/SabreTools.Serialization/Models/BSP/OccluderData.cs b/SabreTools.Serialization/Models/BSP/OccluderData.cs index 50d6754c..9ecd370c 100644 --- a/SabreTools.Serialization/Models/BSP/OccluderData.cs +++ b/SabreTools.Serialization/Models/BSP/OccluderData.cs @@ -27,12 +27,12 @@ namespace SabreTools.Data.Models.BSP /// /// Minima of all vertices /// - public Vector3D Mins; + public Vector3D Mins = new(); /// /// Maxima of all vertices /// - public Vector3D Maxs; + public Vector3D Maxs = new(); /// Since v1 public int Area; diff --git a/SabreTools.Serialization/Models/BSP/OcclusionLump.cs b/SabreTools.Serialization/Models/BSP/OcclusionLump.cs index 6cc41550..a8352096 100644 --- a/SabreTools.Serialization/Models/BSP/OcclusionLump.cs +++ b/SabreTools.Serialization/Models/BSP/OcclusionLump.cs @@ -27,20 +27,20 @@ namespace SabreTools.Data.Models.BSP /// /// /// - public OccluderData[] Data; + public OccluderData[] Data { get; set; } = []; public int PolyDataCount; /// /// /// - public OccluderPolyData[] PolyData; + public OccluderPolyData[] PolyData { get; set; } = []; public int VertexIndexCount; /// /// /// - public int[] VertexIndicies; + public int[] VertexIndicies { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/Overlay.cs b/SabreTools.Serialization/Models/BSP/Overlay.cs index 85e3032c..5fe3d11f 100644 --- a/SabreTools.Serialization/Models/BSP/Overlay.cs +++ b/SabreTools.Serialization/Models/BSP/Overlay.cs @@ -41,8 +41,8 @@ namespace SabreTools.Data.Models.BSP [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public Vector3D[] UVPoints = new Vector3D[4]; - public Vector3D Origin; + public Vector3D Origin = new(); - public Vector3D BasisNormal; + public Vector3D BasisNormal = new(); } } diff --git a/SabreTools.Serialization/Models/BSP/OverlaysLump.cs b/SabreTools.Serialization/Models/BSP/OverlaysLump.cs index 8274312b..d6902bc6 100644 --- a/SabreTools.Serialization/Models/BSP/OverlaysLump.cs +++ b/SabreTools.Serialization/Models/BSP/OverlaysLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Overlays /// - public Overlay[] Overlays { get; set; } + public Overlay[] Overlays { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/PakfileLump.cs b/SabreTools.Serialization/Models/BSP/PakfileLump.cs index d7c9f36d..06ebb6ac 100644 --- a/SabreTools.Serialization/Models/BSP/PakfileLump.cs +++ b/SabreTools.Serialization/Models/BSP/PakfileLump.cs @@ -38,6 +38,6 @@ namespace SabreTools.Data.Models.BSP /// Pakfile data /// /// TODO: Split and/or decompress data? - public byte[] Data; + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/PhysCollideLump.cs b/SabreTools.Serialization/Models/BSP/PhysCollideLump.cs index b3ba97ad..813c2b84 100644 --- a/SabreTools.Serialization/Models/BSP/PhysCollideLump.cs +++ b/SabreTools.Serialization/Models/BSP/PhysCollideLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Models /// - public PhysModel[] Models { get; set; } + public PhysModel[] Models { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/PhysModel.cs b/SabreTools.Serialization/Models/BSP/PhysModel.cs index 1f7238a2..55e1b090 100644 --- a/SabreTools.Serialization/Models/BSP/PhysModel.cs +++ b/SabreTools.Serialization/Models/BSP/PhysModel.cs @@ -32,11 +32,11 @@ namespace SabreTools.Data.Models.BSP /// /// Collision data of length /// - public PhysSolid[] Solids; + public PhysSolid[] Solids = []; /// /// Key data of size /// - public byte[] TextData; + public byte[] TextData = []; } } diff --git a/SabreTools.Serialization/Models/BSP/PhysSolid.cs b/SabreTools.Serialization/Models/BSP/PhysSolid.cs index b0ba6ec4..1c374d76 100644 --- a/SabreTools.Serialization/Models/BSP/PhysSolid.cs +++ b/SabreTools.Serialization/Models/BSP/PhysSolid.cs @@ -20,6 +20,6 @@ namespace SabreTools.Data.Models.BSP /// /// Collision data of length /// - public byte[] CollisionData; + public byte[] CollisionData = []; } } diff --git a/SabreTools.Serialization/Models/BSP/Plane.cs b/SabreTools.Serialization/Models/BSP/Plane.cs index 9fb94663..78703a4d 100644 --- a/SabreTools.Serialization/Models/BSP/Plane.cs +++ b/SabreTools.Serialization/Models/BSP/Plane.cs @@ -25,7 +25,7 @@ namespace SabreTools.Data.Models.BSP /// /// The planes normal vector /// - public Vector3D NormalVector; + public Vector3D NormalVector = new(); /// /// Plane equation is: vNormal * X = fDist diff --git a/SabreTools.Serialization/Models/BSP/PlanesLump.cs b/SabreTools.Serialization/Models/BSP/PlanesLump.cs index ff0eb4a7..6ba13315 100644 --- a/SabreTools.Serialization/Models/BSP/PlanesLump.cs +++ b/SabreTools.Serialization/Models/BSP/PlanesLump.cs @@ -7,6 +7,6 @@ namespace SabreTools.Data.Models.BSP /// /// Planes /// - public Plane[] Planes { get; set; } + public Plane[] Planes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/StaticPropDictLump.cs b/SabreTools.Serialization/Models/BSP/StaticPropDictLump.cs index 606deb95..0fa347e9 100644 --- a/SabreTools.Serialization/Models/BSP/StaticPropDictLump.cs +++ b/SabreTools.Serialization/Models/BSP/StaticPropDictLump.cs @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.BSP /// Model name /// /// [dictEntries][128] - public char[][] Name; + public char[][] Name = []; } } diff --git a/SabreTools.Serialization/Models/BSP/StaticPropLeafLump.cs b/SabreTools.Serialization/Models/BSP/StaticPropLeafLump.cs index 4f94776d..3512d415 100644 --- a/SabreTools.Serialization/Models/BSP/StaticPropLeafLump.cs +++ b/SabreTools.Serialization/Models/BSP/StaticPropLeafLump.cs @@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.BSP /// /// /// - public ushort[] Leaf; + public ushort[] Leaf = []; } } diff --git a/SabreTools.Serialization/Models/BSP/SurfedgesLump.cs b/SabreTools.Serialization/Models/BSP/SurfedgesLump.cs index 78624400..86b94eba 100644 --- a/SabreTools.Serialization/Models/BSP/SurfedgesLump.cs +++ b/SabreTools.Serialization/Models/BSP/SurfedgesLump.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.BSP /// /// Surfedges /// - public int[] Surfedges { get; set; } + public int[] Surfedges { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/Texdata.cs b/SabreTools.Serialization/Models/BSP/Texdata.cs index 320c5b45..44498960 100644 --- a/SabreTools.Serialization/Models/BSP/Texdata.cs +++ b/SabreTools.Serialization/Models/BSP/Texdata.cs @@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.BSP /// /// RGB reflectivity /// - public Vector3D Reflectivity; + public Vector3D Reflectivity = new(); /// /// Index into TexdataStringTable diff --git a/SabreTools.Serialization/Models/BSP/TexdataLump.cs b/SabreTools.Serialization/Models/BSP/TexdataLump.cs index 724135d2..fdae3287 100644 --- a/SabreTools.Serialization/Models/BSP/TexdataLump.cs +++ b/SabreTools.Serialization/Models/BSP/TexdataLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Texdatas /// - public Texdata[] Texdatas { get; set; } + public Texdata[] Texdatas { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/TexdataStringData.cs b/SabreTools.Serialization/Models/BSP/TexdataStringData.cs index beab755e..595098f6 100644 --- a/SabreTools.Serialization/Models/BSP/TexdataStringData.cs +++ b/SabreTools.Serialization/Models/BSP/TexdataStringData.cs @@ -10,6 +10,6 @@ namespace SabreTools.Data.Models.BSP /// /// Strings /// - public string[] Strings { get; set; } + public string[] Strings { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/TexdataStringTable.cs b/SabreTools.Serialization/Models/BSP/TexdataStringTable.cs index 70e8a781..9cc5031c 100644 --- a/SabreTools.Serialization/Models/BSP/TexdataStringTable.cs +++ b/SabreTools.Serialization/Models/BSP/TexdataStringTable.cs @@ -10,6 +10,6 @@ namespace SabreTools.Data.Models.BSP /// /// Offsets /// - public int[] Offsets { get; set; } + public int[] Offsets { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/TextureHeader.cs b/SabreTools.Serialization/Models/BSP/TextureHeader.cs index c571ed86..f4b39269 100644 --- a/SabreTools.Serialization/Models/BSP/TextureHeader.cs +++ b/SabreTools.Serialization/Models/BSP/TextureHeader.cs @@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.BSP /// Offsets /// /// entries - public int[] Offsets { get; set; } + public int[] Offsets { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/TextureLump.cs b/SabreTools.Serialization/Models/BSP/TextureLump.cs index bb350d95..931afb50 100644 --- a/SabreTools.Serialization/Models/BSP/TextureLump.cs +++ b/SabreTools.Serialization/Models/BSP/TextureLump.cs @@ -6,11 +6,11 @@ namespace SabreTools.Data.Models.BSP /// /// Texture header data /// - public TextureHeader Header { get; set; } + public TextureHeader Header { get; set; } = new(); /// /// Textures /// - public MipTexture[] Textures { get; set; } + public MipTexture[] Textures { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VbspFacesLump.cs b/SabreTools.Serialization/Models/BSP/VbspFacesLump.cs index 896a99e5..73bf1f21 100644 --- a/SabreTools.Serialization/Models/BSP/VbspFacesLump.cs +++ b/SabreTools.Serialization/Models/BSP/VbspFacesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Faces /// - public VbspFace[] Faces { get; set; } + public VbspFace[] Faces { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VbspFile.cs b/SabreTools.Serialization/Models/BSP/VbspFile.cs index bbb7cd50..beb70bdc 100644 --- a/SabreTools.Serialization/Models/BSP/VbspFile.cs +++ b/SabreTools.Serialization/Models/BSP/VbspFile.cs @@ -10,109 +10,109 @@ namespace SabreTools.Data.Models.BSP /// /// Header data /// - public VbspHeader Header { get; set; } + public VbspHeader Header { get; set; } = new(); #region Lumps /// /// LUMP_ENTITIES [0] /// - public EntitiesLump Entities { get; set; } + public EntitiesLump Entities { get; set; } = new(); /// /// LUMP_PLANES [1] /// - public PlanesLump PlanesLump { get; set; } + public PlanesLump PlanesLump { get; set; } = new(); /// /// LUMP_TEXDATA [2] /// - public TexdataLump TexdataLump { get; set; } + public TexdataLump TexdataLump { get; set; } = new(); /// /// LUMP_VERTEXES [3] /// - public VerticesLump VerticesLump { get; set; } + public VerticesLump VerticesLump { get; set; } = new(); /// /// LUMP_VISIBILITY [4] /// - public VisibilityLump VisibilityLump { get; set; } + public VisibilityLump VisibilityLump { get; set; } = new(); /// /// LUMP_NODES [5] /// - public VbspNodesLump NodesLump { get; set; } + public VbspNodesLump NodesLump { get; set; } = new(); /// /// LUMP_TEXINFO [6] /// - public VbspTexinfoLump TexinfoLump { get; set; } + public VbspTexinfoLump TexinfoLump { get; set; } = new(); /// /// LUMP_FACES [7] /// - public VbspFacesLump FacesLump { get; set; } + public VbspFacesLump FacesLump { get; set; } = new(); /// /// LUMP_LIGHTING [8] /// - public LightmapLump LightmapLump { get; set; } + public LightmapLump LightmapLump { get; set; } = new(); /// /// LUMP_OCCLUSION [9] /// s - public OcclusionLump OcclusionLump { get; set; } + public OcclusionLump OcclusionLump { get; set; } = new(); /// /// LUMP_LEAVES [10] /// - public VbspLeavesLump LeavesLump { get; set; } + public VbspLeavesLump LeavesLump { get; set; } = new(); /// /// LUMP_FACEIDS [11] /// - public MarksurfacesLump MarksurfacesLump { get; set; } + public MarksurfacesLump MarksurfacesLump { get; set; } = new(); /// /// LUMP_EDGES [12] /// - public EdgesLump EdgesLump { get; set; } + public EdgesLump EdgesLump { get; set; } = new(); /// /// LUMP_SURFEDGES [13] /// - public SurfedgesLump SurfedgesLump { get; set; } + public SurfedgesLump SurfedgesLump { get; set; } = new(); /// /// LUMP_MODELS [14] /// - public VbspModelsLump ModelsLump { get; set; } + public VbspModelsLump ModelsLump { get; set; } = new(); /// /// LUMP_WORLDLIGHTS [15] /// - public WorldLightsLump LDRWorldLightsLump { get; set; } + public WorldLightsLump LDRWorldLightsLump { get; set; } = new(); /// /// LUMP_LEAFFACES [16] /// - public LeafFacesLump LeafFacesLump { get; set; } + public LeafFacesLump LeafFacesLump { get; set; } = new(); /// /// LUMP_LEAFBRUSHES [17] /// - public LeafBrushesLump LeafBrushesLump { get; set; } + public LeafBrushesLump LeafBrushesLump { get; set; } = new(); /// /// LUMP_BRUSHES [18] /// - public BrushesLump BrushesLump { get; set; } + public BrushesLump BrushesLump { get; set; } = new(); /// /// LUMP_BRUSHSIDES [19] /// - public BrushsidesLump BrushsidesLump { get; set; } + public BrushsidesLump BrushsidesLump { get; set; } = new(); /// /// LUMP_AREAS [20] @@ -153,12 +153,12 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_DISPINFO [26] /// - public DispInfosLump DispInfosLump { get; set; } + public DispInfosLump DispInfosLump { get; set; } = new(); /// /// LUMP_ORIGINALFACES [27] /// - public VbspFacesLump OriginalFacesLump { get; set; } + public VbspFacesLump OriginalFacesLump { get; set; } = new(); /// /// LUMP_PHYSDISP [28] @@ -169,7 +169,7 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_PHYSCOLLIDE [29] /// - public PhysCollideLump PhysCollideLump { get; set; } + public PhysCollideLump PhysCollideLump { get; set; } = new(); /// /// LUMP_VERTNORMALS [30] @@ -192,7 +192,7 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_DISP_VERTS [33] /// - public DispVertsLump DispVertsLump { get; set; } + public DispVertsLump DispVertsLump { get; set; } = new(); /// /// LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS [34] @@ -203,7 +203,7 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_GAME_LUMP [35] /// - public GameLump GameLump { get; set; } + public GameLump GameLump { get; set; } = new(); /// /// LUMP_LEAFWATERDATA [36] @@ -232,7 +232,7 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_PAKFILE [40] /// - public PakfileLump PakfileLump { get; set; } + public PakfileLump PakfileLump { get; set; } = new(); /// /// LUMP_CLIPPORTALVERTS [41] @@ -243,22 +243,22 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_CUBEMAPS [42] /// - public CubemapsLump CubemapsLump { get; set; } + public CubemapsLump CubemapsLump { get; set; } = new(); /// /// LUMP_TEXDATA_STRING_DATA [43] /// - public TexdataStringData? TexdataStringData { get; set; } + public TexdataStringData TexdataStringData { get; set; } = new(); /// /// LUMP_TEXDATA_STRING_TABLE [44] /// - public TexdataStringTable? TexdataStringTable { get; set; } + public TexdataStringTable TexdataStringTable { get; set; } = new(); /// /// LUMP_OVERLAYS [45] /// - public OverlaysLump OverlaysLump { get; set; } + public OverlaysLump OverlaysLump { get; set; } = new(); /// /// LUMP_LEAFMINDISTTOWATER [46] @@ -275,7 +275,7 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_DISP_TRIS [48] /// - public DispTrisLump DispTrisLump { get; set; } + public DispTrisLump DispTrisLump { get; set; } = new(); /// /// LUMP_PHYSCOLLIDESURFACE / LUMP_PROP_BLOB [49] @@ -292,12 +292,12 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_LIGHTMAPPAGES / LUMP_LEAF_AMBIENT_INDEX_HDR [51] /// - public AmbientIndexLump HDRAmbientIndexLump { get; set; } + public AmbientIndexLump HDRAmbientIndexLump { get; set; } = new(); /// /// LUMP_LIGHTMAPPAGEINFOS / LUMP_LEAF_AMBIENT_INDEX [52] /// - public AmbientIndexLump LDRAmbientIndexLump { get; set; } + public AmbientIndexLump LDRAmbientIndexLump { get; set; } = new(); /// /// LUMP_LIGHTING_HDR [53] @@ -308,17 +308,17 @@ namespace SabreTools.Data.Models.BSP /// /// LUMP_WORLDLIGHTS_HDR [54] /// - public WorldLightsLump HDRWorldLightsLump { get; set; } + public WorldLightsLump HDRWorldLightsLump { get; set; } = new(); /// /// LUMP_LEAF_AMBIENT_LIGHTING_HDR [55] /// - public AmbientLightingLump HDRAmbientLightingLump { get; set; } + public AmbientLightingLump HDRAmbientLightingLump { get; set; } = new(); /// /// LUMP_LEAF_AMBIENT_LIGHTING [56] /// - public AmbientLightingLump LDRAmbientLightingLump { get; set; } + public AmbientLightingLump LDRAmbientLightingLump { get; set; } = new(); /// /// LUMP_XZIPPAKFILE [57] diff --git a/SabreTools.Serialization/Models/BSP/VbspHeader.cs b/SabreTools.Serialization/Models/BSP/VbspHeader.cs index 7a3d7e1e..b4cc8112 100644 --- a/SabreTools.Serialization/Models/BSP/VbspHeader.cs +++ b/SabreTools.Serialization/Models/BSP/VbspHeader.cs @@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.BSP /// BSP file signature /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// BSP file version diff --git a/SabreTools.Serialization/Models/BSP/VbspLeaf.cs b/SabreTools.Serialization/Models/BSP/VbspLeaf.cs index 4004cf3a..78e333e1 100644 --- a/SabreTools.Serialization/Models/BSP/VbspLeaf.cs +++ b/SabreTools.Serialization/Models/BSP/VbspLeaf.cs @@ -83,7 +83,7 @@ namespace SabreTools.Data.Models.BSP /// /// Precaculated light info for entities. /// - public CompressedLightCube AmbientLighting; + public CompressedLightCube AmbientLighting = new(); #endregion diff --git a/SabreTools.Serialization/Models/BSP/VbspLeavesLump.cs b/SabreTools.Serialization/Models/BSP/VbspLeavesLump.cs index 56752e9d..928bf307 100644 --- a/SabreTools.Serialization/Models/BSP/VbspLeavesLump.cs +++ b/SabreTools.Serialization/Models/BSP/VbspLeavesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Leaves /// - public VbspLeaf[] Leaves { get; set; } + public VbspLeaf[] Leaves { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VbspModel.cs b/SabreTools.Serialization/Models/BSP/VbspModel.cs index 2f38ccad..f6d3cd78 100644 --- a/SabreTools.Serialization/Models/BSP/VbspModel.cs +++ b/SabreTools.Serialization/Models/BSP/VbspModel.cs @@ -15,17 +15,17 @@ namespace SabreTools.Data.Models.BSP /// /// Bounding box /// - public Vector3D Mins; + public Vector3D Mins = new(); /// /// Bounding box /// - public Vector3D Maxs; + public Vector3D Maxs = new(); /// /// For sounds or lights /// - public Vector3D OriginVector; + public Vector3D OriginVector = new(); /// /// Index into nodes diff --git a/SabreTools.Serialization/Models/BSP/VbspModelsLump.cs b/SabreTools.Serialization/Models/BSP/VbspModelsLump.cs index 9a3fa034..8f0c8bd1 100644 --- a/SabreTools.Serialization/Models/BSP/VbspModelsLump.cs +++ b/SabreTools.Serialization/Models/BSP/VbspModelsLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Model /// - public VbspModel[] Models { get; set; } + public VbspModel[] Models { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VbspNodesLump.cs b/SabreTools.Serialization/Models/BSP/VbspNodesLump.cs index e07a6360..ef182e24 100644 --- a/SabreTools.Serialization/Models/BSP/VbspNodesLump.cs +++ b/SabreTools.Serialization/Models/BSP/VbspNodesLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Nodes /// - public VbspNode[] Nodes { get; set; } + public VbspNode[] Nodes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VbspTexinfo.cs b/SabreTools.Serialization/Models/BSP/VbspTexinfo.cs index 1ce0a6ec..e1680fb3 100644 --- a/SabreTools.Serialization/Models/BSP/VbspTexinfo.cs +++ b/SabreTools.Serialization/Models/BSP/VbspTexinfo.cs @@ -22,7 +22,7 @@ namespace SabreTools.Data.Models.BSP /// /// Texture S-vector /// - public Vector3D TextureSVector; + public Vector3D TextureSVector = new(); /// /// Texture shift in the S direction @@ -32,7 +32,7 @@ namespace SabreTools.Data.Models.BSP /// /// Texture T-vector /// - public Vector3D TextureTVector; + public Vector3D TextureTVector = new(); /// /// Texture shift in the T direction @@ -42,7 +42,7 @@ namespace SabreTools.Data.Models.BSP /// /// Lightmap S-vector /// - public Vector3D LightmapSVector; + public Vector3D LightmapSVector = new(); /// /// Lightmap shift in the S direction @@ -52,7 +52,7 @@ namespace SabreTools.Data.Models.BSP /// /// Lightmap T-vector /// - public Vector3D LightmapTVector; + public Vector3D LightmapTVector = new(); /// /// Lightmap shift in the T direction diff --git a/SabreTools.Serialization/Models/BSP/VbspTexinfoLump.cs b/SabreTools.Serialization/Models/BSP/VbspTexinfoLump.cs index 243f6854..c9a34ad3 100644 --- a/SabreTools.Serialization/Models/BSP/VbspTexinfoLump.cs +++ b/SabreTools.Serialization/Models/BSP/VbspTexinfoLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// Texinfos /// - public VbspTexinfo[] Texinfos { get; set; } + public VbspTexinfo[] Texinfos { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VerticesLump.cs b/SabreTools.Serialization/Models/BSP/VerticesLump.cs index f0e69f07..aef7d5c9 100644 --- a/SabreTools.Serialization/Models/BSP/VerticesLump.cs +++ b/SabreTools.Serialization/Models/BSP/VerticesLump.cs @@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.BSP /// /// Vertices /// - public Vector3D[] Vertices { get; set; } + public Vector3D[] Vertices { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/VisibilityLump.cs b/SabreTools.Serialization/Models/BSP/VisibilityLump.cs index cd95f15f..dbc96716 100644 --- a/SabreTools.Serialization/Models/BSP/VisibilityLump.cs +++ b/SabreTools.Serialization/Models/BSP/VisibilityLump.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.BSP public int NumClusters { get; set; } /// [numclusters][2] - public int[][] ByteOffsets { get; set; } + public int[][] ByteOffsets { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BSP/WorldLight.cs b/SabreTools.Serialization/Models/BSP/WorldLight.cs index 96ced2c4..941086cb 100644 --- a/SabreTools.Serialization/Models/BSP/WorldLight.cs +++ b/SabreTools.Serialization/Models/BSP/WorldLight.cs @@ -14,14 +14,14 @@ namespace SabreTools.Data.Models.BSP [StructLayout(LayoutKind.Sequential)] public sealed class WorldLight { - public Vector3D Origin; + public Vector3D Origin = new(); - public Vector3D Intensity; + public Vector3D Intensity = new(); /// /// For surfaces and spotlights /// - public Vector3D Normal; + public Vector3D Normal = new(); public int Cluster; diff --git a/SabreTools.Serialization/Models/BSP/WorldLightsLump.cs b/SabreTools.Serialization/Models/BSP/WorldLightsLump.cs index 7d85d8f2..7cc9ec4a 100644 --- a/SabreTools.Serialization/Models/BSP/WorldLightsLump.cs +++ b/SabreTools.Serialization/Models/BSP/WorldLightsLump.cs @@ -6,6 +6,6 @@ namespace SabreTools.Data.Models.BSP /// /// WorldLights /// - public WorldLight[] WorldLights { get; set; } + public WorldLight[] WorldLights { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/BZip2/Archive.cs b/SabreTools.Serialization/Models/BZip2/Archive.cs index a949d9cc..492d901b 100644 --- a/SabreTools.Serialization/Models/BZip2/Archive.cs +++ b/SabreTools.Serialization/Models/BZip2/Archive.cs @@ -6,13 +6,13 @@ namespace SabreTools.Data.Models.BZip2 /// /// Stream header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); // TODO: Implement remaining structures /// /// Stream footer /// - public Footer Footer { get; set; } + public Footer Footer { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/BZip2/Block.cs b/SabreTools.Serialization/Models/BZip2/Block.cs index 13fab1ec..4ed023f8 100644 --- a/SabreTools.Serialization/Models/BZip2/Block.cs +++ b/SabreTools.Serialization/Models/BZip2/Block.cs @@ -5,7 +5,7 @@ namespace SabreTools.Data.Models.BZip2 /// /// Block header /// - public BlockHeader Header { get; set; } + public BlockHeader Header { get; set; } = new(); // TODO: Implement remaining structures } diff --git a/SabreTools.Serialization/Models/BZip2/Header.cs b/SabreTools.Serialization/Models/BZip2/Header.cs index 5e5ef70a..849e8a56 100644 --- a/SabreTools.Serialization/Models/BZip2/Header.cs +++ b/SabreTools.Serialization/Models/BZip2/Header.cs @@ -5,7 +5,7 @@ namespace SabreTools.Data.Models.BZip2 /// /// "BZ" /// - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// /// Version byte diff --git a/SabreTools.Serialization/Models/CFB/Binary.cs b/SabreTools.Serialization/Models/CFB/Binary.cs index d9e922f9..cafb82e2 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; } = new(); /// /// The FAT is the main allocator for space within a compound file. @@ -25,7 +25,7 @@ namespace SabreTools.Data.Models.CFB /// /// 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. @@ -38,7 +38,7 @@ namespace SabreTools.Data.Models.CFB /// /// 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. @@ -55,7 +55,7 @@ namespace SabreTools.Data.Models.CFB /// 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 @@ -87,6 +87,6 @@ namespace SabreTools.Data.Models.CFB /// 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; } = []; } } diff --git a/SabreTools.Serialization/Models/CFB/DirectoryEntry.cs b/SabreTools.Serialization/Models/CFB/DirectoryEntry.cs index 537a6c5f..7c975df6 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 = string.Empty; /// /// This field MUST match the length of the Directory Entry Name Unicode diff --git a/SabreTools.Serialization/Models/CFB/SummaryInformation.cs b/SabreTools.Serialization/Models/CFB/SummaryInformation.cs index d0e03536..2252179c 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 97125977..3a6df2bf 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; } = new(); } } diff --git a/SabreTools.Serialization/Models/CHD/Header.cs b/SabreTools.Serialization/Models/CHD/Header.cs index 5e653f91..d19e7230 100644 --- a/SabreTools.Serialization/Models/CHD/Header.cs +++ b/SabreTools.Serialization/Models/CHD/Header.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.CHD /// 'MComprHD' /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string Tag; + public string Tag = string.Empty; /// /// Length of header (including tag and length fields) diff --git a/SabreTools.Serialization/Models/CHD/HeaderV5.cs b/SabreTools.Serialization/Models/CHD/HeaderV5.cs index bc9e02c8..469e5c78 100644 --- a/SabreTools.Serialization/Models/CHD/HeaderV5.cs +++ b/SabreTools.Serialization/Models/CHD/HeaderV5.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.CHD /// Which custom compressors are used? /// /// There should be 4 entries - public CodecType[] Compressors { get; set; } + public CodecType[] Compressors { get; set; } = []; /// /// Logical size of the data (in bytes) diff --git a/SabreTools.Serialization/Models/COFF/SectionHeader.cs b/SabreTools.Serialization/Models/COFF/SectionHeader.cs index 554a3f38..340b774b 100644 --- a/SabreTools.Serialization/Models/COFF/SectionHeader.cs +++ b/SabreTools.Serialization/Models/COFF/SectionHeader.cs @@ -101,11 +101,11 @@ /// /// COFF Relocations (Object Only) /// - public Relocation[] COFFRelocations { get; set; } + public Relocation[] COFFRelocations { get; set; } = []; /// /// COFF Line Numbers (Deprecated) /// - public LineNumber[] COFFLineNumbers { get; set; } + public LineNumber[] COFFLineNumbers { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/COFF/StringTable.cs b/SabreTools.Serialization/Models/COFF/StringTable.cs index 9f5c34a2..bedc7a4d 100644 --- a/SabreTools.Serialization/Models/COFF/StringTable.cs +++ b/SabreTools.Serialization/Models/COFF/StringTable.cs @@ -20,6 +20,6 @@ /// Following the size are null-terminated strings that are pointed to by symbols /// in the COFF symbol table. /// - public string[] Strings { get; set; } + public string[] Strings { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/CueSheets/CueFile.cs b/SabreTools.Serialization/Models/CueSheets/CueFile.cs index 6130de0f..c421e9d4 100644 --- a/SabreTools.Serialization/Models/CueSheets/CueFile.cs +++ b/SabreTools.Serialization/Models/CueSheets/CueFile.cs @@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.CueSheets /// /// filename /// - public string? FileName { get; set; } + public string FileName { get; set; } = string.Empty; /// /// filetype @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.CueSheets /// /// List of TRACK in FILE /// - public CueTrack[] Tracks { get; set; } + public CueTrack[] Tracks { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/CueSheets/CueSheet.cs b/SabreTools.Serialization/Models/CueSheets/CueSheet.cs index fb288b0d..eb008c79 100644 --- a/SabreTools.Serialization/Models/CueSheets/CueSheet.cs +++ b/SabreTools.Serialization/Models/CueSheets/CueSheet.cs @@ -36,6 +36,6 @@ namespace SabreTools.Data.Models.CueSheets /// /// List of FILE in cuesheet /// - public CueFile[] Files { get; set; } + public CueFile[] Files { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/CueSheets/CueTrack.cs b/SabreTools.Serialization/Models/CueSheets/CueTrack.cs index e449f34c..9d11101a 100644 --- a/SabreTools.Serialization/Models/CueSheets/CueTrack.cs +++ b/SabreTools.Serialization/Models/CueSheets/CueTrack.cs @@ -53,7 +53,7 @@ namespace SabreTools.Data.Models.CueSheets /// List of INDEX in TRACK /// /// Must start with 0 or 1 and then sequential - public CueIndex[] Indices { get; set; } + public CueIndex[] Indices { get; set; } = []; /// /// POSTGAP diff --git a/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTable.cs b/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTable.cs index 38eab771..49698ed0 100644 --- a/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTable.cs +++ b/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTable.cs @@ -22,11 +22,11 @@ namespace SabreTools.Data.Models.DVD /// Offset to VTS_ATRT n /// /// NumberOfTitleSets entries - public uint[] Offsets { get; set; } + public uint[] Offsets { get; set; } = []; /// /// Entries /// - public AudioSubPictureAttributesTableEntry[] Entries { get; set; } + public AudioSubPictureAttributesTableEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTableEntry.cs b/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTableEntry.cs index b71124f9..b4d6c44c 100644 --- a/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTableEntry.cs +++ b/SabreTools.Serialization/Models/DVD/AudioSubPictureAttributesTableEntry.cs @@ -18,6 +18,6 @@ namespace SabreTools.Data.Models.DVD /// Copy of VTS attributes (offset 100 and on from the VTS IFO /// file, usually 0x300 bytes long) /// - public byte[] AttributesCopy { get; set; } + public byte[] AttributesCopy { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/CellAddressTable.cs b/SabreTools.Serialization/Models/DVD/CellAddressTable.cs index 262e520b..b97a07f9 100644 --- a/SabreTools.Serialization/Models/DVD/CellAddressTable.cs +++ b/SabreTools.Serialization/Models/DVD/CellAddressTable.cs @@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.DVD /// 12-byte entries /// /// NumberOfVOBIDs entries - public CellAddressTableEntry[] Entries { get; set; } + public CellAddressTableEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/LanguageUnitTable.cs b/SabreTools.Serialization/Models/DVD/LanguageUnitTable.cs index 9f9d003a..7d46f865 100644 --- a/SabreTools.Serialization/Models/DVD/LanguageUnitTable.cs +++ b/SabreTools.Serialization/Models/DVD/LanguageUnitTable.cs @@ -23,12 +23,12 @@ namespace SabreTools.Data.Models.DVD /// Language Units /// /// NumberOfVOBIDs entries - public LanguageUnitTableEntry[] Entries { get; set; } + public LanguageUnitTableEntry[] Entries { get; set; } = []; /// /// Program Chains /// /// NumberOfVOBIDs entries - public ProgramChainTable[] ProgramChains { get; set; } + public ProgramChainTable[] ProgramChains { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/ParentalManagementMasksTable.cs b/SabreTools.Serialization/Models/DVD/ParentalManagementMasksTable.cs index ce26b23f..a151b891 100644 --- a/SabreTools.Serialization/Models/DVD/ParentalManagementMasksTable.cs +++ b/SabreTools.Serialization/Models/DVD/ParentalManagementMasksTable.cs @@ -25,13 +25,13 @@ namespace SabreTools.Data.Models.DVD /// /// Entries /// - public ParentalManagementMasksTableEntry[] Entries { get; set; } + public ParentalManagementMasksTableEntry[] Entries { get; set; } = []; /// /// The PTL_MAIT contains the 16-bit masks for the VMG and /// all title sets for parental management level 8 followed /// by the masks for level 7, and so on to level 1. /// - public byte[][] BitMasks { get; set; } + public byte[][] BitMasks { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/ProgramChainTable.cs b/SabreTools.Serialization/Models/DVD/ProgramChainTable.cs index 61608186..068400a0 100644 --- a/SabreTools.Serialization/Models/DVD/ProgramChainTable.cs +++ b/SabreTools.Serialization/Models/DVD/ProgramChainTable.cs @@ -23,6 +23,6 @@ namespace SabreTools.Data.Models.DVD /// Program Chains /// /// NumberOfProgramChains entries - public ProgramChainTableEntry[] Entries { get; set; } + public ProgramChainTableEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/TitlesTable.cs b/SabreTools.Serialization/Models/DVD/TitlesTable.cs index 39dde91b..138cb766 100644 --- a/SabreTools.Serialization/Models/DVD/TitlesTable.cs +++ b/SabreTools.Serialization/Models/DVD/TitlesTable.cs @@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.DVD /// 12-byte entries /// /// NumberOfTitles entries - public TitlesTableEntry[] Entries { get; set; } + public TitlesTableEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/VOBUAddressMap.cs b/SabreTools.Serialization/Models/DVD/VOBUAddressMap.cs index cd2ed7d8..9c256f76 100644 --- a/SabreTools.Serialization/Models/DVD/VOBUAddressMap.cs +++ b/SabreTools.Serialization/Models/DVD/VOBUAddressMap.cs @@ -11,6 +11,6 @@ namespace SabreTools.Data.Models.DVD /// /// Starting sector within VOB of nth VOBU /// - public uint[] StartingSectors { get; set; } + public uint[] StartingSectors { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/DVD/VideoManagerIFO.cs b/SabreTools.Serialization/Models/DVD/VideoManagerIFO.cs index a79219a6..7b0a3276 100644 --- a/SabreTools.Serialization/Models/DVD/VideoManagerIFO.cs +++ b/SabreTools.Serialization/Models/DVD/VideoManagerIFO.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.DVD /// "DVDVIDEO-VMG" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] - public string Signature; + public string Signature = string.Empty; /// /// Last sector of VMG set (last sector of BUP) diff --git a/SabreTools.Serialization/Models/DVD/VideoTitleSetIFO.cs b/SabreTools.Serialization/Models/DVD/VideoTitleSetIFO.cs index 55379f49..af270a9f 100644 --- a/SabreTools.Serialization/Models/DVD/VideoTitleSetIFO.cs +++ b/SabreTools.Serialization/Models/DVD/VideoTitleSetIFO.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.DVD /// "DVDVIDEO-VTS" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] - public string Signature; + public string Signature = string.Empty; /// /// Last sector of title set (last sector of BUP) diff --git a/SabreTools.Serialization/Models/Delphi/PackageInfoTable.cs b/SabreTools.Serialization/Models/Delphi/PackageInfoTable.cs index 3c53a5bd..2124739d 100644 --- a/SabreTools.Serialization/Models/Delphi/PackageInfoTable.cs +++ b/SabreTools.Serialization/Models/Delphi/PackageInfoTable.cs @@ -7,8 +7,8 @@ namespace SabreTools.Data.Models.Delphi { public int UnitCount { get; set; } - public PackageUnitEntry[] UnitInfo { get; set; } + public PackageUnitEntry[] UnitInfo { get; set; } = []; - public PackageTypeInfo TypeInfo { get; set; } + public PackageTypeInfo TypeInfo { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/Delphi/PackageTypeInfo.cs b/SabreTools.Serialization/Models/Delphi/PackageTypeInfo.cs index a2e2a865..8e32c6ab 100644 --- a/SabreTools.Serialization/Models/Delphi/PackageTypeInfo.cs +++ b/SabreTools.Serialization/Models/Delphi/PackageTypeInfo.cs @@ -10,10 +10,10 @@ namespace SabreTools.Data.Models.Delphi /// /// System-dependent pointer type, assumed to be encoded for x86 /// - public uint[] TypeTable { get; set; } + public uint[] TypeTable { get; set; } = []; public int UnitCount { get; set; } - public string[] UnitNames { get; set; } + public string[] UnitNames { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/GCF/File.cs b/SabreTools.Serialization/Models/GCF/File.cs index 6af3069a..9fee5f2b 100644 --- a/SabreTools.Serialization/Models/GCF/File.cs +++ b/SabreTools.Serialization/Models/GCF/File.cs @@ -11,108 +11,108 @@ namespace SabreTools.Data.Models.GCF /// /// Header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Block entry header data /// - public BlockEntryHeader BlockEntryHeader { get; set; } + public BlockEntryHeader BlockEntryHeader { get; set; } = new(); /// /// Block entries data /// - public BlockEntry[] BlockEntries { get; set; } + public BlockEntry[] BlockEntries { get; set; } = []; /// /// Fragmentation map header data /// - public FragmentationMapHeader FragmentationMapHeader { get; set; } + public FragmentationMapHeader FragmentationMapHeader { get; set; } = new(); /// /// Fragmentation map data /// - public FragmentationMap[] FragmentationMaps { get; set; } + public FragmentationMap[] FragmentationMaps { get; set; } = []; /// /// Block entry map header data /// /// Part of version 5 but not version 6. - public BlockEntryMapHeader BlockEntryMapHeader { get; set; } + public BlockEntryMapHeader BlockEntryMapHeader { get; set; } = new(); /// /// Block entry map data /// /// Part of version 5 but not version 6. - public BlockEntryMap[] BlockEntryMaps { get; set; } + public BlockEntryMap[] BlockEntryMaps { get; set; } = []; /// /// Directory header data /// - public DirectoryHeader DirectoryHeader { get; set; } + public DirectoryHeader DirectoryHeader { get; set; } = new(); /// /// Directory entries data /// - public DirectoryEntry[] DirectoryEntries { get; set; } + public DirectoryEntry[] DirectoryEntries { get; set; } = []; /// /// Directory names data /// - public Dictionary DirectoryNames { get; set; } + public Dictionary DirectoryNames { get; set; } = []; /// /// Directory info 1 entries data /// - public DirectoryInfo1Entry[] DirectoryInfo1Entries { get; set; } + public DirectoryInfo1Entry[] DirectoryInfo1Entries { get; set; } = []; /// /// Directory info 2 entries data /// - public DirectoryInfo2Entry[] DirectoryInfo2Entries { get; set; } + public DirectoryInfo2Entry[] DirectoryInfo2Entries { get; set; } = []; /// /// Directory copy entries data /// - public DirectoryCopyEntry[] DirectoryCopyEntries { get; set; } + public DirectoryCopyEntry[] DirectoryCopyEntries { get; set; } = []; /// /// Directory local entries data /// - public DirectoryLocalEntry[] DirectoryLocalEntries { get; set; } + public DirectoryLocalEntry[] DirectoryLocalEntries { get; set; } = []; /// /// Directory map header data /// - public DirectoryMapHeader DirectoryMapHeader { get; set; } + public DirectoryMapHeader DirectoryMapHeader { get; set; } = new(); /// /// Directory map entries data /// - public DirectoryMapEntry[] DirectoryMapEntries { get; set; } + public DirectoryMapEntry[] DirectoryMapEntries { get; set; } = []; /// /// Checksum header data /// - public ChecksumHeader ChecksumHeader { get; set; } + public ChecksumHeader ChecksumHeader { get; set; } = new(); /// /// Checksum map header data /// - public ChecksumMapHeader ChecksumMapHeader { get; set; } + public ChecksumMapHeader ChecksumMapHeader { get; set; } = new(); /// /// Checksum map entries data /// - public ChecksumMapEntry[] ChecksumMapEntries { get; set; } + public ChecksumMapEntry[] ChecksumMapEntries { get; set; } = []; /// /// Checksum entries data /// - public ChecksumEntry[] ChecksumEntries { get; set; } + public ChecksumEntry[] ChecksumEntries { get; set; } = []; /// /// Data block header data /// - public DataBlockHeader DataBlockHeader { get; set; } + public DataBlockHeader DataBlockHeader { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/GZIP/Archive.cs b/SabreTools.Serialization/Models/GZIP/Archive.cs index 8c994ce9..e4895f40 100644 --- a/SabreTools.Serialization/Models/GZIP/Archive.cs +++ b/SabreTools.Serialization/Models/GZIP/Archive.cs @@ -6,13 +6,13 @@ namespace SabreTools.Data.Models.GZIP /// /// Header including optional fields /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); // Compressed blocks live here /// /// Trailer /// - public Trailer Trailer { get; set; } + public Trailer Trailer { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/GZIP/ExtraFieldData.cs b/SabreTools.Serialization/Models/GZIP/ExtraFieldData.cs index 09024683..aff4bbde 100644 --- a/SabreTools.Serialization/Models/GZIP/ExtraFieldData.cs +++ b/SabreTools.Serialization/Models/GZIP/ExtraFieldData.cs @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.GZIP /// public ushort Length { get; set; } - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/GZIP/Header.cs b/SabreTools.Serialization/Models/GZIP/Header.cs index 83fdfa11..e7dee40c 100644 --- a/SabreTools.Serialization/Models/GZIP/Header.cs +++ b/SabreTools.Serialization/Models/GZIP/Header.cs @@ -67,7 +67,7 @@ namespace SabreTools.Data.Models.GZIP /// series of subfields, each of the form . /// /// This is the raw version of - public byte[] ExtraFieldBytes { get; set; } + public byte[] ExtraFieldBytes { get; set; } = []; /// /// Extra field diff --git a/SabreTools.Serialization/Models/IRD/File.cs b/SabreTools.Serialization/Models/IRD/File.cs index ec7dd3aa..7e50ea2f 100644 --- a/SabreTools.Serialization/Models/IRD/File.cs +++ b/SabreTools.Serialization/Models/IRD/File.cs @@ -19,7 +19,7 @@ namespace SabreTools.Data.Models.IRD /// The same value stored in PARAM.SFO / TITLE_ID /// /// 9 bytes, ASCII, stored without dashes - public string TitleID { get; set; } + public string TitleID { get; set; } = string.Empty; /// /// Number of bytes that follow containing the title @@ -30,25 +30,25 @@ namespace SabreTools.Data.Models.IRD /// The same value stored in PARAM.SFO / TITLE /// /// bytes, ASCII - public string Title { get; set; } + public string Title { get; set; } = string.Empty; /// /// The same value stored in PARAM.SFO / PS3_SYSTEM_VER /// /// 4 bytes, ASCII, missing uses "0000" - public string SystemVersion { get; set; } + public string SystemVersion { get; set; } = string.Empty; /// /// The same value stored in PARAM.SFO / VERSION /// /// 5 bytes, ASCII - public string GameVersion { get; set; } + public string GameVersion { get; set; } = string.Empty; /// /// The same value stored in PARAM.SFO / APP_VER /// /// 5 bytes, ASCII - public string AppVersion { get; set; } + public string AppVersion { get; set; } = string.Empty; /// /// Length of the gzip-compressed header data @@ -58,7 +58,7 @@ namespace SabreTools.Data.Models.IRD /// /// Gzip-compressed header data /// - public byte[] Header { get; set; } + public byte[] Header { get; set; } = []; /// /// Length of the gzip-compressed footer data @@ -68,7 +68,7 @@ namespace SabreTools.Data.Models.IRD /// /// Gzip-compressed footer data /// - public byte[] Footer { get; set; } + public byte[] Footer { get; set; } = []; /// /// Number of complete regions in the image @@ -79,7 +79,7 @@ namespace SabreTools.Data.Models.IRD /// MD5 hashes for all complete regions in the image /// /// regions, 16-bytes per hash - public byte[][] RegionHashes { get; set; } + public byte[][] RegionHashes { get; set; } = []; /// /// Number of decrypted files in the image @@ -90,13 +90,13 @@ namespace SabreTools.Data.Models.IRD /// Starting sector for each decrypted file /// /// files, alternating with each entry - public ulong[] FileKeys { get; set; } + public ulong[] FileKeys { get; set; } = []; /// /// MD5 hashes for all decrypted files in the image /// /// files, 16-bytes per hash, alternating with each entry - public byte[][] FileHashes { get; set; } + public byte[][] FileHashes { get; set; } = []; /// /// Extra Config, usually 0x0000 diff --git a/SabreTools.Serialization/Models/ISO9660/BaseVolumeDescriptor.cs b/SabreTools.Serialization/Models/ISO9660/BaseVolumeDescriptor.cs index 3b5623af..f567ab74 100644 --- a/SabreTools.Serialization/Models/ISO9660/BaseVolumeDescriptor.cs +++ b/SabreTools.Serialization/Models/ISO9660/BaseVolumeDescriptor.cs @@ -36,7 +36,7 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Number of logical blocks in this volume /// - public BothInt32 VolumeSpaceSize { get; set; } + public BothInt32 VolumeSpaceSize { get; set; } = 0; // Virtual variable of 32 bytes goes here: // PrimaryVolumeDescriptor: Unused32Bytes @@ -45,23 +45,23 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Number of Volumes (discs) in this VolumeSet /// - public BothInt16 VolumeSetSize { get; set; } + public BothInt16 VolumeSetSize { get; set; } = 0; /// /// Volume (disc) number in this volume set /// - public BothInt16 VolumeSequenceNumber { get; set; } + public BothInt16 VolumeSequenceNumber { get; set; } = 0; /// /// Number of bytes per logical block, usually 2048 /// Must be a power of 2, minimum 2^9, and not greater than the logical sector size /// - public BothInt16 LogicalBlockSize { get; set; } + public BothInt16 LogicalBlockSize { get; set; } = 0; /// /// Number of bytes in the path table /// - public BothInt32 PathTableSize { get; set; } + public BothInt32 PathTableSize { get; set; } = 0; /// /// Sector number of the start of the little-endian path table, type L @@ -93,7 +93,7 @@ namespace SabreTools.Data.Models.ISO9660 /// Root directory entry, 34 bytes /// DirectoryIdentifier = 0x00 /// - public DirectoryRecord RootDirectoryRecord { get; set; } + public DirectoryRecord RootDirectoryRecord { get; set; } = new(); /// /// 128-byte name of the volume set @@ -167,22 +167,22 @@ namespace SabreTools.Data.Models.ISO9660 /// /// PVD-style DateTime format for the Creation date/time of the Volume /// - public DecDateTime VolumeCreationDateTime { get; set; } + public DecDateTime VolumeCreationDateTime { get; set; } = new(); /// /// PVD-style DateTime format for the Modification date/time of the Volume /// - public DecDateTime VolumeModificationDateTime { get; set; } + public DecDateTime VolumeModificationDateTime { get; set; } = new(); /// /// PVD-style DateTime format for the Expiration date/time of the Volume /// - public DecDateTime VolumeExpirationDateTime { get; set; } + public DecDateTime VolumeExpirationDateTime { get; set; } = new(); /// /// PVD-style DateTime format for the Effective date/time of the Volume /// - public DecDateTime VolumeEffectiveDateTime { get; set; } + public DecDateTime VolumeEffectiveDateTime { get; set; } = new(); /// /// Version number of the Records / Path Table format diff --git a/SabreTools.Serialization/Models/ISO9660/DirectoryExtent.cs b/SabreTools.Serialization/Models/ISO9660/DirectoryExtent.cs index fedbb1ec..c4621a2f 100644 --- a/SabreTools.Serialization/Models/ISO9660/DirectoryExtent.cs +++ b/SabreTools.Serialization/Models/ISO9660/DirectoryExtent.cs @@ -9,6 +9,6 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Directory records (each a descriptor of a directory or a file) /// - public DirectoryRecord[] DirectoryRecords { get; set; } + public DirectoryRecord[] DirectoryRecords { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/ISO9660/DirectoryRecord.cs b/SabreTools.Serialization/Models/ISO9660/DirectoryRecord.cs index c1de7bf3..b35c3dc3 100644 --- a/SabreTools.Serialization/Models/ISO9660/DirectoryRecord.cs +++ b/SabreTools.Serialization/Models/ISO9660/DirectoryRecord.cs @@ -22,18 +22,18 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Logical block number of the first logical block allocated to this extent /// - public BothInt32 ExtentLocation { get; set; } + public BothInt32 ExtentLocation { get; set; } = 0; /// /// Number of bytes allocated to this extent /// - public BothInt32 ExtentLength { get; set; } + public BothInt32 ExtentLength { get; set; } = 0; /// /// Datetime of recording for the Directory Record /// If not specified, all values are 0x00 /// - public DirectoryRecordDateTime RecordingDateTime { get; set; } + public DirectoryRecordDateTime RecordingDateTime { get; set; } = new(); /// /// Flags for indicating attributes of the directory record @@ -55,7 +55,7 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Volume sequence ordinal number of the volume in the volume set on which the record extent is recorded /// - public BothInt16 VolumeSequenceNumber { get; set; } + public BothInt16 VolumeSequenceNumber { get; set; } = 0; /// /// Length of the FileIdentifier field in bytes @@ -69,7 +69,7 @@ namespace SabreTools.Data.Models.ISO9660 /// Directory: Uses either d-characters or d1-characters, or: /// Is exactly Constants.CurrentDirectory (0x00) or Constants.ParentDirectory (0x01) /// - public byte[] FileIdentifier { get; set; } + public byte[] FileIdentifier { get; set; } = []; /// /// If record length prior to this is odd, the FileIdentifier is followed by a single padding byte (0x00) @@ -83,6 +83,6 @@ namespace SabreTools.Data.Models.ISO9660 /// Note: This is where SUSP contents are located, including Rock Ridge extension /// Optional field /// - public byte[] SystemUse { get; set; } + public byte[] SystemUse { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/ISO9660/ExtendedAttributeRecord.cs b/SabreTools.Serialization/Models/ISO9660/ExtendedAttributeRecord.cs index 8d232306..2abcbb02 100644 --- a/SabreTools.Serialization/Models/ISO9660/ExtendedAttributeRecord.cs +++ b/SabreTools.Serialization/Models/ISO9660/ExtendedAttributeRecord.cs @@ -12,13 +12,13 @@ namespace SabreTools.Data.Models.ISO9660 /// Owner ID number for this file /// 0x0000 if no owner, implies 0x0000 Group ID /// - public BothInt16 OwnerIdentification { get; set; } + public BothInt16 OwnerIdentification { get; set; } = 0; /// /// Group ID number for the owner of this file /// 0x0000 if no group, implies 0x0000 Owner ID /// - public BothInt16 GroupIdentification { get; set; } + public BothInt16 GroupIdentification { get; set; } = 0; /// /// 16-bit flag variable with 8 flags where every other bit is set to 1 @@ -29,22 +29,22 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Datetime of when the file content was created /// - public DecDateTime FileCreationDateTime { get; set; } + public DecDateTime FileCreationDateTime { get; set; } = new(); /// /// Datetime of when the file content was last modified /// - public DecDateTime FileModificationDateTime { get; set; } + public DecDateTime FileModificationDateTime { get; set; } = new(); /// /// Datetime of when the file content expires /// - public DecDateTime FileExpirationDateTime { get; set; } + public DecDateTime FileExpirationDateTime { get; set; } = new(); /// /// Datetime of when the file content is effective from /// - public DecDateTime FileEffectiveDateTime { get; set; } + public DecDateTime FileEffectiveDateTime { get; set; } = new(); /// /// Record format type @@ -63,7 +63,7 @@ namespace SabreTools.Data.Models.ISO9660 /// If RecordType is 1, this field is length in bytes /// If RecordType is 2 or 3, this field is maximum length in bytes of a record in the file /// - public BothInt16 RecordLength { get; set; } + public BothInt16 RecordLength { get; set; } = 0; /// /// 32-byte name of the intended system @@ -95,17 +95,17 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Length of the Application use field /// - public BothInt16 ApplicationLength { get; set; } + public BothInt16 ApplicationLength { get; set; } = 0; /// /// ApplicationLength-bytes for application use /// - public byte[] ApplicationUse { get; set; } + public byte[] ApplicationUse { get; set; } = []; /// /// EscapeSequencesLength-bytes list of escape sequences to interpret this file /// Optional, and if present, padded to the right with 0x00 /// - public byte[] EscapeSequences { get; set; } + public byte[] EscapeSequences { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/ISO9660/FileExtent.cs b/SabreTools.Serialization/Models/ISO9660/FileExtent.cs index a128c204..e67cb89f 100644 --- a/SabreTools.Serialization/Models/ISO9660/FileExtent.cs +++ b/SabreTools.Serialization/Models/ISO9660/FileExtent.cs @@ -15,6 +15,6 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Byte array of data within the file extent (after the Extended Attribyte Record) /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/ISO9660/FileSystem.cs b/SabreTools.Serialization/Models/ISO9660/FileSystem.cs index 05b74bd4..572045e4 100644 --- a/SabreTools.Serialization/Models/ISO9660/FileSystem.cs +++ b/SabreTools.Serialization/Models/ISO9660/FileSystem.cs @@ -10,6 +10,6 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Set of volumes (disc images) that make up an ISO9660 file system /// - public Volume[] VolumeSet { get; set; } + public Volume[] VolumeSet { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/ISO9660/PathTableRecord.cs b/SabreTools.Serialization/Models/ISO9660/PathTableRecord.cs index 639c938c..b7792cf0 100644 --- a/SabreTools.Serialization/Models/ISO9660/PathTableRecord.cs +++ b/SabreTools.Serialization/Models/ISO9660/PathTableRecord.cs @@ -31,7 +31,7 @@ namespace SabreTools.Data.Models.ISO9660 /// Directory name /// Either d-characters or d1-characters, or a single 0x00 byte /// - public byte[] DirectoryIdentifier { get; set; } + public byte[] DirectoryIdentifier { get; set; } = []; /// /// If DirectoryIdentifierLength is odd, the DirectoryIdentifier is followed by a single padding byte (0x00) diff --git a/SabreTools.Serialization/Models/ISO9660/Volume.cs b/SabreTools.Serialization/Models/ISO9660/Volume.cs index 666456c7..50b504cc 100644 --- a/SabreTools.Serialization/Models/ISO9660/Volume.cs +++ b/SabreTools.Serialization/Models/ISO9660/Volume.cs @@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.ISO9660 /// 32,768 bytes, assuming logical block size of 2048 bytes /// ISO9660 does not specify the content of the System Area /// - public byte[] SystemArea { get; set; } + public byte[] SystemArea { get; set; } = []; #region Data Area @@ -30,21 +30,21 @@ namespace SabreTools.Data.Models.ISO9660 /// - Zero or more Boot Volume Descriptors (Type = 0) /// - At least one Volume Descriptor Set Terminator (Type = 255), as the final element(s) in the set /// - public VolumeDescriptor[] VolumeDescriptorSet { get; set; } + public VolumeDescriptor[] VolumeDescriptorSet { get; set; } = []; /// /// List of path table records for each directory on the volume /// One (or two) Path Table Groups is provided for each Base Volume Descriptor /// Note: If a Base Volume Descriptor's Path Table Size field is ambiguous, two Path Table Groups may be given /// - public PathTableGroup[] PathTableGroups { get; set; } + public PathTableGroup[] PathTableGroups { get; set; } = []; /// /// Map of sector numbers and the directory at that sector number /// Each Directory contains child directory and file descriptors /// Note: FileExtent is the base class for DirectoryExtent /// - public Dictionary DirectoryDescriptors { get; set; } + public Dictionary DirectoryDescriptors { get; set; } = []; #endregion } diff --git a/SabreTools.Serialization/Models/ISO9660/VolumePartitionDescriptor.cs b/SabreTools.Serialization/Models/ISO9660/VolumePartitionDescriptor.cs index 4b7b8e03..61438b08 100644 --- a/SabreTools.Serialization/Models/ISO9660/VolumePartitionDescriptor.cs +++ b/SabreTools.Serialization/Models/ISO9660/VolumePartitionDescriptor.cs @@ -29,12 +29,12 @@ namespace SabreTools.Data.Models.ISO9660 /// /// Logical block number of the first logical block allocated to this volume partition /// - public BothInt32 VolumePartitionLocation { get; set; } + public BothInt32 VolumePartitionLocation { get; set; } = 0; /// /// Number of logical blocks allocated to this volume partition /// - public BothInt32 VolumePartitionSize { get; set; } + public BothInt32 VolumePartitionSize { get; set; } = 0; /// /// 1960 bytes for System Use, contents not defined by ISO9660 diff --git a/SabreTools.Serialization/Models/InstallShieldArchiveV3/Archive.cs b/SabreTools.Serialization/Models/InstallShieldArchiveV3/Archive.cs index 862ecb1c..394f9636 100644 --- a/SabreTools.Serialization/Models/InstallShieldArchiveV3/Archive.cs +++ b/SabreTools.Serialization/Models/InstallShieldArchiveV3/Archive.cs @@ -6,16 +6,16 @@ /// /// Archive header information /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Directories found in the archive /// - public Directory[] Directories { get; set; } + public Directory[] Directories { get; set; } = []; /// /// Files found in the archive /// - public File[] Files { get; set; } + public File[] Files { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/InstallShieldArchiveV3/Directory.cs b/SabreTools.Serialization/Models/InstallShieldArchiveV3/Directory.cs index 53359fbc..79dcf67f 100644 --- a/SabreTools.Serialization/Models/InstallShieldArchiveV3/Directory.cs +++ b/SabreTools.Serialization/Models/InstallShieldArchiveV3/Directory.cs @@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.InstallShieldArchiveV3 /// /// Name as an ASCII string /// - public string Name; + public string Name = string.Empty; } } diff --git a/SabreTools.Serialization/Models/InstallShieldArchiveV3/File.cs b/SabreTools.Serialization/Models/InstallShieldArchiveV3/File.cs index 61b8bfd3..0c2c33fa 100644 --- a/SabreTools.Serialization/Models/InstallShieldArchiveV3/File.cs +++ b/SabreTools.Serialization/Models/InstallShieldArchiveV3/File.cs @@ -33,6 +33,6 @@ namespace SabreTools.Data.Models.InstallShieldArchiveV3 public byte VolumeStart; [MarshalAs(UnmanagedType.AnsiBStr)] - public string Name; + public string Name = string.Empty; } } diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/Cabinet.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/Cabinet.cs index 1bcec4bf..78114925 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/Cabinet.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/Cabinet.cs @@ -11,17 +11,17 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// Common header /// - public CommonHeader CommonHeader { get; set; } + public CommonHeader CommonHeader { get; set; } = new(); /// /// Volume header /// - public VolumeHeader VolumeHeader { get; set; } + public VolumeHeader VolumeHeader { get; set; } = new(); /// /// Descriptor /// - public Descriptor Descriptor { get; set; } + public Descriptor Descriptor { get; set; } = new(); #endregion @@ -30,17 +30,17 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// Offsets to all file descriptors /// - public uint[] FileDescriptorOffsets { get; set; } + public uint[] FileDescriptorOffsets { get; set; } = []; /// /// Directory names /// - public string[] DirectoryNames { get; set; } + public string[] DirectoryNames { get; set; } = []; /// /// Standard file descriptors /// - public FileDescriptor[] FileDescriptors { get; set; } + public FileDescriptor[] FileDescriptors { get; set; } = []; #endregion @@ -49,12 +49,12 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// File group offset to offset list mapping /// - public Dictionary FileGroupOffsets { get; set; } + public Dictionary FileGroupOffsets { get; set; } = []; /// /// File groups /// - public FileGroup[] FileGroups { get; set; } + public FileGroup[] FileGroups { get; set; } = []; #endregion @@ -63,12 +63,12 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// Component offset to offset list mapping /// - public Dictionary ComponentOffsets { get; set; } + public Dictionary ComponentOffsets { get; set; } = []; /// /// Components /// - public Component[] Components { get; set; } + public Component[] Components { get; set; } = []; #endregion } diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/CommonHeader.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/CommonHeader.cs index e7fdc373..7c412d4a 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/CommonHeader.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/CommonHeader.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// "ISc(" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Encoded version diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/Component.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/Component.cs index e7cee4b9..098538a4 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/Component.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/Component.cs @@ -13,7 +13,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// Component identifier /// - public string Identifier { get; set; } + public string Identifier { get; set; } = string.Empty; /// /// Offset to the component descriptor @@ -28,7 +28,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// Display name /// - public string DisplayName { get; set; } + public string DisplayName { get; set; } = string.Empty; /// /// Component status @@ -58,7 +58,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// Component name /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Offset to the CD-ROM folder @@ -100,7 +100,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// Reserved /// /// 2 bytes (<= v5), 1 byte (> v5) - public byte[] Reserved3 { get; set; } + public byte[] Reserved3 { get; set; } = []; /// /// Number of depends(?) @@ -125,7 +125,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// File group names /// - public string[] FileGroupNames { get; set; } + public string[] FileGroupNames { get; set; } = []; /// /// Number of X3(?) diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/Descriptor.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/Descriptor.cs index a76cf98f..f5c1e203 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/Descriptor.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/Descriptor.cs @@ -95,13 +95,13 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// Offsets to the file groups /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 71)] - public uint[] FileGroupOffsets; + public uint[] FileGroupOffsets = new uint[71]; /// /// Offsets to the components /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 71)] - public uint[] ComponentOffsets; + public uint[] ComponentOffsets = new uint[71]; /// /// Offset to the setup types diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/FileDescriptor.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/FileDescriptor.cs index 80ed416f..f88df71b 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/FileDescriptor.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/FileDescriptor.cs @@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// File descriptor name /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Directory index diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/FileGroup.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/FileGroup.cs index c3d037bf..1bf59443 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/FileGroup.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/FileGroup.cs @@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet /// /// File group name /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Size of the expanded data diff --git a/SabreTools.Serialization/Models/InstallShieldCabinet/OffsetList.cs b/SabreTools.Serialization/Models/InstallShieldCabinet/OffsetList.cs index ea01e392..25d58703 100644 --- a/SabreTools.Serialization/Models/InstallShieldCabinet/OffsetList.cs +++ b/SabreTools.Serialization/Models/InstallShieldCabinet/OffsetList.cs @@ -5,7 +5,7 @@ namespace SabreTools.Data.Models.InstallShieldCabinet { public uint NameOffset { get; set; } - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public uint DescriptorOffset { get; set; } diff --git a/SabreTools.Serialization/Models/InstallShieldExecutable/FileEntry.cs b/SabreTools.Serialization/Models/InstallShieldExecutable/FileEntry.cs index 1e30f4ed..91a76988 100644 --- a/SabreTools.Serialization/Models/InstallShieldExecutable/FileEntry.cs +++ b/SabreTools.Serialization/Models/InstallShieldExecutable/FileEntry.cs @@ -6,19 +6,19 @@ namespace SabreTools.Data.Models.InstallShieldExecutable /// Name of the file /// /// May only contain ASCII (7-bit) characters - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Path of the file, seems to usually use \ filepaths /// /// May only contain ASCII (7-bit) characters - public string Path { get; set; } + public string Path { get; set; } = string.Empty; /// /// Version of the file /// /// May only contain ASCII (7-bit) characters - public string Version { get; set; } + public string Version { get; set; } = string.Empty; /// /// Length of the file. Stored in the installshield executable as a string. diff --git a/SabreTools.Serialization/Models/InstallShieldExecutable/SFX.cs b/SabreTools.Serialization/Models/InstallShieldExecutable/SFX.cs index 738ae2a0..f2c0553b 100644 --- a/SabreTools.Serialization/Models/InstallShieldExecutable/SFX.cs +++ b/SabreTools.Serialization/Models/InstallShieldExecutable/SFX.cs @@ -37,6 +37,6 @@ namespace SabreTools.Data.Models.InstallShieldExecutable /// /// Set of file entries /// - public FileEntry[] Entries { get; set; } + public FileEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/LZ/KWAJFile.cs b/SabreTools.Serialization/Models/LZ/KWAJFile.cs index 5c254729..65db0bb8 100644 --- a/SabreTools.Serialization/Models/LZ/KWAJFile.cs +++ b/SabreTools.Serialization/Models/LZ/KWAJFile.cs @@ -9,12 +9,12 @@ namespace SabreTools.Data.Models.LZ /// /// Header /// - public KWAJHeader Header { get; set; } + public KWAJHeader Header { get; set; } = new(); /// /// Optional extensions defined by /// - public KWAJHeaderExtensions HeaderExtensions { get; set; } + public KWAJHeaderExtensions? HeaderExtensions { get; set; } // Followed immediately by compressed data } diff --git a/SabreTools.Serialization/Models/LZ/QBasicFile.cs b/SabreTools.Serialization/Models/LZ/QBasicFile.cs index fab7be12..dd0aea8c 100644 --- a/SabreTools.Serialization/Models/LZ/QBasicFile.cs +++ b/SabreTools.Serialization/Models/LZ/QBasicFile.cs @@ -9,7 +9,7 @@ namespace SabreTools.Data.Models.LZ /// /// Header /// - public QBasicHeader Header { get; set; } + public QBasicHeader Header { get; set; } = new(); // Followed immediately by compressed data } diff --git a/SabreTools.Serialization/Models/LZ/SZDDFile.cs b/SabreTools.Serialization/Models/LZ/SZDDFile.cs index d39b1e3d..c15422cf 100644 --- a/SabreTools.Serialization/Models/LZ/SZDDFile.cs +++ b/SabreTools.Serialization/Models/LZ/SZDDFile.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.LZ /// /// Header /// - public SZDDHeader Header { get; set; } + public SZDDHeader Header { get; set; } = new(); // Followed immediately by compressed data } diff --git a/SabreTools.Serialization/Models/LinearExecutable/DebugInformation.cs b/SabreTools.Serialization/Models/LinearExecutable/DebugInformation.cs index d970f79f..e372283a 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/DebugInformation.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/DebugInformation.cs @@ -30,6 +30,6 @@ /// the responsibility of the linker or debugging tools to follow the convention /// for the type field that is defined here. /// - public byte[] DebuggerData { get; set; } + public byte[] DebuggerData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/LinearExecutable/EntryTableBundle.cs b/SabreTools.Serialization/Models/LinearExecutable/EntryTableBundle.cs index 38ee412c..4895f755 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/EntryTableBundle.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/EntryTableBundle.cs @@ -51,6 +51,6 @@ /// /// Table entries in the bundle /// - public EntryTableEntry[] TableEntries { get; set; } + public EntryTableEntry[] TableEntries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/LinearExecutable/Executable.cs b/SabreTools.Serialization/Models/LinearExecutable/Executable.cs index c2c35aa3..8d6904d8 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/Executable.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/Executable.cs @@ -13,39 +13,39 @@ namespace SabreTools.Data.Models.LinearExecutable /// /// MS-DOS executable stub /// - public MSDOS.Executable Stub { get; set; } + public MSDOS.Executable Stub { get; set; } = new(); /// /// Information block /// - public InformationBlock InformationBlock { get; set; } + public InformationBlock InformationBlock { get; set; } = new(); /// /// Object table /// - public ObjectTableEntry[] ObjectTable { get; set; } + public ObjectTableEntry[] ObjectTable { get; set; } = []; /// /// Object page map /// - public ObjectPageMapEntry[] ObjectPageMap { get; set; } + public ObjectPageMapEntry[] ObjectPageMap { get; set; } = []; // TODO: Object iterate data map table (Undefined) /// /// Resource table /// - public ResourceTableEntry[] ResourceTable { get; set; } + public ResourceTableEntry[] ResourceTable { get; set; } = []; /// /// Resident Name table /// - public ResidentNamesTableEntry[] ResidentNamesTable { get; set; } + public ResidentNamesTableEntry[] ResidentNamesTable { get; set; } = []; /// /// Entry table /// - public EntryTableBundle[] EntryTable { get; set; } + public EntryTableBundle[] EntryTable { get; set; } = []; /// /// Module format directives table (optional) @@ -60,32 +60,32 @@ namespace SabreTools.Data.Models.LinearExecutable /// /// Fix-up page table /// - public FixupPageTableEntry[] FixupPageTable { get; set; } + public FixupPageTableEntry[] FixupPageTable { get; set; } = []; /// /// Fix-up record table /// - public FixupRecordTableEntry[] FixupRecordTable { get; set; } + public FixupRecordTableEntry[] FixupRecordTable { get; set; } = []; /// /// Import module name table /// - public ImportModuleNameTableEntry[] ImportModuleNameTable { get; set; } + public ImportModuleNameTableEntry[] ImportModuleNameTable { get; set; } = []; /// /// Import procedure name table /// - public ImportModuleProcedureNameTableEntry[] ImportModuleProcedureNameTable { get; set; } + public ImportModuleProcedureNameTableEntry[] ImportModuleProcedureNameTable { get; set; } = []; /// /// Per-Page checksum table /// - public PerPageChecksumTableEntry[] PerPageChecksumTable { get; set; } + public PerPageChecksumTableEntry[] PerPageChecksumTable { get; set; } = []; /// /// Non-Resident Name table /// - public NonResidentNamesTableEntry[] NonResidentNamesTable { get; set; } + public NonResidentNamesTableEntry[] NonResidentNamesTable { get; set; } = []; // TODO: Non-resident directives data (Undefined) diff --git a/SabreTools.Serialization/Models/LinearExecutable/ImportModuleNameTableEntry.cs b/SabreTools.Serialization/Models/LinearExecutable/ImportModuleNameTableEntry.cs index 37c7b91b..e04c2bc2 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/ImportModuleNameTableEntry.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/ImportModuleNameTableEntry.cs @@ -33,6 +33,6 @@ /// This is a variable length string with it's length defined in bytes by /// the LEN field. The string is case sensitive and is not null terminated. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/LinearExecutable/ImportProcedureNameTableEntry.cs b/SabreTools.Serialization/Models/LinearExecutable/ImportProcedureNameTableEntry.cs index 4c5083cd..f6447cac 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/ImportProcedureNameTableEntry.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/ImportProcedureNameTableEntry.cs @@ -41,6 +41,6 @@ /// This is a variable length string with it's length defined in bytes by /// the LEN field. The string is case sensitive and is not null terminated. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/LinearExecutable/InformationBlock.cs b/SabreTools.Serialization/Models/LinearExecutable/InformationBlock.cs index f23302df..64930451 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/InformationBlock.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/InformationBlock.cs @@ -25,7 +25,7 @@ namespace SabreTools.Data.Models.LinearExecutable /// file as a valid 32-bit Linear Executable Module Format. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] - public string Signature; + public string Signature = string.Empty; /// /// Byte Ordering. diff --git a/SabreTools.Serialization/Models/LinearExecutable/NonResidentNamesTableEntry.cs b/SabreTools.Serialization/Models/LinearExecutable/NonResidentNamesTableEntry.cs index 1d9c5fac..5ac0c203 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/NonResidentNamesTableEntry.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/NonResidentNamesTableEntry.cs @@ -51,7 +51,7 @@ namespace SabreTools.Data.Models.LinearExecutable /// This is a variable length string with it's length defined in bytes by the LEN field. /// The string is case case sensitive and is not null terminated. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Ordinal number. diff --git a/SabreTools.Serialization/Models/LinearExecutable/ResidentNamesTableEntry.cs b/SabreTools.Serialization/Models/LinearExecutable/ResidentNamesTableEntry.cs index b9f88b1c..eb411515 100644 --- a/SabreTools.Serialization/Models/LinearExecutable/ResidentNamesTableEntry.cs +++ b/SabreTools.Serialization/Models/LinearExecutable/ResidentNamesTableEntry.cs @@ -48,7 +48,7 @@ /// This is a variable length string with it's length defined in bytes by the LEN field. /// The string is case case sensitive and is not null terminated. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Ordinal number. diff --git a/SabreTools.Serialization/Models/MSDOS/Executable.cs b/SabreTools.Serialization/Models/MSDOS/Executable.cs index d573fa75..fd3ac01d 100644 --- a/SabreTools.Serialization/Models/MSDOS/Executable.cs +++ b/SabreTools.Serialization/Models/MSDOS/Executable.cs @@ -14,7 +14,7 @@ namespace SabreTools.Data.Models.MSDOS /// /// MS-DOS executable header /// - public ExecutableHeader Header { get; set; } + public ExecutableHeader Header { get; set; } = new(); /// /// After loading the executable into memory, the program loader goes through @@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.MSDOS /// make the loader add start segment address to the value at offset /// 1*0x10+0x1A=0x2A within the program data. /// - public RelocationEntry[] RelocationTable { get; set; } + public RelocationEntry[] RelocationTable { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/MSDOS/ExecutableHeader.cs b/SabreTools.Serialization/Models/MSDOS/ExecutableHeader.cs index 8f3a3ef4..e5693f4f 100644 --- a/SabreTools.Serialization/Models/MSDOS/ExecutableHeader.cs +++ b/SabreTools.Serialization/Models/MSDOS/ExecutableHeader.cs @@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.MSDOS /// /// 15 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] - public string Magic; + public string Magic = string.Empty; /// /// Number of bytes in the last page. diff --git a/SabreTools.Serialization/Models/MicrosoftCabinet/CFDATA.cs b/SabreTools.Serialization/Models/MicrosoftCabinet/CFDATA.cs index b77a7049..666e9f39 100644 --- a/SabreTools.Serialization/Models/MicrosoftCabinet/CFDATA.cs +++ b/SabreTools.Serialization/Models/MicrosoftCabinet/CFDATA.cs @@ -34,7 +34,7 @@ /// and the field value is non-zero, this field contains per-datablock application information. /// This field is defined by the application, and it is used for application-defined purposes. /// - public byte[] ReservedData { get; set; } + public byte[] ReservedData { get; set; } = []; /// /// The compressed data bytes, compressed by using the @@ -44,6 +44,6 @@ /// uncompressed data bytes. In this case, the and field values will be equal unless /// this CFDATA structure entry crosses a cabinet file boundary. /// - public byte[] CompressedData { get; set; } + public byte[] CompressedData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/MicrosoftCabinet/CFFILE.cs b/SabreTools.Serialization/Models/MicrosoftCabinet/CFFILE.cs index fd0a413e..c91566f7 100644 --- a/SabreTools.Serialization/Models/MicrosoftCabinet/CFFILE.cs +++ b/SabreTools.Serialization/Models/MicrosoftCabinet/CFFILE.cs @@ -60,6 +60,6 @@ /// CFFILE.szName field, but the _A_NAME_IS_UTF attribute is not set, the characters SHOULD be /// interpreted according to the current location. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/MicrosoftCabinet/CFFOLDER.cs b/SabreTools.Serialization/Models/MicrosoftCabinet/CFFOLDER.cs index 905ad70f..78d6b643 100644 --- a/SabreTools.Serialization/Models/MicrosoftCabinet/CFFOLDER.cs +++ b/SabreTools.Serialization/Models/MicrosoftCabinet/CFFOLDER.cs @@ -46,11 +46,11 @@ /// and the cbCFFolder field is non-zero, then this field contains per-folder application information. /// This field is defined by the application, and is used for application-defined purposes. /// - public byte[] ReservedData { get; set; } + public byte[]? ReservedData { get; set; } /// /// Data blocks associated with this folder /// - public CFDATA[] DataBlocks { get; set; } + public CFDATA[] DataBlocks { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/MicrosoftCabinet/CFHEADER.cs b/SabreTools.Serialization/Models/MicrosoftCabinet/CFHEADER.cs index e333b3ee..a7186516 100644 --- a/SabreTools.Serialization/Models/MicrosoftCabinet/CFHEADER.cs +++ b/SabreTools.Serialization/Models/MicrosoftCabinet/CFHEADER.cs @@ -11,7 +11,7 @@ /// Contains the characters "M", "S", "C", and "F" (bytes 0x4D, 0x53, 0x43, /// 0x46). This field is used to ensure that the file is a cabinet (.cab) file. /// - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// /// Reserved field; MUST be set to 0 (zero). @@ -107,7 +107,7 @@ /// cbCFHeader field is non-zero, this field contains per-cabinet-file application information. This field /// is defined by the application, and is used for application-defined purposes. /// - public byte[] ReservedData { get; set; } + public byte[]? ReservedData { get; set; } /// /// If the flags.cfhdrPREV_CABINET field is not set, this diff --git a/SabreTools.Serialization/Models/MicrosoftCabinet/Cabinet.cs b/SabreTools.Serialization/Models/MicrosoftCabinet/Cabinet.cs index 25d79641..414e7335 100644 --- a/SabreTools.Serialization/Models/MicrosoftCabinet/Cabinet.cs +++ b/SabreTools.Serialization/Models/MicrosoftCabinet/Cabinet.cs @@ -12,16 +12,16 @@ /// /// Cabinet header /// - public CFHEADER Header { get; set; } + public CFHEADER Header { get; set; } = new(); /// /// One or more CFFOLDER entries /// - public CFFOLDER[] Folders { get; set; } + public CFFOLDER[] Folders { get; set; } = []; /// /// A series of one or more cabinet file (CFFILE) entries /// - public CFFILE[] Files { get; set; } + public CFFILE[] Files { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/MoPaQ/Archive.cs b/SabreTools.Serialization/Models/MoPaQ/Archive.cs index 0fc1faba..387d00ec 100644 --- a/SabreTools.Serialization/Models/MoPaQ/Archive.cs +++ b/SabreTools.Serialization/Models/MoPaQ/Archive.cs @@ -19,7 +19,7 @@ /// /// MPQ Header (required) /// - public ArchiveHeader ArchiveHeader { get; set; } + public ArchiveHeader ArchiveHeader { get; set; } = new(); // TODO: Files (optional) // TODO: Special files (optional) diff --git a/SabreTools.Serialization/Models/MoPaQ/ArchiveHeader.cs b/SabreTools.Serialization/Models/MoPaQ/ArchiveHeader.cs index e9c8f8d9..f3483d60 100644 --- a/SabreTools.Serialization/Models/MoPaQ/ArchiveHeader.cs +++ b/SabreTools.Serialization/Models/MoPaQ/ArchiveHeader.cs @@ -11,7 +11,7 @@ /// /// The MPQ archive signature /// - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// /// Size of the archive header diff --git a/SabreTools.Serialization/Models/MoPaQ/BetTable.cs b/SabreTools.Serialization/Models/MoPaQ/BetTable.cs index 9a1e2edf..73496a9f 100644 --- a/SabreTools.Serialization/Models/MoPaQ/BetTable.cs +++ b/SabreTools.Serialization/Models/MoPaQ/BetTable.cs @@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.MoPaQ /// 'BET\x1A' /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Version. Seems to be always 1 @@ -130,7 +130,7 @@ namespace SabreTools.Data.Models.MoPaQ /// Followed by array of file flags. Each entry is 32-bit size and its meaning is the same like /// /// Size from - public uint[] FlagsArray { get; set; } + public uint[] FlagsArray { get; set; } = []; // File table. Size of each entry is taken from dwTableEntrySize. // Size of the table is (dwTableEntrySize * dwMaxFileCount), round up to 8. diff --git a/SabreTools.Serialization/Models/MoPaQ/HetTable.cs b/SabreTools.Serialization/Models/MoPaQ/HetTable.cs index 8bf80bea..49e858c7 100644 --- a/SabreTools.Serialization/Models/MoPaQ/HetTable.cs +++ b/SabreTools.Serialization/Models/MoPaQ/HetTable.cs @@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.MoPaQ /// 'HET\x1A' /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Version. Seems to be always 1 @@ -76,12 +76,12 @@ namespace SabreTools.Data.Models.MoPaQ /// HET hash table. Each entry is 8 bits. /// /// Size is derived from HashTableSize - public byte[] HashTable { get; set; } + public byte[] HashTable { get; set; } = []; /// /// Array of file indexes. Bit size of each entry is taken from dwTotalIndexSize. /// Table size is taken from dwHashTableSize. /// - public byte[][] FileIndexes { get; set; } + public byte[][] FileIndexes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/MoPaQ/PatchHeader.cs b/SabreTools.Serialization/Models/MoPaQ/PatchHeader.cs index 148da4bb..def3dcea 100644 --- a/SabreTools.Serialization/Models/MoPaQ/PatchHeader.cs +++ b/SabreTools.Serialization/Models/MoPaQ/PatchHeader.cs @@ -108,7 +108,7 @@ /// /// File data are simply replaced by the data in the patch. /// - public byte[] PatchDataCopy { get; set; } + public byte[] PatchDataCopy { get; set; } = []; #endregion } diff --git a/SabreTools.Serialization/Models/MoPaQ/PatchInfo.cs b/SabreTools.Serialization/Models/MoPaQ/PatchInfo.cs index 8fabe267..52d4d8a0 100644 --- a/SabreTools.Serialization/Models/MoPaQ/PatchInfo.cs +++ b/SabreTools.Serialization/Models/MoPaQ/PatchInfo.cs @@ -37,6 +37,6 @@ namespace SabreTools.Data.Models.MoPaQ /// 0 entries /// TODO: Determine the number of entries [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0)] - public uint[] SectorOffsetTable; + public uint[] SectorOffsetTable = []; } } diff --git a/SabreTools.Serialization/Models/MoPaQ/UserData.cs b/SabreTools.Serialization/Models/MoPaQ/UserData.cs index ea14e74a..eb71a140 100644 --- a/SabreTools.Serialization/Models/MoPaQ/UserData.cs +++ b/SabreTools.Serialization/Models/MoPaQ/UserData.cs @@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.MoPaQ /// /// 4 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Maximum size of the user data diff --git a/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs b/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs index 048d93fc..465f9e85 100644 --- a/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs +++ b/SabreTools.Serialization/Models/N3DS/ARM11KernelCapabilities.cs @@ -39,7 +39,7 @@ namespace SabreTools.Data.Models.N3DS /// TODO: Make enum for flag values /// 28 entries [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] - public uint[] Descriptors; + public uint[] Descriptors = new uint[28]; /// /// Reserved diff --git a/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs b/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs index 02931dfd..de2ba1d6 100644 --- a/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs +++ b/SabreTools.Serialization/Models/N3DS/ARM11LocalSystemCapabilities.cs @@ -49,7 +49,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Storage info /// - public StorageInfo StorageInfo; + public StorageInfo StorageInfo = new(); /// /// Service access control diff --git a/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs b/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs index a71febd8..4c14d1fb 100644 --- a/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs +++ b/SabreTools.Serialization/Models/N3DS/ARM9AccessControl.cs @@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.N3DS /// /// 15 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] - public ARM9AccessControlDescriptors[] Descriptors; + public ARM9AccessControlDescriptors[] Descriptors = new ARM9AccessControlDescriptors[15]; /// /// ARM9 Descriptor Version. Originally this value had to be ≥ 2. diff --git a/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs b/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs index 4ed43424..1fb56352 100644 --- a/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs +++ b/SabreTools.Serialization/Models/N3DS/AccessControlInfo.cs @@ -9,17 +9,17 @@ namespace SabreTools.Data.Models.N3DS /// /// ARM11 local system capabilities /// - public ARM11LocalSystemCapabilities ARM11LocalSystemCapabilities; + public ARM11LocalSystemCapabilities ARM11LocalSystemCapabilities = new(); /// /// ARM11 kernel capabilities /// - public ARM11KernelCapabilities ARM11KernelCapabilities; + public ARM11KernelCapabilities ARM11KernelCapabilities = new(); /// /// ARM9 access control /// /// TODO: Fix serialization issue with this type - public ARM9AccessControl ARM9AccessControl; + public ARM9AccessControl ARM9AccessControl = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/CIA.cs b/SabreTools.Serialization/Models/N3DS/CIA.cs index 198ace28..06c0a2d2 100644 --- a/SabreTools.Serialization/Models/N3DS/CIA.cs +++ b/SabreTools.Serialization/Models/N3DS/CIA.cs @@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.N3DS /// /// CIA header /// - public CIAHeader Header { get; set; } + public CIAHeader Header { get; set; } = new(); /// /// Certificate chain @@ -25,32 +25,32 @@ namespace SabreTools.Data.Models.N3DS /// /// https://www.3dbrew.org/wiki/CIA#Certificate_Chain /// - public Certificate[] CertificateChain { get; set; } + public Certificate[] CertificateChain { get; set; } = []; /// /// Ticket /// - public Ticket Ticket { get; set; } + public Ticket Ticket { get; set; } = new(); /// /// TMD file data /// - public TitleMetadata TMDFileData { get; set; } + public TitleMetadata TMDFileData { get; set; } = new(); /// /// Content file data /// - public NCCHHeader[] Partitions { get; set; } + public NCCHHeader[] Partitions { get; set; } = []; /// /// Content file data /// /// TODO: Parse the content file data - public byte[] ContentFileData { get; set; } + public byte[] ContentFileData { get; set; } = []; /// /// Meta file data (Not a necessary component) /// - public MetaData MetaData { get; set; } + public MetaData MetaData { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs b/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs index 337a03c0..2da6dd2a 100644 --- a/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/CardInfoHeader.cs @@ -74,6 +74,6 @@ namespace SabreTools.Data.Models.N3DS /// /// This data is returned by 16-byte cartridge command 0x82. /// - public InitialData InitialData; + public InitialData InitialData = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/Cart.cs b/SabreTools.Serialization/Models/N3DS/Cart.cs index cddbba28..a44fab26 100644 --- a/SabreTools.Serialization/Models/N3DS/Cart.cs +++ b/SabreTools.Serialization/Models/N3DS/Cart.cs @@ -8,36 +8,36 @@ namespace SabreTools.Data.Models.N3DS /// /// 3DS cart header /// - public NCSDHeader Header { get; set; } + public NCSDHeader Header { get; set; } = new(); /// /// 3DS card info header /// - public CardInfoHeader CardInfoHeader { get; set; } + public CardInfoHeader CardInfoHeader { get; set; } = new(); /// /// 3DS development card info header /// - public DevelopmentCardInfoHeader DevelopmentCardInfoHeader { get; set; } + public DevelopmentCardInfoHeader DevelopmentCardInfoHeader { get; set; } = new(); /// /// NCCH partitions /// - public NCCHHeader[] Partitions { get; set; } + public NCCHHeader[] Partitions { get; set; } = []; /// /// NCCH extended headers /// - public NCCHExtendedHeader[] ExtendedHeaders { get; set; } + public NCCHExtendedHeader[] ExtendedHeaders { get; set; } = []; /// /// ExeFS headers associated with each partition /// - public ExeFSHeader[] ExeFSHeaders { get; set; } + public ExeFSHeader[] ExeFSHeaders { get; set; } = []; /// /// RomFS headers associated with each partition /// - public RomFSHeader[] RomFSHeaders { get; set; } + public RomFSHeader[] RomFSHeaders { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/N3DS/Certificate.cs b/SabreTools.Serialization/Models/N3DS/Certificate.cs index b5168a8f..f14b25f9 100644 --- a/SabreTools.Serialization/Models/N3DS/Certificate.cs +++ b/SabreTools.Serialization/Models/N3DS/Certificate.cs @@ -27,17 +27,17 @@ namespace SabreTools.Data.Models.N3DS /// /// Signature /// - public byte[] Signature { get; set; } + public byte[] Signature { get; set; } = []; /// /// Padding to align next data to 0x40 bytes /// - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; /// /// Issuer /// - public string Issuer { get; set; } + public string Issuer { get; set; } = string.Empty; /// /// Key Type @@ -47,7 +47,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Name /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Expiration time as UNIX Timestamp, used at least for CTCert @@ -60,7 +60,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Modulus /// - public byte[] RSAModulus { get; set; } + public byte[]? RSAModulus { get; set; } /// /// Public Exponent @@ -70,7 +70,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Padding /// - public byte[] RSAPadding { get; set; } + public byte[]? RSAPadding { get; set; } #endregion @@ -80,12 +80,12 @@ namespace SabreTools.Data.Models.N3DS /// /// Public Key /// - public byte[] ECCPublicKey { get; set; } + public byte[]? ECCPublicKey { get; set; } /// /// Padding /// - public byte[] ECCPadding { get; set; } + public byte[]? ECCPadding { get; set; } #endregion } diff --git a/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs b/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs index 0d8251e9..2d7844fc 100644 --- a/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/DevelopmentCardInfoHeader.cs @@ -30,6 +30,6 @@ namespace SabreTools.Data.Models.N3DS /// /// TestData /// - public TestData TestData; + public TestData TestData = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs b/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs index 0a3e78e8..ff914a8e 100644 --- a/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/ExeFSFileHeader.cs @@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.N3DS /// /// 8 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string FileName; + public string FileName = string.Empty; /// /// File offset diff --git a/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs b/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs index 39c2922c..5b587bf3 100644 --- a/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/ExeFSHeader.cs @@ -16,7 +16,7 @@ /// /// File headers (10 headers maximum, 16 bytes each) /// - public ExeFSFileHeader[] FileHeaders { get; set; } + public ExeFSFileHeader[] FileHeaders { get; set; } = []; /// /// Reserved @@ -28,6 +28,6 @@ /// File hashes (10 hashes maximum, 32 bytes each, one for each header) /// /// SHA-256 hashes - public byte[][] FileHashes { get; set; } + public byte[][] FileHashes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/N3DS/InitialData.cs b/SabreTools.Serialization/Models/N3DS/InitialData.cs index c08778b6..3ac85bb3 100644 --- a/SabreTools.Serialization/Models/N3DS/InitialData.cs +++ b/SabreTools.Serialization/Models/N3DS/InitialData.cs @@ -44,6 +44,6 @@ namespace SabreTools.Data.Models.N3DS /// /// Copy of first NCCH header (excluding RSA signature) /// - public NCCHHeader BackupHeader; + public NCCHHeader BackupHeader = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs b/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs index bea3397b..8fb8e82d 100644 --- a/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/NCCHExtendedHeader.cs @@ -14,12 +14,12 @@ namespace SabreTools.Data.Models.N3DS /// /// SCI /// - public SystemControlInfo SCI; + public SystemControlInfo SCI = new(); /// /// ACI /// - public AccessControlInfo ACI; + public AccessControlInfo ACI = new(); /// /// AccessDesc signature (RSA-2048-SHA256) @@ -38,6 +38,6 @@ namespace SabreTools.Data.Models.N3DS /// /// ACI (for limitation of first ACI) /// - public AccessControlInfo ACIForLimitations; + public AccessControlInfo ACIForLimitations = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs b/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs index 9dd26e42..7dc3ede5 100644 --- a/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/NCCHHeader.cs @@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.N3DS /// /// 4 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string MagicID; + public string MagicID = string.Empty; /// /// Content size, in media units (1 media unit = 0x200 bytes) @@ -74,7 +74,7 @@ namespace SabreTools.Data.Models.N3DS /// /// 0x10 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)] - public string ProductCode; + public string ProductCode = string.Empty; /// /// Extended header SHA-256 hash (SHA256 of 2x Alignment Size, beginning at 0x0 of ExHeader) @@ -96,7 +96,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Flags /// - public NCCHHeaderFlags Flags; + public NCCHHeaderFlags Flags = new(); /// /// Plain region offset, in media units diff --git a/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs b/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs index cc2494e4..2f5bac24 100644 --- a/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/NCSDHeader.cs @@ -22,7 +22,7 @@ /// /// Magic Number 'NCSD' /// - public string MagicNumber { get; set; } + public string MagicNumber { get; set; } = string.Empty; /// /// Size of the NCSD image, in media units (1 media unit = 0x200 bytes) @@ -49,7 +49,7 @@ /// /// Offset & Length partition table, in media units /// - public PartitionTableEntry[] PartitionsTable { get; set; } + public PartitionTableEntry[] PartitionsTable { get; set; } = []; #endregion @@ -74,7 +74,7 @@ /// /// Partition Flags /// - public byte[] PartitionFlags { get; set; } + public byte[] PartitionFlags { get; set; } = []; /// /// Partition ID table diff --git a/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs b/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs index 816dd602..01f5ea9a 100644 --- a/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs +++ b/SabreTools.Serialization/Models/N3DS/RomFSHeader.cs @@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.N3DS /// Magic "IVFC" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string MagicString; + public string MagicString = string.Empty; /// /// Magic number 0x10000 diff --git a/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs b/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs index 81ed1ecf..b16a6856 100644 --- a/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs +++ b/SabreTools.Serialization/Models/N3DS/SystemControlInfo.cs @@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.N3DS /// /// 8 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string ApplicationTitle; + public string ApplicationTitle = string.Empty; /// /// Reserved @@ -33,7 +33,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Text code set info /// - public CodeSetInfo TextCodeSetInfo; + public CodeSetInfo TextCodeSetInfo = new(); /// /// Stack size @@ -43,7 +43,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Read-only code set info /// - public CodeSetInfo ReadOnlyCodeSetInfo; + public CodeSetInfo ReadOnlyCodeSetInfo = new(); /// /// Reserved @@ -53,7 +53,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Data code set info /// - public CodeSetInfo DataCodeSetInfo; + public CodeSetInfo DataCodeSetInfo = new(); /// /// BSS size @@ -70,6 +70,6 @@ namespace SabreTools.Data.Models.N3DS /// /// SystemInfo /// - public SystemInfo SystemInfo; + public SystemInfo SystemInfo = new(); } } diff --git a/SabreTools.Serialization/Models/N3DS/Ticket.cs b/SabreTools.Serialization/Models/N3DS/Ticket.cs index 7c0b627c..59dfb206 100644 --- a/SabreTools.Serialization/Models/N3DS/Ticket.cs +++ b/SabreTools.Serialization/Models/N3DS/Ticket.cs @@ -25,12 +25,12 @@ namespace SabreTools.Data.Models.N3DS /// /// Signature /// - public byte[] Signature { get; set; } + public byte[] Signature { get; set; } = []; /// /// Padding /// - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; /// /// Issuer @@ -160,7 +160,7 @@ namespace SabreTools.Data.Models.N3DS /// /// In demos, the first u32 in the "Limits" section is 0x4, then the second u32 is the max-playcount. /// - public uint[] Limits { get; set; } + public uint[] Limits { get; set; } = []; /// /// The Content Index of a ticket has its own size defined within itself, @@ -172,7 +172,7 @@ namespace SabreTools.Data.Models.N3DS /// /// Content Index /// - public byte[] ContentIndex { get; set; } + public byte[] ContentIndex { get; set; } = []; /// /// Certificate chain @@ -180,6 +180,6 @@ namespace SabreTools.Data.Models.N3DS /// /// https://www.3dbrew.org/wiki/Ticket#Certificate_Chain /// - public Certificate[] CertificateChain { get; set; } + public Certificate[] CertificateChain { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs b/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs index e5a5075f..d43e3795 100644 --- a/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs +++ b/SabreTools.Serialization/Models/N3DS/TitleMetadata.cs @@ -26,17 +26,17 @@ namespace SabreTools.Data.Models.N3DS /// /// Signature /// - public byte[] Signature { get; set; } + public byte[] Signature { get; set; } = []; /// /// Padding /// - public byte[] Padding1 { get; set; } + public byte[] Padding1 { get; set; } = []; /// /// Signature Issuer /// - public string Issuer { get; set; } + public string Issuer { get; set; } = string.Empty; /// /// Version @@ -140,13 +140,13 @@ namespace SabreTools.Data.Models.N3DS /// /// There are 64 of these records, usually only the first is used. /// - public ContentInfoRecord[] ContentInfoRecords { get; set; } + public ContentInfoRecord[] ContentInfoRecords { get; set; } = []; /// /// There is one of these for each content contained in this title. /// (Determined by "Content Count" in the TMD Header). /// - public ContentChunkRecord[] ContentChunkRecords { get; set; } + public ContentChunkRecord[] ContentChunkRecords { get; set; } = []; /// /// Certificate chain @@ -154,6 +154,6 @@ namespace SabreTools.Data.Models.N3DS /// /// https://www.3dbrew.org/wiki/Title_metadata#Certificate_Chain /// - public Certificate[] CertificateChain { get; set; } + public Certificate[] CertificateChain { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NCF/File.cs b/SabreTools.Serialization/Models/NCF/File.cs index 7d2f398e..396a87c0 100644 --- a/SabreTools.Serialization/Models/NCF/File.cs +++ b/SabreTools.Serialization/Models/NCF/File.cs @@ -11,71 +11,71 @@ namespace SabreTools.Data.Models.NCF /// /// Header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Directory header data /// - public DirectoryHeader DirectoryHeader { get; set; } + public DirectoryHeader DirectoryHeader { get; set; } = new(); /// /// Directory entries data /// - public DirectoryEntry[] DirectoryEntries { get; set; } + public DirectoryEntry[] DirectoryEntries { get; set; } = []; /// /// Directory names data /// - public Dictionary DirectoryNames { get; set; } + public Dictionary DirectoryNames { get; set; } = []; /// /// Directory info 1 entries data /// - public DirectoryInfo1Entry[] DirectoryInfo1Entries { get; set; } + public DirectoryInfo1Entry[] DirectoryInfo1Entries { get; set; } = []; /// /// Directory info 2 entries data /// - public DirectoryInfo2Entry[] DirectoryInfo2Entries { get; set; } + public DirectoryInfo2Entry[] DirectoryInfo2Entries { get; set; } = []; /// /// Directory copy entries data /// - public DirectoryCopyEntry[] DirectoryCopyEntries { get; set; } + public DirectoryCopyEntry[] DirectoryCopyEntries { get; set; } = []; /// /// Directory local entries data /// - public DirectoryLocalEntry[] DirectoryLocalEntries { get; set; } + public DirectoryLocalEntry[] DirectoryLocalEntries { get; set; } = []; /// /// Unknown header data /// - public UnknownHeader UnknownHeader { get; set; } + public UnknownHeader UnknownHeader { get; set; } = new(); /// /// Unknown entries data /// - public UnknownEntry[] UnknownEntries { get; set; } + public UnknownEntry[] UnknownEntries { get; set; } = []; /// /// Checksum header data /// - public ChecksumHeader ChecksumHeader { get; set; } + public ChecksumHeader ChecksumHeader { get; set; } = new(); /// /// Checksum map header data /// - public ChecksumMapHeader ChecksumMapHeader { get; set; } + public ChecksumMapHeader ChecksumMapHeader { get; set; } = new(); /// /// Checksum map entries data /// - public ChecksumMapEntry[] ChecksumMapEntries { get; set; } + public ChecksumMapEntry[] ChecksumMapEntries { get; set; } = []; /// /// Checksum entries data /// - public ChecksumEntry[] ChecksumEntries { get; set; } + public ChecksumEntry[] ChecksumEntries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/Executable.cs b/SabreTools.Serialization/Models/NewExecutable/Executable.cs index b10bad1a..99d84cba 100644 --- a/SabreTools.Serialization/Models/NewExecutable/Executable.cs +++ b/SabreTools.Serialization/Models/NewExecutable/Executable.cs @@ -17,51 +17,51 @@ namespace SabreTools.Data.Models.NewExecutable /// /// MS-DOS executable stub /// - public MSDOS.Executable Stub { get; set; } + public MSDOS.Executable Stub { get; set; } = new(); /// /// New Executable header /// - public ExecutableHeader Header { get; set; } + public ExecutableHeader Header { get; set; } = new(); /// /// Segment table /// - public SegmentTableEntry[] SegmentTable { get; set; } + public SegmentTableEntry[] SegmentTable { get; set; } = []; /// /// Resource table /// - public ResourceTable ResourceTable { get; set; } + public ResourceTable ResourceTable { get; set; } = new(); /// /// Resident-Name table /// - public ResidentNameTableEntry[] ResidentNameTable { get; set; } + public ResidentNameTableEntry[] ResidentNameTable { get; set; } = []; /// /// Module-Reference table /// - public ModuleReferenceTableEntry[] ModuleReferenceTable { get; set; } + public ModuleReferenceTableEntry[] ModuleReferenceTable { get; set; } = []; /// /// Imported-Name table /// - public Dictionary ImportedNameTable { get; set; } + public Dictionary ImportedNameTable { get; set; } = []; /// /// Entry table /// - public EntryTableBundle[] EntryTable { get; set; } + public EntryTableBundle[] EntryTable { get; set; } = []; /// /// Nonresident-Name table /// - public NonResidentNameTableEntry[] NonResidentNameTable { get; set; } + public NonResidentNameTableEntry[] NonResidentNameTable { get; set; } = []; /// /// Segment relocation data /// - public PerSegmentData[] SegmentRelocationData { get; set; } + public PerSegmentData[] SegmentRelocationData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/ExecutableHeader.cs b/SabreTools.Serialization/Models/NewExecutable/ExecutableHeader.cs index cef7d886..a4471f20 100644 --- a/SabreTools.Serialization/Models/NewExecutable/ExecutableHeader.cs +++ b/SabreTools.Serialization/Models/NewExecutable/ExecutableHeader.cs @@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.NewExecutable /// "NE" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] - public string Magic; + public string Magic = string.Empty; /// /// Version number of the linker. diff --git a/SabreTools.Serialization/Models/NewExecutable/ImportedNameTableEntry.cs b/SabreTools.Serialization/Models/NewExecutable/ImportedNameTableEntry.cs index 8a60baf6..cc352d49 100644 --- a/SabreTools.Serialization/Models/NewExecutable/ImportedNameTableEntry.cs +++ b/SabreTools.Serialization/Models/NewExecutable/ImportedNameTableEntry.cs @@ -20,6 +20,6 @@ /// /// ASCII text of the name string. /// - public byte[] NameString { get; set; } + public byte[] NameString { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/NonResidentNameTableEntry.cs b/SabreTools.Serialization/Models/NewExecutable/NonResidentNameTableEntry.cs index c1a67497..b061c9e3 100644 --- a/SabreTools.Serialization/Models/NewExecutable/NonResidentNameTableEntry.cs +++ b/SabreTools.Serialization/Models/NewExecutable/NonResidentNameTableEntry.cs @@ -20,7 +20,7 @@ /// /// ASCII text of the name string. /// - public byte[] NameString { get; set; } + public byte[] NameString { get; set; } = []; /// /// Ordinal number (index into entry table). This value is ignored diff --git a/SabreTools.Serialization/Models/NewExecutable/PerSegmentData.cs b/SabreTools.Serialization/Models/NewExecutable/PerSegmentData.cs index b938b93a..d39f2e74 100644 --- a/SabreTools.Serialization/Models/NewExecutable/PerSegmentData.cs +++ b/SabreTools.Serialization/Models/NewExecutable/PerSegmentData.cs @@ -25,6 +25,6 @@ /// /// A table of relocation records follows. /// - public RelocationRecord[] RelocationRecords { get; set; } + public RelocationRecord[] RelocationRecords { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/ResidentNameTableEntry.cs b/SabreTools.Serialization/Models/NewExecutable/ResidentNameTableEntry.cs index ba393e1b..8ee9873c 100644 --- a/SabreTools.Serialization/Models/NewExecutable/ResidentNameTableEntry.cs +++ b/SabreTools.Serialization/Models/NewExecutable/ResidentNameTableEntry.cs @@ -19,7 +19,7 @@ /// /// ASCII text of the name string. /// - public byte[] NameString { get; set; } + public byte[] NameString { get; set; } = []; /// /// Ordinal number (index into entry table). This value is ignored diff --git a/SabreTools.Serialization/Models/NewExecutable/ResourceTable.cs b/SabreTools.Serialization/Models/NewExecutable/ResourceTable.cs index 9b99bb9b..02c03074 100644 --- a/SabreTools.Serialization/Models/NewExecutable/ResourceTable.cs +++ b/SabreTools.Serialization/Models/NewExecutable/ResourceTable.cs @@ -23,12 +23,12 @@ namespace SabreTools.Data.Models.NewExecutable /// /// A table of resource type information blocks follows. /// - public ResourceTypeInformationEntry[] ResourceTypes { get; set; } + public ResourceTypeInformationEntry[] ResourceTypes { get; set; } = []; /// /// Resource type and name strings are stored at the end of the /// resource table. /// - public Dictionary TypeAndNameStrings { get; set; } + public Dictionary TypeAndNameStrings { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/ResourceTypeAndNameString.cs b/SabreTools.Serialization/Models/NewExecutable/ResourceTypeAndNameString.cs index 7e464135..f58e1e28 100644 --- a/SabreTools.Serialization/Models/NewExecutable/ResourceTypeAndNameString.cs +++ b/SabreTools.Serialization/Models/NewExecutable/ResourceTypeAndNameString.cs @@ -18,6 +18,6 @@ /// /// ASCII text of the type or name string. /// - public byte[] Text { get; set; } + public byte[] Text { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/ResourceTypeInformationEntry.cs b/SabreTools.Serialization/Models/NewExecutable/ResourceTypeInformationEntry.cs index 63b21e5a..a80d83f6 100644 --- a/SabreTools.Serialization/Models/NewExecutable/ResourceTypeInformationEntry.cs +++ b/SabreTools.Serialization/Models/NewExecutable/ResourceTypeInformationEntry.cs @@ -29,6 +29,6 @@ /// /// A table of resources for this type follows. /// - public ResourceTypeResourceEntry[] Resources { get; set; } + public ResourceTypeResourceEntry[] Resources { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/NewExecutable/SegmentTableEntry.cs b/SabreTools.Serialization/Models/NewExecutable/SegmentTableEntry.cs index 125321a7..81ac2d9a 100644 --- a/SabreTools.Serialization/Models/NewExecutable/SegmentTableEntry.cs +++ b/SabreTools.Serialization/Models/NewExecutable/SegmentTableEntry.cs @@ -45,7 +45,7 @@ namespace SabreTools.Data.Models.NewExecutable /// Data is not sequential to the entry header. It lives at /// the and has a size of /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; /// /// Per-segment data diff --git a/SabreTools.Serialization/Models/Nitro/Cart.cs b/SabreTools.Serialization/Models/Nitro/Cart.cs index 734ba95c..1e66c228 100644 --- a/SabreTools.Serialization/Models/Nitro/Cart.cs +++ b/SabreTools.Serialization/Models/Nitro/Cart.cs @@ -8,12 +8,12 @@ namespace SabreTools.Data.Models.Nitro /// /// DS/DSi cart header /// - public CommonHeader CommonHeader { get; set; } + public CommonHeader CommonHeader { get; set; } = new(); /// /// DSi extended cart header /// - public ExtendedDSiHeader ExtendedDSiHeader { get; set; } + public ExtendedDSiHeader ExtendedDSiHeader { get; set; } = new(); /// /// Secure area, may be encrypted or decrypted @@ -24,11 +24,11 @@ namespace SabreTools.Data.Models.Nitro /// /// Name table (folder allocation table, name list) /// - public NameTable NameTable { get; set; } + public NameTable NameTable { get; set; } = new(); /// /// File allocation table /// - public FileAllocationTableEntry[] FileAllocationTable { get; set; } + public FileAllocationTableEntry[] FileAllocationTable { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/Nitro/CommonHeader.cs b/SabreTools.Serialization/Models/Nitro/CommonHeader.cs index ac32df61..01ece2e9 100644 --- a/SabreTools.Serialization/Models/Nitro/CommonHeader.cs +++ b/SabreTools.Serialization/Models/Nitro/CommonHeader.cs @@ -14,7 +14,7 @@ namespace SabreTools.Data.Models.Nitro /// /// 12 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] - public string GameTitle; + public string GameTitle = string.Empty; /// /// Gamecode @@ -26,7 +26,7 @@ namespace SabreTools.Data.Models.Nitro /// /// 2 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] - public string MakerCode; + public string MakerCode = string.Empty; /// /// Unitcode diff --git a/SabreTools.Serialization/Models/Nitro/NameListEntry.cs b/SabreTools.Serialization/Models/Nitro/NameListEntry.cs index daa9ba39..d6881410 100644 --- a/SabreTools.Serialization/Models/Nitro/NameListEntry.cs +++ b/SabreTools.Serialization/Models/Nitro/NameListEntry.cs @@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.Nitro /// /// The variable length name (UTF-8) /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Only there if it is a folder. Refers to the the index of it diff --git a/SabreTools.Serialization/Models/Nitro/NameTable.cs b/SabreTools.Serialization/Models/Nitro/NameTable.cs index 3ad76430..7a84a3dd 100644 --- a/SabreTools.Serialization/Models/Nitro/NameTable.cs +++ b/SabreTools.Serialization/Models/Nitro/NameTable.cs @@ -15,11 +15,11 @@ namespace SabreTools.Data.Models.Nitro /// /// Folder allocation table /// - public FolderAllocationTableEntry[] FolderAllocationTable { get; set; } + public FolderAllocationTableEntry[] FolderAllocationTable { get; set; } = []; /// /// Name list /// - public NameListEntry[] NameList { get; set; } + public NameListEntry[] NameList { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/OLE/ArrayHeader.cs b/SabreTools.Serialization/Models/OLE/ArrayHeader.cs index dc2baf53..0b67cf24 100644 --- a/SabreTools.Serialization/Models/OLE/ArrayHeader.cs +++ b/SabreTools.Serialization/Models/OLE/ArrayHeader.cs @@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.OLE /// The number of scalar values in an array property can be calculated from the ArrayHeader packet /// as the product of the Size fields of each of the ArrayDimension packets. /// - public ArrayDimension[] Dimensions { get; set; } + public ArrayDimension[] Dimensions { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/OLE/BLOB.cs b/SabreTools.Serialization/Models/OLE/BLOB.cs index d14548c8..082662c4 100644 --- a/SabreTools.Serialization/Models/OLE/BLOB.cs +++ b/SabreTools.Serialization/Models/OLE/BLOB.cs @@ -14,6 +14,6 @@ namespace SabreTools.Data.Models.OLE /// /// MUST be an array of bytes, followed by zero padding to a multiple of 4 bytes. /// - public byte[] Bytes { get; set; } + public byte[] Bytes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/OLE/ClipboardData.cs b/SabreTools.Serialization/Models/OLE/ClipboardData.cs index 7245ed20..a703d55d 100644 --- a/SabreTools.Serialization/Models/OLE/ClipboardData.cs +++ b/SabreTools.Serialization/Models/OLE/ClipboardData.cs @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.OLE /// /// MUST be an array of bytes, followed by zero padding to a multiple of 4 bytes /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/OLE/CodePageString.cs b/SabreTools.Serialization/Models/OLE/CodePageString.cs index e91f15b6..7fc081c4 100644 --- a/SabreTools.Serialization/Models/OLE/CodePageString.cs +++ b/SabreTools.Serialization/Models/OLE/CodePageString.cs @@ -28,6 +28,6 @@ namespace SabreTools.Data.Models.OLE /// implementation SHOULD NOT write strings with embedded or trailing null characters unless /// specifically requested to do so by an application. /// - public string Characters { get; set; } + public string Characters { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/OLE/ControlStream.cs b/SabreTools.Serialization/Models/OLE/ControlStream.cs index b7fe6f72..4013d384 100644 --- a/SabreTools.Serialization/Models/OLE/ControlStream.cs +++ b/SabreTools.Serialization/Models/OLE/ControlStream.cs @@ -30,6 +30,6 @@ namespace SabreTools.Data.Models.OLE /// OLEPS implementation. If the application did not provide a value, /// it SHOULD be absent. /// - public GUID CLSID { get; set; } + public GUID CLSID { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/OLE/Dictionary.cs b/SabreTools.Serialization/Models/OLE/Dictionary.cs index 93be5c6d..1c0331b3 100644 --- a/SabreTools.Serialization/Models/OLE/Dictionary.cs +++ b/SabreTools.Serialization/Models/OLE/Dictionary.cs @@ -16,7 +16,7 @@ namespace SabreTools.Data.Models.OLE /// All Entry fields MUST be a sequence of DictionaryEntry packets. Entries are /// not required to appear in any particular order. /// - public DictionaryEntry[] Entries { get; set; } + public DictionaryEntry[] Entries { get; set; } = []; // Padding (variable): Padding, if necessary, to a total length that is a multiple of 4 bytes. // Padding would be after each dictionary entry diff --git a/SabreTools.Serialization/Models/OLE/DictionaryEntry.cs b/SabreTools.Serialization/Models/OLE/DictionaryEntry.cs index 14327822..99e4d651 100644 --- a/SabreTools.Serialization/Models/OLE/DictionaryEntry.cs +++ b/SabreTools.Serialization/Models/OLE/DictionaryEntry.cs @@ -30,6 +30,6 @@ namespace SabreTools.Data.Models.OLE /// 8-bit characters from the code page identified by the CodePage property and MUST /// NOT be padded. /// - public string Name { get; set; } + public string Name { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/OLE/PropertySet.cs b/SabreTools.Serialization/Models/OLE/PropertySet.cs index db0fe2bb..7b2c17bd 100644 --- a/SabreTools.Serialization/Models/OLE/PropertySet.cs +++ b/SabreTools.Serialization/Models/OLE/PropertySet.cs @@ -24,13 +24,13 @@ namespace SabreTools.Data.Models.OLE /// in any particular order with regard to the value of the PropertyIdentifier /// field. /// - public PropertyIdentifierAndOffset[] PropertyIdentifierAndOffsets { get; set; } + public PropertyIdentifierAndOffset[] PropertyIdentifierAndOffsets { get; set; } = []; /// /// Each Property field is a sequence of property values, each of which MUST /// be represented by a TypedPropertyValue packet or a Dictionary packet in /// the special case of the Dictionary property. /// - public object[] Properties { get; set; } + public object[] Properties { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/OLE/PropertySetStream.cs b/SabreTools.Serialization/Models/OLE/PropertySetStream.cs index dbe2f9e7..9d233d31 100644 --- a/SabreTools.Serialization/Models/OLE/PropertySetStream.cs +++ b/SabreTools.Serialization/Models/OLE/PropertySetStream.cs @@ -50,7 +50,7 @@ namespace SabreTools.Data.Models.OLE /// the property set (or property sets). If no CLSID is provided by the /// application, it SHOULD be set to GUID_NULL by default. /// - public GUID CLSID { get; set; } + public GUID CLSID { get; set; } = new(); /// /// An unsigned integer indicating the number of property sets represented by @@ -68,7 +68,7 @@ namespace SabreTools.Data.Models.OLE /// GUID MUST be set to FMTID_DocSummaryInformation /// ({D5CDD502-2E9C-101B-9397-08002B2CF9AE}). /// - public GUID FMTID0 { get; set; } + public GUID FMTID0 { get; set; } = new(); /// /// An unsigned integer that MUST be set to the offset in bytes from the beginning @@ -80,7 +80,7 @@ namespace SabreTools.Data.Models.OLE /// If NumPropertySets has the value 0x00000002, it MUST be set to FMTID_UserDefinedProperties /// ({D5CDD505-2E9C-101B-9397-08002B2CF9AE}). Otherwise, it MUST be absent. /// - public GUID FMTID1 { get; set; } + public GUID FMTID1 { get; set; } = new(); /// /// If NumPropertySets has the value 0x00000002, it MUST be set to the offset in bytes @@ -92,13 +92,13 @@ namespace SabreTools.Data.Models.OLE /// /// MUST be a PropertySet packet /// - public PropertySet PropertySet0 { get; set; } + public PropertySet PropertySet0 { get; set; } = new(); /// /// If NumPropertySets has the value 0x00000002, it MUST be a PropertySet packet. /// Otherwise, it MUST be absent. /// - public PropertySet PropertySet1 { get; set; } + public PropertySet PropertySet1 { get; set; } = new(); // Padding (variable): Contains additional padding added by the implementation. // If present, padding MUST be zeroes and MUST be ignored. diff --git a/SabreTools.Serialization/Models/OLE/TypedPropertyValue.cs b/SabreTools.Serialization/Models/OLE/TypedPropertyValue.cs index 8e68a523..8064534b 100644 --- a/SabreTools.Serialization/Models/OLE/TypedPropertyValue.cs +++ b/SabreTools.Serialization/Models/OLE/TypedPropertyValue.cs @@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.OLE /// the value of Type as follows. /// /// See documentation for required lengths - public byte[] Value { get; set; } + public byte[] Value { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/OLE/UnicodeString.cs b/SabreTools.Serialization/Models/OLE/UnicodeString.cs index 793878d1..cca90e66 100644 --- a/SabreTools.Serialization/Models/OLE/UnicodeString.cs +++ b/SabreTools.Serialization/Models/OLE/UnicodeString.cs @@ -18,6 +18,6 @@ namespace SabreTools.Data.Models.OLE /// padding to a multiple of 4 bytes. The string represented by this field SHOULD NOT contain /// embedded or additional trailing null characters. /// - public string Characters { get; set; } + public string Characters { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/OLE/VersionedStream.cs b/SabreTools.Serialization/Models/OLE/VersionedStream.cs index ccba9e5c..ea71abe0 100644 --- a/SabreTools.Serialization/Models/OLE/VersionedStream.cs +++ b/SabreTools.Serialization/Models/OLE/VersionedStream.cs @@ -9,11 +9,11 @@ namespace SabreTools.Data.Models.OLE /// /// MUST be a GUID (Packet Version). /// - public GUID VersionGuid { get; set; } + public GUID VersionGuid { get; set; } = new(); /// /// MUST be an IndirectPropertyName. /// - public IndirectPropertyName StreamName { get; set; } + public IndirectPropertyName StreamName { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/PAK/DirectoryItem.cs b/SabreTools.Serialization/Models/PAK/DirectoryItem.cs index 90ba1e91..b865d0f0 100644 --- a/SabreTools.Serialization/Models/PAK/DirectoryItem.cs +++ b/SabreTools.Serialization/Models/PAK/DirectoryItem.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.PAK /// Item Name /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 56)] - public string ItemName; + public string ItemName = string.Empty; /// /// Item Offset diff --git a/SabreTools.Serialization/Models/PAK/File.cs b/SabreTools.Serialization/Models/PAK/File.cs index 54f46984..77b4a9d3 100644 --- a/SabreTools.Serialization/Models/PAK/File.cs +++ b/SabreTools.Serialization/Models/PAK/File.cs @@ -9,11 +9,11 @@ namespace SabreTools.Data.Models.PAK /// /// Deserialized directory header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Deserialized directory items data /// - public DirectoryItem[] DirectoryItems { get; set; } + public DirectoryItem[] DirectoryItems { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PAK/Header.cs b/SabreTools.Serialization/Models/PAK/Header.cs index 80950ae1..42520732 100644 --- a/SabreTools.Serialization/Models/PAK/Header.cs +++ b/SabreTools.Serialization/Models/PAK/Header.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.PAK /// Signature /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Directory Offset diff --git a/SabreTools.Serialization/Models/PFF/Archive.cs b/SabreTools.Serialization/Models/PFF/Archive.cs index 52354d1b..cb81f590 100644 --- a/SabreTools.Serialization/Models/PFF/Archive.cs +++ b/SabreTools.Serialization/Models/PFF/Archive.cs @@ -9,16 +9,16 @@ namespace SabreTools.Data.Models.PFF /// /// Archive header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Segments /// - public Segment[] Segments { get; set; } + public Segment[] Segments { get; set; } = []; /// /// Footer /// - public Footer Footer { get; set; } + public Footer Footer { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/PFF/Footer.cs b/SabreTools.Serialization/Models/PFF/Footer.cs index 58d26e2a..21c97f26 100644 --- a/SabreTools.Serialization/Models/PFF/Footer.cs +++ b/SabreTools.Serialization/Models/PFF/Footer.cs @@ -23,6 +23,6 @@ namespace SabreTools.Data.Models.PFF /// King tag /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string KingTag; + public string KingTag = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PFF/Header.cs b/SabreTools.Serialization/Models/PFF/Header.cs index cf620d24..65a0e2fe 100644 --- a/SabreTools.Serialization/Models/PFF/Header.cs +++ b/SabreTools.Serialization/Models/PFF/Header.cs @@ -20,7 +20,7 @@ namespace SabreTools.Data.Models.PFF /// /// Versions 2 and 3 share the same signature but different header sizes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Number of files diff --git a/SabreTools.Serialization/Models/PIC/DiscInformation.cs b/SabreTools.Serialization/Models/PIC/DiscInformation.cs index 92a65edf..beecb875 100644 --- a/SabreTools.Serialization/Models/PIC/DiscInformation.cs +++ b/SabreTools.Serialization/Models/PIC/DiscInformation.cs @@ -29,6 +29,6 @@ /// /// Disc information and emergency brake units /// - public DiscInformationUnit[] Units { get; set; } + public DiscInformationUnit[] Units { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PIC/DiscInformationUnit.cs b/SabreTools.Serialization/Models/PIC/DiscInformationUnit.cs index 8e235adf..97609605 100644 --- a/SabreTools.Serialization/Models/PIC/DiscInformationUnit.cs +++ b/SabreTools.Serialization/Models/PIC/DiscInformationUnit.cs @@ -7,12 +7,12 @@ /// /// Unit header /// - public DiscInformationUnitHeader Header { get; set; } + public DiscInformationUnitHeader Header { get; set; } = new(); /// /// Unit body /// - public DiscInformationUnitBody Body { get; set; } + public DiscInformationUnitBody Body { get; set; } = new(); /// /// Unit trailer (BD-R/RE only) diff --git a/SabreTools.Serialization/Models/PIC/DiscInformationUnitBody.cs b/SabreTools.Serialization/Models/PIC/DiscInformationUnitBody.cs index 534d2de4..1f6aaf2f 100644 --- a/SabreTools.Serialization/Models/PIC/DiscInformationUnitBody.cs +++ b/SabreTools.Serialization/Models/PIC/DiscInformationUnitBody.cs @@ -8,7 +8,7 @@ namespace SabreTools.Data.Models.PIC /// /// Disc Type Identifier /// - public string DiscTypeIdentifier { get; set; } + public string DiscTypeIdentifier { get; set; } = string.Empty; /// /// Disc Size/Class/Version @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.PIC /// DI Unit Format dependent contents /// /// 52 bytes for BD-ROM, 100 bytes for BD-R/RE - public byte[] FormatDependentContents { get; set; } + public byte[] FormatDependentContents { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PIC/DiscInformationUnitHeader.cs b/SabreTools.Serialization/Models/PIC/DiscInformationUnitHeader.cs index 696ace59..ea5d56b5 100644 --- a/SabreTools.Serialization/Models/PIC/DiscInformationUnitHeader.cs +++ b/SabreTools.Serialization/Models/PIC/DiscInformationUnitHeader.cs @@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.PIC /// Emergency Brake Identifier "EB" /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] - public string DiscInformationIdentifier; + public string DiscInformationIdentifier = string.Empty; /// /// Disc Information Format diff --git a/SabreTools.Serialization/Models/PKZIP/AS400ExtraFieldAttribute.cs b/SabreTools.Serialization/Models/PKZIP/AS400ExtraFieldAttribute.cs index 91ab2835..9a647a63 100644 --- a/SabreTools.Serialization/Models/PKZIP/AS400ExtraFieldAttribute.cs +++ b/SabreTools.Serialization/Models/PKZIP/AS400ExtraFieldAttribute.cs @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.PKZIP /// Data /// /// Variable byte length based on field code - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/Archive.cs b/SabreTools.Serialization/Models/PKZIP/Archive.cs index 658c235b..2765cf6a 100644 --- a/SabreTools.Serialization/Models/PKZIP/Archive.cs +++ b/SabreTools.Serialization/Models/PKZIP/Archive.cs @@ -15,7 +15,7 @@ namespace SabreTools.Data.Models.PKZIP /// Optional archive decryption header, appears after all entries /// /// TODO: Determine the model - public byte[] ArchiveDecryptionHeader { get; set; } + public byte[] ArchiveDecryptionHeader { get; set; } = []; /// /// Optional archive extra data record, appears after either diff --git a/SabreTools.Serialization/Models/PKZIP/ArchiveExtraDataRecord.cs b/SabreTools.Serialization/Models/PKZIP/ArchiveExtraDataRecord.cs index 3fabda5c..e2b0b498 100644 --- a/SabreTools.Serialization/Models/PKZIP/ArchiveExtraDataRecord.cs +++ b/SabreTools.Serialization/Models/PKZIP/ArchiveExtraDataRecord.cs @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Extra field data (variable size) /// - public byte[] ExtraFieldData { get; set; } + public byte[] ExtraFieldData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/DataStreamAlignment.cs b/SabreTools.Serialization/Models/PKZIP/DataStreamAlignment.cs index 2ce29050..363706ac 100644 --- a/SabreTools.Serialization/Models/PKZIP/DataStreamAlignment.cs +++ b/SabreTools.Serialization/Models/PKZIP/DataStreamAlignment.cs @@ -29,6 +29,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// 0x00-padding /// - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/DigitalSignature.cs b/SabreTools.Serialization/Models/PKZIP/DigitalSignature.cs index a756c4b9..0dd34cb2 100644 --- a/SabreTools.Serialization/Models/PKZIP/DigitalSignature.cs +++ b/SabreTools.Serialization/Models/PKZIP/DigitalSignature.cs @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Signature data (variable size) /// - public byte[] SignatureData { get; set; } + public byte[] SignatureData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/EndOfCentralDirectoryRecord64.cs b/SabreTools.Serialization/Models/PKZIP/EndOfCentralDirectoryRecord64.cs index 8fc836c5..941b3489 100644 --- a/SabreTools.Serialization/Models/PKZIP/EndOfCentralDirectoryRecord64.cs +++ b/SabreTools.Serialization/Models/PKZIP/EndOfCentralDirectoryRecord64.cs @@ -67,6 +67,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// ZIP64 extensible data sector /// - public byte[] ExtensibleDataSector { get; set; } + public byte[] ExtensibleDataSector { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodeCommentExtraField.cs b/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodeCommentExtraField.cs index 6a33e2f5..d774c2a1 100644 --- a/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodeCommentExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodeCommentExtraField.cs @@ -49,6 +49,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// UTF-8 version of the entry comment /// - public string UnicodeCom { get; set; } + public string UnicodeCom { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodePathExtraField.cs b/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodePathExtraField.cs index 0c1b84fe..2a2f0aef 100644 --- a/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodePathExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/InfoZIPUnicodePathExtraField.cs @@ -49,6 +49,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// UTF-8 version of the entry File Name /// - public string UnicodeName { get; set; } + public string UnicodeName { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PKZIP/KeyProviderRecordExtraField.cs b/SabreTools.Serialization/Models/PKZIP/KeyProviderRecordExtraField.cs index ff194770..4147c95c 100644 --- a/SabreTools.Serialization/Models/PKZIP/KeyProviderRecordExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/KeyProviderRecordExtraField.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Data about the key /// - public byte[] TData { get; set; } + public byte[] TData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/LocalFile.cs b/SabreTools.Serialization/Models/PKZIP/LocalFile.cs index 6b23c59b..142455bd 100644 --- a/SabreTools.Serialization/Models/PKZIP/LocalFile.cs +++ b/SabreTools.Serialization/Models/PKZIP/LocalFile.cs @@ -10,19 +10,19 @@ namespace SabreTools.Data.Models.PKZIP /// /// Local file header /// - public LocalFileHeader LocalFileHeader { get; set; } + public LocalFileHeader LocalFileHeader { get; set; } = new(); /// /// Encryption header /// /// TODO: Determine the model for the encryption headers - public byte[] EncryptionHeaders { get; set; } + public byte[] EncryptionHeaders { get; set; } = []; /// /// File data, appears after the encryption header /// if it exists or after the local file header otherwise /// - public byte[] FileData { get; set; } + public byte[] FileData { get; set; } = []; /// /// Data descriptors, appears after the file data diff --git a/SabreTools.Serialization/Models/PKZIP/MVSExtraField.cs b/SabreTools.Serialization/Models/PKZIP/MVSExtraField.cs index 1ee572b7..7dddc1c4 100644 --- a/SabreTools.Serialization/Models/PKZIP/MVSExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/MVSExtraField.cs @@ -16,6 +16,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Attribute data (see APPENDIX B) /// - public byte[] Var { get; set; } + public byte[] Var { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/MicrosoftOpenPackagingGrowthHint.cs b/SabreTools.Serialization/Models/PKZIP/MicrosoftOpenPackagingGrowthHint.cs index 8e0550e3..e0f53a02 100644 --- a/SabreTools.Serialization/Models/PKZIP/MicrosoftOpenPackagingGrowthHint.cs +++ b/SabreTools.Serialization/Models/PKZIP/MicrosoftOpenPackagingGrowthHint.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Filled with NULL characters /// - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/NTFSExtraField.cs b/SabreTools.Serialization/Models/PKZIP/NTFSExtraField.cs index dabe1477..14f684ee 100644 --- a/SabreTools.Serialization/Models/PKZIP/NTFSExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/NTFSExtraField.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// NTFS attribute tags /// - public TagSizeVar[] TagSizeVars { get; set; } + public TagSizeVar[] TagSizeVars { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/OS2ExtraField.cs b/SabreTools.Serialization/Models/PKZIP/OS2ExtraField.cs index dc212408..df942cef 100644 --- a/SabreTools.Serialization/Models/PKZIP/OS2ExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/OS2ExtraField.cs @@ -31,6 +31,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Compressed block /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/OS400ExtraField.cs b/SabreTools.Serialization/Models/PKZIP/OS400ExtraField.cs index 50bcd4d6..da4d5a19 100644 --- a/SabreTools.Serialization/Models/PKZIP/OS400ExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/OS400ExtraField.cs @@ -16,6 +16,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Attribute data (see APPENDIX A) /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/OpenVMSExtraField.cs b/SabreTools.Serialization/Models/PKZIP/OpenVMSExtraField.cs index cb4d0404..ec0578fd 100644 --- a/SabreTools.Serialization/Models/PKZIP/OpenVMSExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/OpenVMSExtraField.cs @@ -31,6 +31,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// OpenVMS attribute tags /// - public TagSizeVar[] TagSizeVars { get; set; } + public TagSizeVar[] TagSizeVars { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/PKCS7EncryptionRecipientCertificateList.cs b/SabreTools.Serialization/Models/PKZIP/PKCS7EncryptionRecipientCertificateList.cs index 93da5607..1b1ba36d 100644 --- a/SabreTools.Serialization/Models/PKZIP/PKCS7EncryptionRecipientCertificateList.cs +++ b/SabreTools.Serialization/Models/PKZIP/PKCS7EncryptionRecipientCertificateList.cs @@ -26,6 +26,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// PKCS#7 data blob /// - public byte[] CStore { get; set; } + public byte[] CStore { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/PKCS7Store.cs b/SabreTools.Serialization/Models/PKZIP/PKCS7Store.cs index 92c29c32..b9e2ca04 100644 --- a/SabreTools.Serialization/Models/PKZIP/PKCS7Store.cs +++ b/SabreTools.Serialization/Models/PKZIP/PKCS7Store.cs @@ -15,6 +15,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Data about the store /// - public byte[] TData { get; set; } + public byte[] TData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/PolicyDecryptionKeyRecordExtraField.cs b/SabreTools.Serialization/Models/PKZIP/PolicyDecryptionKeyRecordExtraField.cs index 69195591..2f94ee13 100644 --- a/SabreTools.Serialization/Models/PKZIP/PolicyDecryptionKeyRecordExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/PolicyDecryptionKeyRecordExtraField.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Data about the key /// - public byte[] TData { get; set; } + public byte[] TData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/PolicyKeyDataRecordRecordExtraField.cs b/SabreTools.Serialization/Models/PKZIP/PolicyKeyDataRecordRecordExtraField.cs index edd536c2..a3a4631c 100644 --- a/SabreTools.Serialization/Models/PKZIP/PolicyKeyDataRecordRecordExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/PolicyKeyDataRecordRecordExtraField.cs @@ -17,6 +17,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Data about the key /// - public byte[] TData { get; set; } + public byte[] TData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/RecordManagementControls.cs b/SabreTools.Serialization/Models/PKZIP/RecordManagementControls.cs index b81ea74d..544b20f3 100644 --- a/SabreTools.Serialization/Models/PKZIP/RecordManagementControls.cs +++ b/SabreTools.Serialization/Models/PKZIP/RecordManagementControls.cs @@ -7,6 +7,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Record management control attribute tags /// - public TagSizeVar[] TagSizeVars { get; set; } + public TagSizeVar[] TagSizeVars { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/SpecialPurposeDataHeader.cs b/SabreTools.Serialization/Models/PKZIP/SpecialPurposeDataHeader.cs index b258aa0f..66ded975 100644 --- a/SabreTools.Serialization/Models/PKZIP/SpecialPurposeDataHeader.cs +++ b/SabreTools.Serialization/Models/PKZIP/SpecialPurposeDataHeader.cs @@ -20,6 +20,6 @@ namespace SabreTools.Data.Models.PKZIP /// Data (variable size) /// /// TODO: Implement models for all extra field types - 4.5.3 - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/StrongEncryptionHeader.cs b/SabreTools.Serialization/Models/PKZIP/StrongEncryptionHeader.cs index ef9f120c..d6054877 100644 --- a/SabreTools.Serialization/Models/PKZIP/StrongEncryptionHeader.cs +++ b/SabreTools.Serialization/Models/PKZIP/StrongEncryptionHeader.cs @@ -39,6 +39,6 @@ namespace SabreTools.Data.Models.PKZIP /// Certificate Processing Method under /// the Strong Encryption Specification /// - public byte[] CertData { get; set; } + public byte[] CertData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/TagSizeVar.cs b/SabreTools.Serialization/Models/PKZIP/TagSizeVar.cs index 671858fc..fb55886f 100644 --- a/SabreTools.Serialization/Models/PKZIP/TagSizeVar.cs +++ b/SabreTools.Serialization/Models/PKZIP/TagSizeVar.cs @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Variable-length data /// - public byte[] Var { get; set; } + public byte[] Var { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/UnixExtraField.cs b/SabreTools.Serialization/Models/PKZIP/UnixExtraField.cs index 6e2060a1..2e0e3f0d 100644 --- a/SabreTools.Serialization/Models/PKZIP/UnixExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/UnixExtraField.cs @@ -44,6 +44,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Variable length data field /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/UnknownExtraField.cs b/SabreTools.Serialization/Models/PKZIP/UnknownExtraField.cs index 48819a20..27023c88 100644 --- a/SabreTools.Serialization/Models/PKZIP/UnknownExtraField.cs +++ b/SabreTools.Serialization/Models/PKZIP/UnknownExtraField.cs @@ -10,6 +10,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/X509CentralDirectory.cs b/SabreTools.Serialization/Models/PKZIP/X509CentralDirectory.cs index b77cc974..b89670b9 100644 --- a/SabreTools.Serialization/Models/PKZIP/X509CentralDirectory.cs +++ b/SabreTools.Serialization/Models/PKZIP/X509CentralDirectory.cs @@ -14,6 +14,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Data /// - public byte[] TData { get; set; } + public byte[] TData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/X509IndividualFile.cs b/SabreTools.Serialization/Models/PKZIP/X509IndividualFile.cs index 73ddb901..9850e66e 100644 --- a/SabreTools.Serialization/Models/PKZIP/X509IndividualFile.cs +++ b/SabreTools.Serialization/Models/PKZIP/X509IndividualFile.cs @@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.PKZIP /// /// Signature Data /// - public byte[] TData { get; set; } + public byte[] TData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PKZIP/ZOSExtraFieldAttribute.cs b/SabreTools.Serialization/Models/PKZIP/ZOSExtraFieldAttribute.cs index 692cdba0..8054e95b 100644 --- a/SabreTools.Serialization/Models/PKZIP/ZOSExtraFieldAttribute.cs +++ b/SabreTools.Serialization/Models/PKZIP/ZOSExtraFieldAttribute.cs @@ -21,6 +21,6 @@ namespace SabreTools.Data.Models.PKZIP /// Data /// /// Variable byte length based on field code - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PlayJ/AudioFile.cs b/SabreTools.Serialization/Models/PlayJ/AudioFile.cs index 9e7a3b7b..322ba8a2 100644 --- a/SabreTools.Serialization/Models/PlayJ/AudioFile.cs +++ b/SabreTools.Serialization/Models/PlayJ/AudioFile.cs @@ -8,12 +8,12 @@ namespace SabreTools.Data.Models.PlayJ /// /// Header /// - public AudioHeader Header { get; set; } + public AudioHeader Header { get; set; } = new AudioHeaderV1(); /// /// Unknown block 1 /// - public UnknownBlock1 UnknownBlock1 { get; set; } + public UnknownBlock1 UnknownBlock1 { get; set; } = new(); #region V1 Only diff --git a/SabreTools.Serialization/Models/PlayJ/AudioHeader.cs b/SabreTools.Serialization/Models/PlayJ/AudioHeader.cs index 786660b2..7d95a3d7 100644 --- a/SabreTools.Serialization/Models/PlayJ/AudioHeader.cs +++ b/SabreTools.Serialization/Models/PlayJ/AudioHeader.cs @@ -26,7 +26,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Track name (not null-terminated) /// - public string Track { get; set; } + public string Track { get; set; } = string.Empty; /// /// Length of the artist name @@ -36,7 +36,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Artist name (not null-terminated) /// - public string Artist { get; set; } + public string Artist { get; set; } = string.Empty; /// /// Length of the album name @@ -46,7 +46,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Album name (not null-terminated) /// - public string Album { get; set; } + public string Album { get; set; } = string.Empty; /// /// Length of the writer name @@ -56,7 +56,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Writer name (not null-terminated) /// - public string Writer { get; set; } + public string Writer { get; set; } = string.Empty; /// /// Length of the publisher name @@ -66,7 +66,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Publisher name (not null-terminated) /// - public string Publisher { get; set; } + public string Publisher { get; set; } = string.Empty; /// /// Length of the label name @@ -76,7 +76,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Label name (not null-terminated) /// - public string Label { get; set; } + public string Label { get; set; } = string.Empty; /// /// Length of the comments diff --git a/SabreTools.Serialization/Models/PlayJ/DataFile.cs b/SabreTools.Serialization/Models/PlayJ/DataFile.cs index da7e9fc9..fc21cb92 100644 --- a/SabreTools.Serialization/Models/PlayJ/DataFile.cs +++ b/SabreTools.Serialization/Models/PlayJ/DataFile.cs @@ -13,7 +13,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Data file name /// - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; /// /// Length of the data @@ -23,7 +23,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Data /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; // Notes about Data: // - Each data block in the samples contains a GIF header diff --git a/SabreTools.Serialization/Models/PlayJ/Playlist.cs b/SabreTools.Serialization/Models/PlayJ/Playlist.cs index ed7b9159..cdef4c30 100644 --- a/SabreTools.Serialization/Models/PlayJ/Playlist.cs +++ b/SabreTools.Serialization/Models/PlayJ/Playlist.cs @@ -8,11 +8,11 @@ namespace SabreTools.Data.Models.PlayJ /// /// Playlist header /// - public PlaylistHeader Header { get; set; } + public PlaylistHeader Header { get; set; } = new(); /// /// Embedded audio files / headers /// - public AudioFile[] AudioFiles { get; set; } + public AudioFile[] AudioFiles { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PlayJ/UnknownBlock1.cs b/SabreTools.Serialization/Models/PlayJ/UnknownBlock1.cs index 79398a98..c9908fc3 100644 --- a/SabreTools.Serialization/Models/PlayJ/UnknownBlock1.cs +++ b/SabreTools.Serialization/Models/PlayJ/UnknownBlock1.cs @@ -13,7 +13,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Unknown data /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; // Notes about Data: // - Might be UInt16 offset and UInt16 length pairs diff --git a/SabreTools.Serialization/Models/PlayJ/UnknownBlock3.cs b/SabreTools.Serialization/Models/PlayJ/UnknownBlock3.cs index 375e03f3..a64f90b4 100644 --- a/SabreTools.Serialization/Models/PlayJ/UnknownBlock3.cs +++ b/SabreTools.Serialization/Models/PlayJ/UnknownBlock3.cs @@ -8,7 +8,7 @@ namespace SabreTools.Data.Models.PlayJ /// /// Unknown data /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; // Notes about Data: // - This may be where the encrypted audio samples live diff --git a/SabreTools.Serialization/Models/PlayStation3/SFB.cs b/SabreTools.Serialization/Models/PlayStation3/SFB.cs index 65062b31..4ea7ea5f 100644 --- a/SabreTools.Serialization/Models/PlayStation3/SFB.cs +++ b/SabreTools.Serialization/Models/PlayStation3/SFB.cs @@ -28,7 +28,7 @@ namespace SabreTools.Data.Models.PlayStation3 /// /// 0x10 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)] - public string FlagsType; + public string FlagsType = string.Empty; /// /// Disc Content Data Offset @@ -52,7 +52,7 @@ namespace SabreTools.Data.Models.PlayStation3 /// /// 0x08 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x08)] - public string DiscTitleName; + public string DiscTitleName = string.Empty; /// /// Unknown (zeroes) @@ -83,21 +83,21 @@ namespace SabreTools.Data.Models.PlayStation3 /// /// 0x20 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)] - public string DiscContent; + public string DiscContent = string.Empty; /// /// Disc Title /// /// 0x10 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)] - public string DiscTitle; + public string DiscTitle = string.Empty; /// /// Disc Version /// /// 0x10 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x10)] - public string DiscVersion; + public string DiscVersion = string.Empty; /// /// Unknown (zeroes) diff --git a/SabreTools.Serialization/Models/PlayStation3/SFO.cs b/SabreTools.Serialization/Models/PlayStation3/SFO.cs index 13bfb131..dbad9124 100644 --- a/SabreTools.Serialization/Models/PlayStation3/SFO.cs +++ b/SabreTools.Serialization/Models/PlayStation3/SFO.cs @@ -6,12 +6,12 @@ namespace SabreTools.Data.Models.PlayStation3 /// /// SFO header /// - public SFOHeader Header { get; set; } + public SFOHeader Header { get; set; } = new(); /// /// Index table /// - public SFOIndexTableEntry[] IndexTable { get; set; } + public SFOIndexTableEntry[] IndexTable { get; set; } = []; /// /// Key table @@ -29,13 +29,13 @@ namespace SabreTools.Data.Models.PlayStation3 /// coincidence caused by the length of the key names used, when this /// happens there is no padding needed) /// - public string[] KeyTable { get; set; } + public string[] KeyTable { get; set; } = []; /// /// Padding /// /// Enough bytes to align to 4 bytes - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; /// /// Data table @@ -50,6 +50,6 @@ namespace SabreTools.Data.Models.PlayStation3 /// being used). This entries can be considered reserved, and are marked with /// a len = 0 in the associated entry in the index_table /// - public byte[][] DataTable { get; set; } + public byte[][] DataTable { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PlayStation4/AppPkgHeader.cs b/SabreTools.Serialization/Models/PlayStation4/AppPkgHeader.cs index 513f02dc..624176c9 100644 --- a/SabreTools.Serialization/Models/PlayStation4/AppPkgHeader.cs +++ b/SabreTools.Serialization/Models/PlayStation4/AppPkgHeader.cs @@ -76,7 +76,7 @@ namespace SabreTools.Data.Models.PlayStation4 /// PKG Content ID /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x24)] - public string ContentID; + public string ContentID = string.Empty; /// /// PKG Content Padding (Zeroes) diff --git a/SabreTools.Serialization/Models/PortableExecutable/AttributeCertificate/Entry.cs b/SabreTools.Serialization/Models/PortableExecutable/AttributeCertificate/Entry.cs index 4582f3c4..be4687b9 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/AttributeCertificate/Entry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/AttributeCertificate/Entry.cs @@ -58,6 +58,6 @@ /// Contains a certificate, such as an Authenticode signature. /// /// - public byte[] Certificate { get; set; } + public byte[] Certificate { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/BaseRelocation/Block.cs b/SabreTools.Serialization/Models/PortableExecutable/BaseRelocation/Block.cs index 51ad9d19..a227e096 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/BaseRelocation/Block.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/BaseRelocation/Block.cs @@ -46,6 +46,6 @@ /// in the Page RVA field for the block. This offset /// specifies where the base relocation is to be applied. /// - public TypeOffsetFieldEntry[] TypeOffsetFieldEntries { get; set; } + public TypeOffsetFieldEntry[] TypeOffsetFieldEntries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/DebugData/NB10ProgramDatabase.cs b/SabreTools.Serialization/Models/PortableExecutable/DebugData/NB10ProgramDatabase.cs index 19a9ac20..3454477d 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/DebugData/NB10ProgramDatabase.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/DebugData/NB10ProgramDatabase.cs @@ -39,6 +39,6 @@ namespace SabreTools.Data.Models.PortableExecutable.DebugData /// /// Is this Unicode? [MarshalAs(UnmanagedType.LPStr)] - public string PdbFileName; + public string PdbFileName = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/DebugData/RSDSProgramDatabase.cs b/SabreTools.Serialization/Models/PortableExecutable/DebugData/RSDSProgramDatabase.cs index e4e5be70..959112d6 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/DebugData/RSDSProgramDatabase.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/DebugData/RSDSProgramDatabase.cs @@ -36,6 +36,6 @@ namespace SabreTools.Data.Models.PortableExecutable.DebugData #else [MarshalAs(UnmanagedType.LPStr)] #endif - public string? PathAndFileName; + public string PathAndFileName = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/DebugData/Table.cs b/SabreTools.Serialization/Models/PortableExecutable/DebugData/Table.cs index 629baf38..c2aae873 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/DebugData/Table.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/DebugData/Table.cs @@ -33,6 +33,6 @@ /// file and is not mapped into the run-time address space). If it is mapped, /// the RVA is its address. /// - public Entry[] DebugDirectoryTable { get; set; } + public Entry[] DebugDirectoryTable { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Executable.cs b/SabreTools.Serialization/Models/PortableExecutable/Executable.cs index abaa3dee..ae0fcb66 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Executable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Executable.cs @@ -14,29 +14,29 @@ namespace SabreTools.Data.Models.PortableExecutable /// /// MS-DOS executable stub /// - public MSDOS.Executable Stub { get; set; } + public MSDOS.Executable Stub { get; set; } = new(); /// /// After the MS-DOS stub, at the file offset specified at offset 0x3c, is a 4-byte /// signature that identifies the file as a PE format image file. This signature is "PE\0\0" /// (the letters "P" and "E" followed by two null bytes). /// - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// /// File header /// - public COFF.FileHeader FileHeader { get; set; } + public COFF.FileHeader FileHeader { get; set; } = new(); /// /// Microsoft extended optional header /// - public OptionalHeader OptionalHeader { get; set; } + public OptionalHeader OptionalHeader { get; set; } = new(); /// /// Section table /// - public COFF.SectionHeader[] SectionTable { get; set; } + public COFF.SectionHeader[] SectionTable { get; set; } = []; /// /// Symbol table diff --git a/SabreTools.Serialization/Models/PortableExecutable/Export/DirectoryTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Export/DirectoryTable.cs index 63d21f18..8c968dab 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Export/DirectoryTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Export/DirectoryTable.cs @@ -39,7 +39,7 @@ /// /// ASCII string that contains the name of the DLL. /// - public string? Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// The starting ordinal number for exports in this image. This field specifies diff --git a/SabreTools.Serialization/Models/PortableExecutable/Export/NamePointerTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Export/NamePointerTable.cs index 49895f10..db0ec676 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Export/NamePointerTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Export/NamePointerTable.cs @@ -13,6 +13,6 @@ /// /// The pointers are 32 bits each and are relative to the image base. /// - public uint[] Pointers { get; set; } + public uint[] Pointers { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Export/NameTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Export/NameTable.cs index d3a011a8..dcf1c4f2 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Export/NameTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Export/NameTable.cs @@ -22,6 +22,6 @@ /// /// A series of null-terminated ASCII strings of variable length. /// - public string[] Strings { get; set; } + public string[] Strings { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Export/OrdinalTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Export/OrdinalTable.cs index 988314fc..7bc007c3 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Export/OrdinalTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Export/OrdinalTable.cs @@ -37,6 +37,6 @@ /// /// An array of 16-bit unbiased indexes into the export address table /// - public ushort[] Indexes { get; set; } + public ushort[] Indexes { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Import/DirectoryTableEntry.cs b/SabreTools.Serialization/Models/PortableExecutable/Import/DirectoryTableEntry.cs index 03e6abf2..5d3432e7 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Import/DirectoryTableEntry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Import/DirectoryTableEntry.cs @@ -39,7 +39,7 @@ /// /// ASCII string that contains the name of the DLL. /// - public string? Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// The RVA of the import address table. The contents of this table are identical diff --git a/SabreTools.Serialization/Models/PortableExecutable/Import/HintNameTableEntry.cs b/SabreTools.Serialization/Models/PortableExecutable/Import/HintNameTableEntry.cs index 3518bd5f..4f0b5f09 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Import/HintNameTableEntry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Import/HintNameTableEntry.cs @@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.PortableExecutable.Import /// and terminated by a null byte. /// [MarshalAs(UnmanagedType.LPStr)] - public string Name; + public string Name = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/DataEntry.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/DataEntry.cs index 6caae450..aa7b083e 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/DataEntry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/DataEntry.cs @@ -24,7 +24,7 @@ /// /// The resource data that is pointed to by the Data RVA field. /// - public byte[] Data { get; set; } + public byte[] Data { get; set; } = []; /// /// The code page that is used to decode code point values within the diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryString.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryString.cs index d1fec47a..cbe049a3 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryString.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryString.cs @@ -18,6 +18,6 @@ /// /// The variable-length Unicode string data, word-aligned. /// - public byte[] UnicodeString { get; set; } + public byte[] UnicodeString { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryTable.cs index 3655a603..2ee111a3 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/DirectoryTable.cs @@ -54,6 +54,6 @@ /// strings to identify Type, Name, or Language entries (depending on the /// level of the table). /// - public DirectoryEntry[] Entries { get; set; } + public DirectoryEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/AcceleratorTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/AcceleratorTable.cs index d6079b8c..a4e92407 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/AcceleratorTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/AcceleratorTable.cs @@ -14,6 +14,6 @@ namespace SabreTools.Data.Models.PortableExecutable.Resource.Entries /// /// Accelerator table entries /// - public AcceleratorTableEntry[] Entries { get; set; } + public AcceleratorTableEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/CursorAndIconResource.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/CursorAndIconResource.cs index feaacdeb..e4d668b7 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/CursorAndIconResource.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/CursorAndIconResource.cs @@ -33,7 +33,7 @@ /// /// Describes keyboard accelerator characteristics. /// - public NewHeader NEWHEADER { get; set; } + public NewHeader NEWHEADER { get; set; } = new(); // TODO: Add array of entries in the resource } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplate.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplate.cs index 6ff727db..3bd510fc 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplate.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplate.cs @@ -86,7 +86,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string ClassResource { get; set; } + public string ClassResource { get; set; } = string.Empty; /// /// The ordinal value of a predefined system class. @@ -105,7 +105,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string TitleResource { get; set; } + public string TitleResource { get; set; } = string.Empty; /// /// An ordinal value of a resource, such as an icon, in an executable file @@ -125,6 +125,6 @@ /// When the system creates the control, it passes a pointer to this data in the lParam parameter of the /// WM_CREATE message that it sends to the control. /// - public byte[] CreationData { get; set; } + public byte[] CreationData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplateExtended.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplateExtended.cs index b67902cc..e1caa445 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplateExtended.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogItemTemplateExtended.cs @@ -84,7 +84,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string ClassResource { get; set; } + public string ClassResource { get; set; } = string.Empty; /// /// The ordinal value of a predefined system class. @@ -103,7 +103,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string TitleResource { get; set; } + public string TitleResource { get; set; } = string.Empty; /// /// An ordinal value of a resource, such as an icon, in an executable file @@ -123,6 +123,6 @@ /// When the system creates the control, it passes a pointer to this data in the lParam parameter of the /// WM_CREATE message that it sends to the control. /// - public byte[] CreationData { get; set; } + public byte[] CreationData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplate.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplate.cs index d77cfd08..7f4b2654 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplate.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplate.cs @@ -96,7 +96,7 @@ /// If you specify character strings in the menu, class, title, or typeface arrays, you must use /// Unicode strings. /// - public string MenuResource { get; set; } + public string MenuResource { get; set; } = string.Empty; /// /// The ordinal value of a menu resource in an executable file. @@ -115,7 +115,7 @@ /// If you specify character strings in the menu, class, title, or typeface arrays, you must use /// Unicode strings. /// - public string ClassResource { get; set; } + public string ClassResource { get; set; } = string.Empty; /// /// The ordinal value of a predefined system class. @@ -131,7 +131,7 @@ /// If you specify character strings in the menu, class, title, or typeface arrays, you must use /// Unicode strings. /// - public string? TitleResource { get; set; } + public string TitleResource { get; set; } = string.Empty; /// /// The 16-bit point size value and the typeface array follow the title array, but only if the @@ -155,6 +155,6 @@ /// If you specify character strings in the menu, class, title, or typeface arrays, you must use /// Unicode strings. /// - public string Typeface { get; set; } + public string Typeface { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplateExtended.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplateExtended.cs index 51011a64..1e5d8afc 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplateExtended.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DialogTemplateExtended.cs @@ -107,7 +107,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string MenuResource { get; set; } + public string MenuResource { get; set; } = string.Empty; /// /// The ordinal value of a menu resource in an executable file. @@ -125,7 +125,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string ClassResource { get; set; } + public string ClassResource { get; set; } = string.Empty; /// /// The ordinal value of a predefined system window class. @@ -140,7 +140,7 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string TitleResource { get; set; } + public string TitleResource { get; set; } = string.Empty; /// /// The point size of the font to use for the text in the dialog box and its controls. @@ -180,6 +180,6 @@ /// If you specify character strings in the class and title arrays, you must use Unicode strings. Use the /// MultiByteToWideChar function to generate Unicode strings from ANSI strings. /// - public string Typeface { get; set; } + public string Typeface { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DirEntry.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DirEntry.cs index a246f259..f6f667c8 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DirEntry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/DirEntry.cs @@ -16,6 +16,6 @@ /// The FONTDIRENTRY structure for the specified font directly follows the DIRENTRY structure /// for that font. /// - public FontDirEntry Entry { get; set; } + public FontDirEntry Entry { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontDirEntry.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontDirEntry.cs index de81748b..8fecf4b8 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontDirEntry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontDirEntry.cs @@ -164,11 +164,11 @@ /// /// The name of the device if this font file is designated for a specific device. /// - public string DeviceName { get; set; } + public string DeviceName { get; set; } = string.Empty; /// /// The typeface name of the font. /// - public string FaceName { get; set; } + public string FaceName { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontGroupHeader.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontGroupHeader.cs index a4d09e76..0c209231 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontGroupHeader.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/FontGroupHeader.cs @@ -16,6 +16,6 @@ /// A structure that contains a unique ordinal identifier for each font in the resource. The DE /// member is a placeholder for the variable-length array of DIRENTRY structures. /// - public DirEntry[] DE { get; set; } + public DirEntry[] DE { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuItemExtended.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuItemExtended.cs index b537b697..ffa412b2 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuItemExtended.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuItemExtended.cs @@ -39,6 +39,6 @@ namespace SabreTools.Data.Models.PortableExecutable.Resource.Entries /// There is no fixed limit on the size of this string. /// [MarshalAs(UnmanagedType.LPWStr)] - public string MenuText; + public string MenuText = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuResource.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuResource.cs index d840124a..5828a15b 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuResource.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MenuResource.cs @@ -12,11 +12,11 @@ /// /// Menu header structure /// - public MenuHeader MenuHeader { get; set; } + public MenuHeader MenuHeader { get; set; } = new NormalMenuHeader(); /// /// Menu items /// - public MenuItem[] MenuItems { get; set; } + public MenuItem[] MenuItems { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceData.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceData.cs index ec8f6a96..088f9cce 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceData.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceData.cs @@ -17,11 +17,11 @@ namespace SabreTools.Data.Models.PortableExecutable.Resource.Entries /// /// An array of structures. The array is the size indicated by the NumberOfBlocks member. /// - public MessageResourceBlock[] Blocks { get; set; } + public MessageResourceBlock[] Blocks { get; set; } = []; /// /// Message resource entries /// - public Dictionary Entries { get; set; } + public Dictionary Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceEntry.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceEntry.cs index 2034c9f5..9020601d 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceEntry.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/MessageResourceEntry.cs @@ -20,6 +20,6 @@ /// /// Pointer to an array that contains the error message or message box display text. /// - public string Text { get; set; } + public string Text { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/NormalMenuItem.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/NormalMenuItem.cs index 7d0cbfc2..3e1d1518 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/NormalMenuItem.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/NormalMenuItem.cs @@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.PortableExecutable.Resource.Entries /// There is no fixed limit on the size of this string. /// [MarshalAs(UnmanagedType.LPWStr)] - public string NormalMenuText; + public string NormalMenuText = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/PopupMenuItem.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/PopupMenuItem.cs index 44989242..2a2a46ac 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/PopupMenuItem.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/PopupMenuItem.cs @@ -40,6 +40,6 @@ namespace SabreTools.Data.Models.PortableExecutable.Resource.Entries /// There is no fixed limit on the size of this string. /// [MarshalAs(UnmanagedType.LPWStr)] - public string PopupMenuText; + public string PopupMenuText = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringData.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringData.cs index a1fe1b2a..d2ff2cd1 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringData.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringData.cs @@ -64,7 +64,7 @@ /// set in the dwFileFlags member of the VS_FIXEDFILEINFO structure. For example, Value /// could be "Private build for Olivetti solving mouse problems on M250 and M250E computers". /// - public string Key { get; set; } + public string Key { get; set; } = string.Empty; /// /// As many zero words as necessary to align the Value member on a 32-bit boundary. @@ -74,6 +74,6 @@ /// /// A zero-terminated string. See the szKey member description for more information. /// - public string Value { get; set; } + public string Value { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringFileInfo.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringFileInfo.cs index 64cb4f02..9f1c5553 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringFileInfo.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringFileInfo.cs @@ -26,7 +26,7 @@ /// /// The Unicode string L"StringFileInfo". /// - public string? Key { get; set; } + public string Key { get; set; } = string.Empty; /// /// As many zero words as necessary to align the Children member on a 32-bit boundary. @@ -38,6 +38,6 @@ /// member indicates the appropriate language and code page for displaying the text in /// that StringTable structure. /// - public StringTable[] Children { get; set; } + public StringTable[] Children { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringTable.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringTable.cs index 89b34d6b..cffa3263 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringTable.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/StringTable.cs @@ -31,7 +31,7 @@ /// identifier contains two parts: the low-order 10 bits specify the major language, /// and the high-order 6 bits specify the sublanguage. /// - public string? Key { get; set; } + public string Key { get; set; } = string.Empty; /// /// As many zero words as necessary to align the Children member on a 32-bit boundary. @@ -41,6 +41,6 @@ /// /// An array of one or more StringData structures. /// - public StringData[] Children { get; set; } + public StringData[] Children { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarData.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarData.cs index 1fc7a4a9..68426cdd 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarData.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarData.cs @@ -26,7 +26,7 @@ /// /// The Unicode string L"Translation". /// - public string? Key { get; set; } + public string Key { get; set; } = string.Empty; /// /// As many zero words as necessary to align the Value member on a 32-bit boundary. @@ -45,6 +45,6 @@ /// independent. If the Var structure is omitted, the file will be interpreted as both /// language and code page independent. /// - public uint[] Value { get; set; } + public uint[] Value { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarFileInfo.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarFileInfo.cs index 880d0112..248cb28f 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarFileInfo.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VarFileInfo.cs @@ -26,7 +26,7 @@ /// /// The Unicode string L"VarFileInfo". /// - public string Key { get; set; } + public string Key { get; set; } = string.Empty; /// /// As many zero words as necessary to align the Children member on a 32-bit boundary. @@ -36,6 +36,6 @@ /// /// Typically contains a list of languages that the application or DLL supports. /// - public VarData[] Children { get; set; } + public VarData[] Children { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VersionInfo.cs b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VersionInfo.cs index 17618546..dcc8a9e7 100644 --- a/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VersionInfo.cs +++ b/SabreTools.Serialization/Models/PortableExecutable/Resource/Entries/VersionInfo.cs @@ -29,7 +29,7 @@ /// /// The Unicode string L"VS_VERSION_INFO". /// - public string Key { get; set; } + public string Key { get; set; } = string.Empty; /// /// Contains as many zero words as necessary to align the Value member on a 32-bit boundary. diff --git a/SabreTools.Serialization/Models/Quantum/Archive.cs b/SabreTools.Serialization/Models/Quantum/Archive.cs index b198c939..e747396d 100644 --- a/SabreTools.Serialization/Models/Quantum/Archive.cs +++ b/SabreTools.Serialization/Models/Quantum/Archive.cs @@ -9,12 +9,12 @@ namespace SabreTools.Data.Models.Quantum /// /// Quantum header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// This is immediately followed by the list of files /// - public FileDescriptor[] FileList { get; set; } + public FileDescriptor[] FileList { get; set; } = []; /// /// Immediately following the list of files is the compressed data diff --git a/SabreTools.Serialization/Models/Quantum/FileDescriptor.cs b/SabreTools.Serialization/Models/Quantum/FileDescriptor.cs index 51c89e35..00368b57 100644 --- a/SabreTools.Serialization/Models/Quantum/FileDescriptor.cs +++ b/SabreTools.Serialization/Models/Quantum/FileDescriptor.cs @@ -14,7 +14,7 @@ namespace SabreTools.Data.Models.Quantum /// /// File name, variable length string, not zero-terminated /// - public string FileName { get; set; } + public string FileName { get; set; } = string.Empty; /// /// Length of comment field @@ -24,7 +24,7 @@ namespace SabreTools.Data.Models.Quantum /// /// Comment field, variable length string, not zero-terminated /// - public string CommentField { get; set; } + public string CommentField { get; set; } = string.Empty; /// /// Fully expanded file size in bytes diff --git a/SabreTools.Serialization/Models/Quantum/Header.cs b/SabreTools.Serialization/Models/Quantum/Header.cs index ffb592a7..6ca9519a 100644 --- a/SabreTools.Serialization/Models/Quantum/Header.cs +++ b/SabreTools.Serialization/Models/Quantum/Header.cs @@ -13,7 +13,7 @@ namespace SabreTools.Data.Models.Quantum /// Quantum signature: 0x44 0x53 /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)] - public string Signature; + public string Signature = string.Empty; /// /// Quantum major version number diff --git a/SabreTools.Serialization/Models/SGA/Archive.cs b/SabreTools.Serialization/Models/SGA/Archive.cs index 4b444ae9..655844a3 100644 --- a/SabreTools.Serialization/Models/SGA/Archive.cs +++ b/SabreTools.Serialization/Models/SGA/Archive.cs @@ -7,13 +7,13 @@ namespace SabreTools.Data.Models.SGA public sealed class Archive { /// - ///Header data + /// Header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new Header4(); /// /// Directory data /// - public Directory Directory { get; set; } + public Directory Directory { get; set; } = new Directory4(); } } diff --git a/SabreTools.Serialization/Models/SGA/Directory.cs b/SabreTools.Serialization/Models/SGA/Directory.cs index 58b65ad5..4492a87b 100644 --- a/SabreTools.Serialization/Models/SGA/Directory.cs +++ b/SabreTools.Serialization/Models/SGA/Directory.cs @@ -8,7 +8,7 @@ namespace SabreTools.Data.Models.SGA /// /// Source SGA file /// - public Archive File { get; set; } + public Archive File { get; set; } = new(); } /// @@ -26,26 +26,26 @@ namespace SabreTools.Data.Models.SGA /// /// Directory header data /// - public TDirectoryHeader DirectoryHeader { get; set; } + public TDirectoryHeader? DirectoryHeader { get; set; } /// /// Sections data /// - public TSection[] Sections { get; set; } + public TSection[] Sections { get; set; } = []; /// /// Folders data /// - public TFolder[] Folders { get; set; } + public TFolder[] Folders { get; set; } = []; /// /// Files data /// - public TFile[] Files { get; set; } + public TFile[] Files { get; set; } = []; /// /// String table data /// - public Dictionary StringTable { get; set; } + public Dictionary StringTable { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/SGA/DirectoryHeader.cs b/SabreTools.Serialization/Models/SGA/DirectoryHeader.cs index a19914e3..b67284f1 100644 --- a/SabreTools.Serialization/Models/SGA/DirectoryHeader.cs +++ b/SabreTools.Serialization/Models/SGA/DirectoryHeader.cs @@ -11,18 +11,18 @@ namespace SabreTools.Data.Models.SGA { public uint SectionOffset { get; set; } - public T SectionCount { get; set; } + public T? SectionCount { get; set; } public uint FolderOffset { get; set; } - public T FolderCount { get; set; } + public T? FolderCount { get; set; } public uint FileOffset { get; set; } - public T FileCount { get; set; } + public T? FileCount { get; set; } public uint StringTableOffset { get; set; } - public T StringTableCount { get; set; } + public T? StringTableCount { get; set; } } } diff --git a/SabreTools.Serialization/Models/SGA/File.cs b/SabreTools.Serialization/Models/SGA/File.cs index b7aa0b5d..d7892b5e 100644 --- a/SabreTools.Serialization/Models/SGA/File.cs +++ b/SabreTools.Serialization/Models/SGA/File.cs @@ -5,7 +5,7 @@ namespace SabreTools.Data.Models.SGA { public uint NameOffset { get; set; } - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public uint Offset { get; set; } diff --git a/SabreTools.Serialization/Models/SGA/FileHeader.cs b/SabreTools.Serialization/Models/SGA/FileHeader.cs index 9adb7dec..1e673710 100644 --- a/SabreTools.Serialization/Models/SGA/FileHeader.cs +++ b/SabreTools.Serialization/Models/SGA/FileHeader.cs @@ -3,7 +3,7 @@ namespace SabreTools.Data.Models.SGA /// public sealed class FileHeader { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public uint CRC32 { get; set; } } diff --git a/SabreTools.Serialization/Models/SGA/Folder.cs b/SabreTools.Serialization/Models/SGA/Folder.cs index 57dd5453..ab509ce2 100644 --- a/SabreTools.Serialization/Models/SGA/Folder.cs +++ b/SabreTools.Serialization/Models/SGA/Folder.cs @@ -5,18 +5,18 @@ namespace SabreTools.Data.Models.SGA { public uint NameOffset { get; set; } - public string? Name { get; set; } + public string? Name { get; set; } = string.Empty; } /// public abstract class Folder : Folder where T : notnull { - public T FolderStartIndex { get; set; } + public T? FolderStartIndex { get; set; } - public T FolderEndIndex { get; set; } + public T? FolderEndIndex { get; set; } - public T FileStartIndex { get; set; } + public T? FileStartIndex { get; set; } - public T FileEndIndex { get; set; } + public T? FileEndIndex { get; set; } } } diff --git a/SabreTools.Serialization/Models/SGA/Header.cs b/SabreTools.Serialization/Models/SGA/Header.cs index 4cb48900..34bd2824 100644 --- a/SabreTools.Serialization/Models/SGA/Header.cs +++ b/SabreTools.Serialization/Models/SGA/Header.cs @@ -3,7 +3,7 @@ namespace SabreTools.Data.Models.SGA /// public abstract class Header { - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; public ushort MajorVersion { get; set; } diff --git a/SabreTools.Serialization/Models/SGA/Header4.cs b/SabreTools.Serialization/Models/SGA/Header4.cs index 5a48921b..8e46eb04 100644 --- a/SabreTools.Serialization/Models/SGA/Header4.cs +++ b/SabreTools.Serialization/Models/SGA/Header4.cs @@ -5,7 +5,7 @@ namespace SabreTools.Data.Models.SGA { public byte[] FileMD5 { get; set; } = new byte[0x10]; - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public byte[] HeaderMD5 { get; set; } = new byte[0x10]; diff --git a/SabreTools.Serialization/Models/SGA/Header6.cs b/SabreTools.Serialization/Models/SGA/Header6.cs index 3df2dec5..270534e2 100644 --- a/SabreTools.Serialization/Models/SGA/Header6.cs +++ b/SabreTools.Serialization/Models/SGA/Header6.cs @@ -3,7 +3,7 @@ namespace SabreTools.Data.Models.SGA /// public sealed class Header6 : Header { - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public uint HeaderLength { get; set; } diff --git a/SabreTools.Serialization/Models/SGA/Section.cs b/SabreTools.Serialization/Models/SGA/Section.cs index a54a8162..021f145b 100644 --- a/SabreTools.Serialization/Models/SGA/Section.cs +++ b/SabreTools.Serialization/Models/SGA/Section.cs @@ -3,22 +3,22 @@ namespace SabreTools.Data.Models.SGA /// public abstract class Section { - public string Alias { get; set; } + public string Alias { get; set; } = string.Empty; - public string Name { get; set; } + public string Name { get; set; } = string.Empty; } /// public abstract class Section : Section where T : notnull { - public T FolderStartIndex { get; set; } + public T? FolderStartIndex { get; set; } - public T FolderEndIndex { get; set; } + public T? FolderEndIndex { get; set; } - public T FileStartIndex { get; set; } + public T? FileStartIndex { get; set; } - public T FileEndIndex { get; set; } + public T? FileEndIndex { get; set; } - public T FolderRootIndex { get; set; } + public T? FolderRootIndex { get; set; } } } diff --git a/SabreTools.Serialization/Models/SecuROM/AddD.cs b/SabreTools.Serialization/Models/SecuROM/AddD.cs index 533c8f3b..2fb6371d 100644 --- a/SabreTools.Serialization/Models/SecuROM/AddD.cs +++ b/SabreTools.Serialization/Models/SecuROM/AddD.cs @@ -13,7 +13,7 @@ /// /// "AddD" /// - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// s /// Entry count @@ -24,13 +24,13 @@ /// Version, null-terminated /// /// Always 8 bytes? - public string Version { get; set; } + public string Version { get; set; } = string.Empty; /// /// Build number /// /// 4 bytes - public string Build { get; set; } + public string Build { get; set; } = string.Empty; /// /// Unknown @@ -44,7 +44,7 @@ /// /// 10 bytes, only present in 4.84.00.0054, 4.84.69.0037, 4.84.76.7966, 4.84.76.7968, 4.85.07.0009 /// - public string ProductId { get; set; } + public string ProductId { get; set; } = string.Empty; /// /// Unknown @@ -57,6 +57,6 @@ /// /// Entry table /// - public AddDEntry[] Entries { get; set; } + public AddDEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/SecuROM/AddDEntry.cs b/SabreTools.Serialization/Models/SecuROM/AddDEntry.cs index 6ee676ab..bdd10bc3 100644 --- a/SabreTools.Serialization/Models/SecuROM/AddDEntry.cs +++ b/SabreTools.Serialization/Models/SecuROM/AddDEntry.cs @@ -112,7 +112,7 @@ namespace SabreTools.Data.Models.SecuROM /// /// 12 bytes long in all samples [MarshalAs(UnmanagedType.LPStr)] - public string FileName; + public string FileName = string.Empty; /// /// Unknown (0x2C) diff --git a/SabreTools.Serialization/Models/SecuROM/DFAEntry.cs b/SabreTools.Serialization/Models/SecuROM/DFAEntry.cs index 00dd2c14..743db87a 100644 --- a/SabreTools.Serialization/Models/SecuROM/DFAEntry.cs +++ b/SabreTools.Serialization/Models/SecuROM/DFAEntry.cs @@ -9,7 +9,7 @@ namespace SabreTools.Data.Models.SecuROM /// /// Entry name, always 4 ASCII characters /// - public string? Name { get; set; } + public string Name { get; set; } = string.Empty; /// /// Length of the value in bytes @@ -19,6 +19,6 @@ namespace SabreTools.Data.Models.SecuROM /// /// Value of the entry whose length is given by /// - public byte[] Value { get; set; } + public byte[] Value { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/SecuROM/DFAFile.cs b/SabreTools.Serialization/Models/SecuROM/DFAFile.cs index 296f400e..0fb14984 100644 --- a/SabreTools.Serialization/Models/SecuROM/DFAFile.cs +++ b/SabreTools.Serialization/Models/SecuROM/DFAFile.cs @@ -22,6 +22,6 @@ namespace SabreTools.Data.Models.SecuROM /// /// All entries in the file /// - public DFAEntry[] Entries { get; set; } + public DFAEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/SecuROM/MatroshkaEntry.cs b/SabreTools.Serialization/Models/SecuROM/MatroshkaEntry.cs index cd59e531..d1414c5c 100644 --- a/SabreTools.Serialization/Models/SecuROM/MatroshkaEntry.cs +++ b/SabreTools.Serialization/Models/SecuROM/MatroshkaEntry.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.SecuROM /// Versions with key values either are 256 or 512 bytes. /// Stored as a string as the rest of the 256/512 bytes are just padding. /// - public string Path { get; set; } + public string Path { get; set; } = string.Empty; /// /// Type of the entry data @@ -60,6 +60,6 @@ namespace SabreTools.Data.Models.SecuROM /// /// The file data, stored as a byte array /// - public byte[] FileData { get; set; } + public byte[] FileData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/SecuROM/MatroshkaPackage.cs b/SabreTools.Serialization/Models/SecuROM/MatroshkaPackage.cs index a5c8747b..f4a61073 100644 --- a/SabreTools.Serialization/Models/SecuROM/MatroshkaPackage.cs +++ b/SabreTools.Serialization/Models/SecuROM/MatroshkaPackage.cs @@ -19,7 +19,7 @@ namespace SabreTools.Data.Models.SecuROM /// "MatR" /// /// 4 bytes - public string Signature { get; set; } + public string Signature { get; set; } = string.Empty; /// /// Number of internal entries @@ -81,6 +81,6 @@ namespace SabreTools.Data.Models.SecuROM /// /// Entries array whose length is given by /// - public MatroshkaEntry[] Entries { get; set; } + public MatroshkaEntry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/SpoonInstaller/FileEntry.cs b/SabreTools.Serialization/Models/SpoonInstaller/FileEntry.cs index 80071a92..4562b119 100644 --- a/SabreTools.Serialization/Models/SpoonInstaller/FileEntry.cs +++ b/SabreTools.Serialization/Models/SpoonInstaller/FileEntry.cs @@ -35,6 +35,6 @@ namespace SabreTools.Data.Models.SpoonInstaller /// /// ASCII filename /// - public string Filename { get; set; } + public string Filename { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Models/SpoonInstaller/SFX.cs b/SabreTools.Serialization/Models/SpoonInstaller/SFX.cs index 6fa7d77f..c4ac47a4 100644 --- a/SabreTools.Serialization/Models/SpoonInstaller/SFX.cs +++ b/SabreTools.Serialization/Models/SpoonInstaller/SFX.cs @@ -18,11 +18,11 @@ namespace SabreTools.Data.Models.SpoonInstaller /// /// 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; } = new(); } } diff --git a/SabreTools.Serialization/Models/StarForce/FileHeader.cs b/SabreTools.Serialization/Models/StarForce/FileHeader.cs index a4400a10..c9828ac3 100644 --- a/SabreTools.Serialization/Models/StarForce/FileHeader.cs +++ b/SabreTools.Serialization/Models/StarForce/FileHeader.cs @@ -12,6 +12,6 @@ /// File info (timestamps, size, data position, encrypted) /// /// Unknown format - public byte[] FileInfo { get; set; } + public byte[] FileInfo { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/StarForce/FileSystem.cs b/SabreTools.Serialization/Models/StarForce/FileSystem.cs index bd7dcf66..a9768235 100644 --- a/SabreTools.Serialization/Models/StarForce/FileSystem.cs +++ b/SabreTools.Serialization/Models/StarForce/FileSystem.cs @@ -18,16 +18,16 @@ /// /// Header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Files /// - public FileEntry[] Files { get; set; } + public FileEntry[] Files { get; set; } = []; /// /// File headers /// - public FileHeader[] FileHeaders { get; set; } + public FileHeader[] FileHeaders { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/TAR/Archive.cs b/SabreTools.Serialization/Models/TAR/Archive.cs index 52955e43..6ed48842 100644 --- a/SabreTools.Serialization/Models/TAR/Archive.cs +++ b/SabreTools.Serialization/Models/TAR/Archive.cs @@ -5,6 +5,6 @@ namespace SabreTools.Data.Models.TAR /// /// 1 or more entries /// - public Entry[] Entries { get; set; } + public Entry[] Entries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/TAR/Entry.cs b/SabreTools.Serialization/Models/TAR/Entry.cs index 6ce432b8..22560ba7 100644 --- a/SabreTools.Serialization/Models/TAR/Entry.cs +++ b/SabreTools.Serialization/Models/TAR/Entry.cs @@ -5,11 +5,11 @@ namespace SabreTools.Data.Models.TAR /// /// Entry header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// 0 or more blocks representing the content /// - public Block[] Blocks { get; set; } + public Block[] Blocks { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/TAR/Header.cs b/SabreTools.Serialization/Models/TAR/Header.cs index fdd2ed83..ccfc573d 100644 --- a/SabreTools.Serialization/Models/TAR/Header.cs +++ b/SabreTools.Serialization/Models/TAR/Header.cs @@ -10,49 +10,49 @@ namespace SabreTools.Data.Models.TAR /// File name without a forward slash /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)] - public string FileName; + public string FileName = string.Empty; /// /// File mode /// /// Octal string representation [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string Mode; + public string Mode = string.Empty; /// /// Owner's numeric user ID /// /// Octal string representation [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string UID; + public string UID = string.Empty; /// /// Owner's numeric group ID /// /// Octal string representation [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string GID; + public string GID = string.Empty; /// /// File size in bytes /// /// Octal string representation [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] - public string Size; + public string Size = string.Empty; /// /// Last modification time in numeric Unix time format /// /// Octal string representation [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 12)] - public string ModifiedTime; + public string ModifiedTime = string.Empty; /// /// Checksum for header record /// /// Octal string representation [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)] - public string Checksum; + public string Checksum = string.Empty; /// /// Link indicator (file type) / Type flag @@ -63,7 +63,7 @@ namespace SabreTools.Data.Models.TAR /// Linked path name or file name /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 100)] - public string LinkName; + public string LinkName = string.Empty; #region USTAR Extension diff --git a/SabreTools.Serialization/Models/VPK/DirectoryItem.cs b/SabreTools.Serialization/Models/VPK/DirectoryItem.cs index 7317868a..b276015b 100644 --- a/SabreTools.Serialization/Models/VPK/DirectoryItem.cs +++ b/SabreTools.Serialization/Models/VPK/DirectoryItem.cs @@ -4,14 +4,14 @@ namespace SabreTools.Data.Models.VPK /// public sealed class DirectoryItem { - public string Extension { get; set; } + public string Extension { get; set; } = string.Empty; - public string Path { get; set; } + public string Path { get; set; } = string.Empty; - public string Name { get; set; } + public string Name { get; set; } = string.Empty; - public DirectoryEntry DirectoryEntry { get; set; } + public DirectoryEntry DirectoryEntry { get; set; } = new(); - public byte[] PreloadData { get; set; } + public byte[] PreloadData { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/VPK/File.cs b/SabreTools.Serialization/Models/VPK/File.cs index d7ddf79f..bf61102a 100644 --- a/SabreTools.Serialization/Models/VPK/File.cs +++ b/SabreTools.Serialization/Models/VPK/File.cs @@ -9,7 +9,7 @@ namespace SabreTools.Data.Models.VPK /// /// Header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Extended header data @@ -26,6 +26,6 @@ namespace SabreTools.Data.Models.VPK /// /// Directory items data /// - public DirectoryItem[] DirectoryItems { get; set; } + public DirectoryItem[] DirectoryItems { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/VPK/SignatureSection.cs b/SabreTools.Serialization/Models/VPK/SignatureSection.cs index 412ecc1d..da37393e 100644 --- a/SabreTools.Serialization/Models/VPK/SignatureSection.cs +++ b/SabreTools.Serialization/Models/VPK/SignatureSection.cs @@ -14,7 +14,7 @@ namespace SabreTools.Data.Models.VPK /// /// /// - public byte[] PublicKey; + public byte[] PublicKey = []; /// /// Always seen as 128 (0x80) bytes @@ -24,6 +24,6 @@ namespace SabreTools.Data.Models.VPK /// /// /// - public byte[] Signature; + public byte[] Signature = []; } } diff --git a/SabreTools.Serialization/Models/WAD3/DirEntry.cs b/SabreTools.Serialization/Models/WAD3/DirEntry.cs index fe5b38fb..3071d07e 100644 --- a/SabreTools.Serialization/Models/WAD3/DirEntry.cs +++ b/SabreTools.Serialization/Models/WAD3/DirEntry.cs @@ -43,6 +43,6 @@ namespace SabreTools.Data.Models.WAD3 /// /// 16 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] - public string Name; + public string Name = string.Empty; } } diff --git a/SabreTools.Serialization/Models/WAD3/File.cs b/SabreTools.Serialization/Models/WAD3/File.cs index fa5f9c01..1e352674 100644 --- a/SabreTools.Serialization/Models/WAD3/File.cs +++ b/SabreTools.Serialization/Models/WAD3/File.cs @@ -9,16 +9,16 @@ namespace SabreTools.Data.Models.WAD3 /// /// Deserialized header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Deserialized dir entry data /// - public DirEntry[] DirEntries { get; set; } + public DirEntry[] DirEntries { get; set; } = []; /// /// Deserialized file entry data /// - public FileEntry[] FileEntries { get; set; } + public FileEntry[] FileEntries { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/WAD3/Font.cs b/SabreTools.Serialization/Models/WAD3/Font.cs index 99a062f1..80f14d90 100644 --- a/SabreTools.Serialization/Models/WAD3/Font.cs +++ b/SabreTools.Serialization/Models/WAD3/Font.cs @@ -35,6 +35,6 @@ namespace SabreTools.Data.Models.WAD3 /// The color palette for the mipmaps (always 256 * 3 = 768 for GoldSrc) /// /// [ColorsUsed][3] - public byte[][] Palette { get; set; } + public byte[][] Palette { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/WAD3/Header.cs b/SabreTools.Serialization/Models/WAD3/Header.cs index 7b4d229e..275034d6 100644 --- a/SabreTools.Serialization/Models/WAD3/Header.cs +++ b/SabreTools.Serialization/Models/WAD3/Header.cs @@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.WAD3 /// /// 4 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; /// /// Number of Directory entries diff --git a/SabreTools.Serialization/Models/WAD3/MipMap.cs b/SabreTools.Serialization/Models/WAD3/MipMap.cs index b1e52fe7..10b1d2bb 100644 --- a/SabreTools.Serialization/Models/WAD3/MipMap.cs +++ b/SabreTools.Serialization/Models/WAD3/MipMap.cs @@ -7,6 +7,6 @@ namespace SabreTools.Data.Models.WAD3 /// Raw image data. Each byte points to an index in the palette /// /// [width][height] - public byte[][] Data { get; set; } + public byte[][] Data { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/WAD3/MipTex.cs b/SabreTools.Serialization/Models/WAD3/MipTex.cs index cd5e6936..6ae85670 100644 --- a/SabreTools.Serialization/Models/WAD3/MipTex.cs +++ b/SabreTools.Serialization/Models/WAD3/MipTex.cs @@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.WAD3 /// /// 16 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)] - public string Name; + public string Name = string.Empty; /// /// Dimensions of the texture (must be divisible by 16) diff --git a/SabreTools.Serialization/Models/WAD3/QpicImage.cs b/SabreTools.Serialization/Models/WAD3/QpicImage.cs index 246a96ef..12255915 100644 --- a/SabreTools.Serialization/Models/WAD3/QpicImage.cs +++ b/SabreTools.Serialization/Models/WAD3/QpicImage.cs @@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.WAD3 /// Raw image data. Each byte points to an index in the palette /// /// [height][width] - public byte[][] Data { get; set; } + public byte[][] Data { get; set; } = []; /// /// Number of colors used in the palette (always 256 for GoldSrc) @@ -28,6 +28,6 @@ namespace SabreTools.Data.Models.WAD3 /// The color palette for the mipmaps (always 256 * 3 = 768 for GoldSrc) /// /// [ColorsUsed][3] - public byte[][] Palette { get; set; } + public byte[][] Palette { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/WiseInstaller/Actions/AddDirectoryToPath.cs b/SabreTools.Serialization/Models/WiseInstaller/Actions/AddDirectoryToPath.cs index 2dd1e17a..6f2015e4 100644 --- a/SabreTools.Serialization/Models/WiseInstaller/Actions/AddDirectoryToPath.cs +++ b/SabreTools.Serialization/Models/WiseInstaller/Actions/AddDirectoryToPath.cs @@ -31,6 +31,6 @@ namespace SabreTools.Data.Models.WiseInstaller.Actions /// Directory name to add to path /// /// May contain a variable name - public string Directory { get; set; } + public string? Directory { get; set; } } } diff --git a/SabreTools.Serialization/Models/WiseInstaller/Actions/NewEvent.cs b/SabreTools.Serialization/Models/WiseInstaller/Actions/NewEvent.cs index 9545aa4c..fca766e4 100644 --- a/SabreTools.Serialization/Models/WiseInstaller/Actions/NewEvent.cs +++ b/SabreTools.Serialization/Models/WiseInstaller/Actions/NewEvent.cs @@ -33,6 +33,6 @@ namespace SabreTools.Data.Models.WiseInstaller.Actions /// Padding bytes /// /// Either 0 or 6 bytes from samples - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/WiseInstaller/ScriptFile.cs b/SabreTools.Serialization/Models/WiseInstaller/ScriptFile.cs index 932e3d1a..9214f1f6 100644 --- a/SabreTools.Serialization/Models/WiseInstaller/ScriptFile.cs +++ b/SabreTools.Serialization/Models/WiseInstaller/ScriptFile.cs @@ -9,11 +9,11 @@ namespace SabreTools.Data.Models.WiseInstaller /// /// Script header /// - public ScriptHeader Header { get; set; } + public ScriptHeader Header { get; set; } = new(); /// /// States representing the state machine in order /// - public MachineState[] States { get; set; } + public MachineState[] States { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/WiseInstaller/ScriptHeader.cs b/SabreTools.Serialization/Models/WiseInstaller/ScriptHeader.cs index 65b0dc3f..3691ea9b 100644 --- a/SabreTools.Serialization/Models/WiseInstaller/ScriptHeader.cs +++ b/SabreTools.Serialization/Models/WiseInstaller/ScriptHeader.cs @@ -94,7 +94,7 @@ namespace SabreTools.Data.Models.WiseInstaller /// - 22 - Normal header data, all fields present /// - 31 - Long header data, all fields present /// - public byte[] VariableLengthData { get; set; } + public byte[] VariableLengthData { get; set; } = []; /// /// FTP URL for online downloading diff --git a/SabreTools.Serialization/Models/WiseInstaller/SectionHeader.cs b/SabreTools.Serialization/Models/WiseInstaller/SectionHeader.cs index f78ae994..1881168a 100644 --- a/SabreTools.Serialization/Models/WiseInstaller/SectionHeader.cs +++ b/SabreTools.Serialization/Models/WiseInstaller/SectionHeader.cs @@ -136,30 +136,30 @@ namespace SabreTools.Data.Models.WiseInstaller /// /// Byte array representing version. Byte array used due to unknown size and type for version. /// - public byte[] Version { get; set; } + public byte[] Version { get; set; } = []; /// /// String representing the WIS[etc].TMP string /// - public string TmpString { get; set; } + public string TmpString { get; set; } = string.Empty; /// /// String representing the GUID string. /// - public string GuidString { get; set; } + public string GuidString { get; set; } = string.Empty; /// /// String representing a version number. This isn't the version of the .WISE installer itself, as it is /// entirely inconsistent even within the same week. Likely refers to a version for what's being installed /// rather than the installer itself /// - public string NonWiseVersion { get; set; } + public string NonWiseVersion { get; set; } = string.Empty; /// /// Unknown. May also refer to a non-value for pre-78-offset executables and only a value for 78-offset-onwards /// ones. /// - public byte[] PreFontValue {get; set;} + public byte[] PreFontValue {get; set;} = []; /// /// Font size @@ -170,11 +170,11 @@ namespace SabreTools.Data.Models.WiseInstaller /// Byte array representing string lengths and info. Individual strings not predefined since number of strings /// will likely vary between many installers. /// - public byte[] PreStringValues { get; set; } + public byte[] PreStringValues { get; set; } = []; /// /// Strings for the section. Size and any breakup of strings currently unknown. /// - public byte[][] Strings { get; set; } + public byte[][] Strings { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/XZ/Archive.cs b/SabreTools.Serialization/Models/XZ/Archive.cs index b4cf3f23..7d43b8bd 100644 --- a/SabreTools.Serialization/Models/XZ/Archive.cs +++ b/SabreTools.Serialization/Models/XZ/Archive.cs @@ -6,21 +6,21 @@ namespace SabreTools.Data.Models.XZ /// /// Pre-blocks header /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Sequence of 0 or more blocks /// - public Block[] Blocks { get; set; } + public Block[] Blocks { get; set; } = []; /// /// Index structure /// - public Index Index { get; set; } + public Index Index { get; set; } = new(); /// /// Post-blocks footer /// - public Footer Footer { get; set; } + public Footer Footer { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/XZ/Block.cs b/SabreTools.Serialization/Models/XZ/Block.cs index 1ffde3ec..3ff4b2e8 100644 --- a/SabreTools.Serialization/Models/XZ/Block.cs +++ b/SabreTools.Serialization/Models/XZ/Block.cs @@ -40,13 +40,13 @@ namespace SabreTools.Data.Models.XZ /// The number of filter flags is given by the first two /// bits of /// - public FilterFlag[] FilterFlags { get; set; } + public FilterFlag[] FilterFlags { get; set; } = []; /// /// This field contains as many null byte as it is needed to make /// the Block Header have the size specified in Block Header Size. /// - public byte[] HeaderPadding { get; set; } + public byte[] HeaderPadding { get; set; } = []; /// /// The CRC32 is calculated over everything in the Block Header @@ -59,14 +59,14 @@ namespace SabreTools.Data.Models.XZ /// The format of Compressed Data depends on Block Flags and List /// of Filter Flags /// - public byte[] CompressedData { get; set; } + public byte[] CompressedData { get; set; } = []; /// /// Block Padding MUST contain 0-3 null bytes to make the size of /// the Block a multiple of four bytes. This can be needed when /// the size of Compressed Data is not a multiple of four. /// - public byte[] BlockPadding { get; set; } + public byte[] BlockPadding { get; set; } = []; /// /// The type and size of the Check field depends on which bits @@ -75,6 +75,6 @@ namespace SabreTools.Data.Models.XZ /// The Check, when used, is calculated from the original /// uncompressed data. /// - public byte[] Check { get; set; } + public byte[] Check { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/XZ/FilterFlags.cs b/SabreTools.Serialization/Models/XZ/FilterFlags.cs index a9622acc..820e007f 100644 --- a/SabreTools.Serialization/Models/XZ/FilterFlags.cs +++ b/SabreTools.Serialization/Models/XZ/FilterFlags.cs @@ -18,6 +18,6 @@ namespace SabreTools.Data.Models.XZ /// Properties of the filter whose length is given by /// /// - public byte[] Properties { get; set; } + public byte[] Properties { get; set; } = []; } } diff --git a/SabreTools.Serialization/Models/XZ/Index.cs b/SabreTools.Serialization/Models/XZ/Index.cs index 28033bf8..0a3cfb42 100644 --- a/SabreTools.Serialization/Models/XZ/Index.cs +++ b/SabreTools.Serialization/Models/XZ/Index.cs @@ -18,13 +18,13 @@ namespace SabreTools.Data.Models.XZ /// /// One record per block /// - public Record[] Records { get; set; } + public Record[] Records { get; set; } = []; /// /// This field MUST contain 0-3 null bytes to pad the Index to /// a multiple of four bytes. /// - public byte[] Padding { get; set; } + public byte[] Padding { get; set; } = []; /// /// The CRC32 is calculated over everything in the Index field diff --git a/SabreTools.Serialization/Models/XZP/DirectoryItem.cs b/SabreTools.Serialization/Models/XZP/DirectoryItem.cs index 0dc5a4dc..0d136251 100644 --- a/SabreTools.Serialization/Models/XZP/DirectoryItem.cs +++ b/SabreTools.Serialization/Models/XZP/DirectoryItem.cs @@ -7,7 +7,7 @@ namespace SabreTools.Data.Models.XZP public uint NameOffset { get; set; } - public string Name { get; set; } + public string Name { get; set; } = string.Empty; public uint TimeCreated { get; set; } } diff --git a/SabreTools.Serialization/Models/XZP/File.cs b/SabreTools.Serialization/Models/XZP/File.cs index e8268581..a87b5721 100644 --- a/SabreTools.Serialization/Models/XZP/File.cs +++ b/SabreTools.Serialization/Models/XZP/File.cs @@ -9,31 +9,31 @@ namespace SabreTools.Data.Models.XZP /// /// Header data /// - public Header Header { get; set; } + public Header Header { get; set; } = new(); /// /// Directory entries data /// - public DirectoryEntry[] DirectoryEntries { get; set; } + public DirectoryEntry[] DirectoryEntries { get; set; } = []; /// /// Preload directory entries data /// - public DirectoryEntry[] PreloadDirectoryEntries { get; set; } + public DirectoryEntry[] PreloadDirectoryEntries { get; set; } = []; /// /// Preload directory mappings data /// - public DirectoryMapping[] PreloadDirectoryMappings { get; set; } + public DirectoryMapping[] PreloadDirectoryMappings { get; set; } = []; /// /// Directory items data /// - public DirectoryItem[] DirectoryItems { get; set; } + public DirectoryItem[] DirectoryItems { get; set; } = []; /// /// Footer data /// - public Footer Footer { get; set; } + public Footer Footer { get; set; } = new(); } } diff --git a/SabreTools.Serialization/Models/XZP/Footer.cs b/SabreTools.Serialization/Models/XZP/Footer.cs index 43b7a4fb..60f4beeb 100644 --- a/SabreTools.Serialization/Models/XZP/Footer.cs +++ b/SabreTools.Serialization/Models/XZP/Footer.cs @@ -13,6 +13,6 @@ namespace SabreTools.Data.Models.XZP /// /// 4 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; } } diff --git a/SabreTools.Serialization/Models/XZP/Header.cs b/SabreTools.Serialization/Models/XZP/Header.cs index 76b16fb0..36288912 100644 --- a/SabreTools.Serialization/Models/XZP/Header.cs +++ b/SabreTools.Serialization/Models/XZP/Header.cs @@ -11,7 +11,7 @@ namespace SabreTools.Data.Models.XZP /// /// 4 bytes [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)] - public string Signature; + public string Signature = string.Empty; public uint Version; diff --git a/SabreTools.Serialization/Models/Xbox/XMID.cs b/SabreTools.Serialization/Models/Xbox/XMID.cs index c3241e9b..32a4a889 100644 --- a/SabreTools.Serialization/Models/Xbox/XMID.cs +++ b/SabreTools.Serialization/Models/Xbox/XMID.cs @@ -17,17 +17,17 @@ namespace SabreTools.Data.Models.Xbox /// /// 2-character publisher identifier /// - public string PublisherIdentifier { get; set; } + public string PublisherIdentifier { get; set; } = string.Empty; /// /// 3-character Game ID /// - public string GameID { get; set; } + public string GameID { get; set; } = string.Empty; /// /// 2-character Internal version number /// - public string VersionNumber { get; set; } + public string VersionNumber { get; set; } = string.Empty; /// /// 1-character Region identifier character diff --git a/SabreTools.Serialization/Models/Xbox/XeMID.cs b/SabreTools.Serialization/Models/Xbox/XeMID.cs index 3c23157a..227c0a54 100644 --- a/SabreTools.Serialization/Models/Xbox/XeMID.cs +++ b/SabreTools.Serialization/Models/Xbox/XeMID.cs @@ -22,7 +22,7 @@ namespace SabreTools.Data.Models.Xbox /// /// 2-character publisher identifier /// - public string PublisherIdentifier { get; set; } + public string PublisherIdentifier { get; set; } = string.Empty; /// /// 1-character Platform disc is made for, 2 indicates Xbox 360 @@ -32,12 +32,12 @@ namespace SabreTools.Data.Models.Xbox /// /// 3-character Game ID /// - public string GameID { get; set; } + public string GameID { get; set; } = string.Empty; /// /// 2-character Title-specific SKU /// - public string SKU { get; set; } + public string SKU { get; set; } = string.Empty; /// /// 1-character Region identifier character @@ -47,7 +47,7 @@ namespace SabreTools.Data.Models.Xbox /// /// 2-character Base version of executables, usually starts at 01 /// - public string BaseVersion { get; set; } + public string BaseVersion { get; set; } = string.Empty; /// /// 1-character Media subtype identifier @@ -57,11 +57,11 @@ namespace SabreTools.Data.Models.Xbox /// /// 2-character Disc number stored in [disc number][total discs] format /// - public string DiscNumberIdentifier { get; set; } + public string DiscNumberIdentifier { get; set; } = string.Empty; /// /// 8-hex-digit certification submission identifier; usually on test discs only /// - public string CertificationSubmissionIdentifier { get; set; } + public string CertificationSubmissionIdentifier { get; set; } = string.Empty; } } diff --git a/SabreTools.Serialization/Readers/AbstractSyntaxNotationOne.cs b/SabreTools.Serialization/Readers/AbstractSyntaxNotationOne.cs index cc15142c..5f9127df 100644 --- a/SabreTools.Serialization/Readers/AbstractSyntaxNotationOne.cs +++ b/SabreTools.Serialization/Readers/AbstractSyntaxNotationOne.cs @@ -81,7 +81,8 @@ namespace SabreTools.Serialization.Readers while (data.Position < currentIndex + (long)obj.Length) { var value = ParseTypeLengthValue(data); - valueList.Add(value); + if (value != null) + valueList.Add(value); } obj.Value = valueList.ToArray(); diff --git a/SabreTools.Serialization/Readers/BSP.cs b/SabreTools.Serialization/Readers/BSP.cs index 7ba55ee7..a2488ee2 100644 --- a/SabreTools.Serialization/Readers/BSP.cs +++ b/SabreTools.Serialization/Readers/BSP.cs @@ -67,7 +67,10 @@ namespace SabreTools.Serialization.Readers file.VerticesLump = ParseVerticesLump(data, lumpEntry.Offset, lumpEntry.Length); break; case LumpType.LUMP_VISIBILITY: - file.VisibilityLump = ParseVisibilityLump(data, lumpEntry.Offset, lumpEntry.Length); + var visiblityLump = ParseVisibilityLump(data, lumpEntry.Offset, lumpEntry.Length); + if (visiblityLump != null) + file.VisibilityLump = visiblityLump; + break; case LumpType.LUMP_NODES: file.NodesLump = ParseNodesLump(data, lumpEntry.Offset, lumpEntry.Length); @@ -387,7 +390,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_ENTITIES on success, null on error - private static EntitiesLump? ParseEntitiesLump(Stream data, int offset, int length) + private static EntitiesLump ParseEntitiesLump(Stream data, int offset, int length) { var entities = new List(); @@ -429,7 +432,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_PLANES on success, null on error - private static PlanesLump? ParsePlanesLump(Stream data, int offset, int length) + private static PlanesLump ParsePlanesLump(Stream data, int offset, int length) { var planes = new List(); while (data.Position < offset + length) @@ -446,7 +449,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_TEXTURES on success, null on error - private static TextureLump? ParseTextureLump(Stream data, int offset, int length) + private static TextureLump ParseTextureLump(Stream data, int offset, int length) { var lump = new TextureLump(); @@ -467,7 +470,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_VERTICES on success, null on error - private static VerticesLump? ParseVerticesLump(Stream data, int offset, int length) + private static VerticesLump ParseVerticesLump(Stream data, int offset, int length) { var vertices = new List(); while (data.Position < offset + length) @@ -513,7 +516,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_NODES on success, null on error - private static BspNodesLump? ParseNodesLump(Stream data, int offset, int length) + private static BspNodesLump ParseNodesLump(Stream data, int offset, int length) { var nodes = new List(); while (data.Position < offset + length) @@ -530,7 +533,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_TEXINFO on success, null on error - private static BspTexinfoLump? ParseTexinfoLump(Stream data, int offset, int length) + private static BspTexinfoLump ParseTexinfoLump(Stream data, int offset, int length) { var texinfos = new List(); while (data.Position < offset + length) @@ -547,7 +550,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_FACES on success, null on error - private static BspFacesLump? ParseFacesLump(Stream data, int offset, int length) + private static BspFacesLump ParseFacesLump(Stream data, int offset, int length) { var faces = new List(); while (data.Position < offset + length) @@ -564,7 +567,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LIGHTING on success, null on error - private static LightmapLump? ParseLightmapLump(Stream data, int offset, int length) + private static LightmapLump ParseLightmapLump(Stream data, int offset, int length) { var lump = new LightmapLump(); lump.Lightmap = new byte[length / 3][]; @@ -582,7 +585,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_CLIPNODES on success, null on error - private static ClipnodesLump? ParseClipnodesLump(Stream data, int offset, int length) + private static ClipnodesLump ParseClipnodesLump(Stream data, int offset, int length) { var clipnodes = new List(); while (data.Position < offset + length) @@ -599,7 +602,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LEAVES on success, null on error - private static BspLeavesLump? ParseLeavesLump(Stream data, int offset, int length) + private static BspLeavesLump ParseLeavesLump(Stream data, int offset, int length) { var leaves = new List(); while (data.Position < offset + length) @@ -616,7 +619,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_MARKSURFACES on success, null on error - private static MarksurfacesLump? ParseMarksurfacesLump(Stream data, int offset, int length) + private static MarksurfacesLump ParseMarksurfacesLump(Stream data, int offset, int length) { var marksurfaces = new List(); while (data.Position < offset + length) @@ -632,7 +635,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_EDGES on success, null on error - private static EdgesLump? ParseEdgesLump(Stream data, int offset, int length) + private static EdgesLump ParseEdgesLump(Stream data, int offset, int length) { var edges = new List(); while (data.Position < offset + length) @@ -649,7 +652,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_SURFEDGES on success, null on error - private static SurfedgesLump? ParseSurfedgesLump(Stream data, int offset, int length) + private static SurfedgesLump ParseSurfedgesLump(Stream data, int offset, int length) { var surfedges = new List(); while (data.Position < offset + length) @@ -665,7 +668,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_MODELS on success, null on error - private static BspModelsLump? ParseModelsLump(Stream data, int offset, int length) + private static BspModelsLump ParseModelsLump(Stream data, int offset, int length) { var models = new List(); while (data.Position < offset + length) diff --git a/SabreTools.Serialization/Readers/CFB.cs b/SabreTools.Serialization/Readers/CFB.cs index 8a5fd472..5fddb2fa 100644 --- a/SabreTools.Serialization/Readers/CFB.cs +++ b/SabreTools.Serialization/Readers/CFB.cs @@ -245,7 +245,7 @@ namespace SabreTools.Serialization.Readers var obj = new DirectoryEntry(); byte[] name = data.ReadBytes(64); - obj.Name = Encoding.Unicode.GetString(name).DecodeStreamName()?.TrimEnd('\0'); + obj.Name = Encoding.Unicode.GetString(name).DecodeStreamName()?.TrimEnd('\0') ?? string.Empty; obj.NameLength = data.ReadUInt16LittleEndian(); obj.ObjectType = (ObjectType)data.ReadByteValue(); obj.ColorFlag = (ColorFlag)data.ReadByteValue(); diff --git a/SabreTools.Serialization/Readers/GZip.cs b/SabreTools.Serialization/Readers/GZip.cs index b2628deb..c6b10829 100644 --- a/SabreTools.Serialization/Readers/GZip.cs +++ b/SabreTools.Serialization/Readers/GZip.cs @@ -38,7 +38,7 @@ namespace SabreTools.Serialization.Readers #region Trailer var trailer = ParseTrailer(data); - if (header == null) + if (trailer == null) return null; archive.Trailer = trailer; diff --git a/SabreTools.Serialization/Readers/ISO9660.cs b/SabreTools.Serialization/Readers/ISO9660.cs index 2af9e6fc..4859f9d1 100644 --- a/SabreTools.Serialization/Readers/ISO9660.cs +++ b/SabreTools.Serialization/Readers/ISO9660.cs @@ -811,7 +811,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled DirectoryRecordDateTime on success, null on error - public static DirectoryRecordDateTime? ParseDirectoryRecordDateTime(Stream data) + public static DirectoryRecordDateTime ParseDirectoryRecordDateTime(Stream data) { var obj = new DirectoryRecordDateTime(); diff --git a/SabreTools.Serialization/Readers/InstallShieldArchiveV3.cs b/SabreTools.Serialization/Readers/InstallShieldArchiveV3.cs index e66e979a..a710e3ef 100644 --- a/SabreTools.Serialization/Readers/InstallShieldArchiveV3.cs +++ b/SabreTools.Serialization/Readers/InstallShieldArchiveV3.cs @@ -125,11 +125,11 @@ namespace SabreTools.Serialization.Readers obj.DateTime = data.ReadUInt32LittleEndian(); obj.Reserved0 = data.ReadUInt32LittleEndian(); obj.ChunkSize = data.ReadUInt16LittleEndian(); - obj.Attrib = (Data.Models.InstallShieldArchiveV3.Attributes)data.ReadByteValue(); + obj.Attrib = (Attributes)data.ReadByteValue(); obj.IsSplit = data.ReadByteValue(); obj.Reserved1 = data.ReadByteValue(); obj.VolumeStart = data.ReadByteValue(); - obj.Name = data.ReadPrefixedAnsiString(); + obj.Name = data.ReadPrefixedAnsiString() ?? string.Empty; return obj; } diff --git a/SabreTools.Serialization/Readers/InstallShieldCabinet.cs b/SabreTools.Serialization/Readers/InstallShieldCabinet.cs index 249bd175..fa0fb731 100644 --- a/SabreTools.Serialization/Readers/InstallShieldCabinet.cs +++ b/SabreTools.Serialization/Readers/InstallShieldCabinet.cs @@ -395,9 +395,9 @@ namespace SabreTools.Serialization.Readers // Read the string if (majorVersion >= 17) - obj.Identifier = data.ReadNullTerminatedUnicodeString(); + obj.Identifier = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - obj.Identifier = data.ReadNullTerminatedAnsiString(); + obj.Identifier = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Read the display name, if possible @@ -408,9 +408,9 @@ namespace SabreTools.Serialization.Readers // Read the string if (majorVersion >= 17) - obj.DisplayName = data.ReadNullTerminatedUnicodeString(); + obj.DisplayName = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - obj.DisplayName = data.ReadNullTerminatedAnsiString(); + obj.DisplayName = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Read the name, if possible @@ -421,9 +421,9 @@ namespace SabreTools.Serialization.Readers // Read the string if (majorVersion >= 17) - obj.Name = data.ReadNullTerminatedUnicodeString(); + obj.Name = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - obj.Name = data.ReadNullTerminatedAnsiString(); + obj.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Read the CLSID, if possible @@ -584,9 +584,9 @@ namespace SabreTools.Serialization.Readers // Read the string if (majorVersion >= 17) - obj.Name = data.ReadNullTerminatedUnicodeString(); + obj.Name = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - obj.Name = data.ReadNullTerminatedAnsiString(); + obj.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Seek back to the correct offset @@ -642,9 +642,9 @@ namespace SabreTools.Serialization.Readers // Read the string if (majorVersion >= 17) - obj.Name = data.ReadNullTerminatedUnicodeString(); + obj.Name = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - obj.Name = data.ReadNullTerminatedAnsiString(); + obj.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Seek back to the correct offset @@ -676,9 +676,9 @@ namespace SabreTools.Serialization.Readers // Read the string if (majorVersion >= 17) - obj.Name = data.ReadNullTerminatedUnicodeString(); + obj.Name = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - obj.Name = data.ReadNullTerminatedAnsiString(); + obj.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; // Seek back to the correct offset data.SeekIfPossible(currentOffset, SeekOrigin.Begin); diff --git a/SabreTools.Serialization/Readers/InstallShieldExecutableFile.cs b/SabreTools.Serialization/Readers/InstallShieldExecutableFile.cs index ee4b427d..2f23e496 100644 --- a/SabreTools.Serialization/Readers/InstallShieldExecutableFile.cs +++ b/SabreTools.Serialization/Readers/InstallShieldExecutableFile.cs @@ -37,26 +37,29 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled FileEntry on success, null on error - public static FileEntry? ParseFileEntry(Stream? data) + public static FileEntry? ParseFileEntry(Stream data) { - var obj = new FileEntry(); - - obj.Name = data.ReadNullTerminatedAnsiString(); - if (obj.Name == null) + string? name = data.ReadNullTerminatedAnsiString(); + if (name == null) return null; - obj.Path = data.ReadNullTerminatedAnsiString(); - if (obj.Path == null) + string? path = data.ReadNullTerminatedAnsiString(); + if (path == null) return null; - obj.Version = data.ReadNullTerminatedAnsiString(); - if (obj.Version == null) + string? version = data.ReadNullTerminatedAnsiString(); + if (version == null) return null; var lengthString = data.ReadNullTerminatedAnsiString(); if (lengthString == null || !ulong.TryParse(lengthString, out var lengthValue)) return null; + var obj = new FileEntry(); + + obj.Name = name; + obj.Path = path; + obj.Version = version; obj.Length = lengthValue; return obj; diff --git a/SabreTools.Serialization/Readers/MicrosoftCabinet.cs b/SabreTools.Serialization/Readers/MicrosoftCabinet.cs index 59107f48..875f35a7 100644 --- a/SabreTools.Serialization/Readers/MicrosoftCabinet.cs +++ b/SabreTools.Serialization/Readers/MicrosoftCabinet.cs @@ -234,9 +234,9 @@ namespace SabreTools.Serialization.Readers #else if (file.Attributes.HasFlag(Data.Models.MicrosoftCabinet.FileAttributes.NAME_IS_UTF)) #endif - file.Name = data.ReadNullTerminatedUnicodeString(); + file.Name = data.ReadNullTerminatedUnicodeString() ?? string.Empty; else - file.Name = data.ReadNullTerminatedAnsiString(); + file.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; return file; } diff --git a/SabreTools.Serialization/Readers/N3DS.cs b/SabreTools.Serialization/Readers/N3DS.cs index 82ca6581..46423539 100644 --- a/SabreTools.Serialization/Readers/N3DS.cs +++ b/SabreTools.Serialization/Readers/N3DS.cs @@ -322,7 +322,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled initial data on success, null on error - public static InitialData? ParseInitialData(Stream data) + public static InitialData ParseInitialData(Stream data) { var obj = new InitialData(); diff --git a/SabreTools.Serialization/Readers/NewExecutable.cs b/SabreTools.Serialization/Readers/NewExecutable.cs index 6addd53d..5f2b9957 100644 --- a/SabreTools.Serialization/Readers/NewExecutable.cs +++ b/SabreTools.Serialization/Readers/NewExecutable.cs @@ -439,7 +439,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled RelocationRecord on success, null on error - public static RelocationRecord ParseRelocationRecord(Stream data) + public static RelocationRecord? ParseRelocationRecord(Stream data) { // Handle partial relocation sections if (data.Position > data.Length - 4) diff --git a/SabreTools.Serialization/Readers/PortableExecutable.cs b/SabreTools.Serialization/Readers/PortableExecutable.cs index 36053e1e..c501da43 100644 --- a/SabreTools.Serialization/Readers/PortableExecutable.cs +++ b/SabreTools.Serialization/Readers/PortableExecutable.cs @@ -142,7 +142,7 @@ namespace SabreTools.Serialization.Readers int tableSize = (int)optionalHeader.ExportTable.Size; // Read the table data - byte[]? tableData = data.ReadFrom(offset, tableSize, retainPosition: true); + byte[]? tableData = data.ReadFrom(offset, tableSize, retainPosition: true) ?? []; // Parse the export directory table int tableDataOffset = 0; @@ -160,7 +160,7 @@ namespace SabreTools.Serialization.Readers if (offset > initialOffset && offset < data.Length) { data.SeekIfPossible(offset, SeekOrigin.Begin); - exportDirectoryTable.Name = data.ReadNullTerminatedAnsiString(); + exportDirectoryTable.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Address table @@ -215,7 +215,7 @@ namespace SabreTools.Serialization.Readers int tableSize = (int)optionalHeader.ImportTable.Size; // Read the table data - byte[]? tableData = data.ReadFrom(offset, tableSize, retainPosition: true); + byte[]? tableData = data.ReadFrom(offset, tableSize, retainPosition: true) ?? []; // Parse the import directory table int tableDataOffset = 0; @@ -247,7 +247,7 @@ namespace SabreTools.Serialization.Readers if (nameOffset != initialOffset) { data.SeekIfPossible(nameOffset, SeekOrigin.Begin); - entry.Name = data.ReadNullTerminatedAnsiString(); + entry.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; } } @@ -309,8 +309,8 @@ namespace SabreTools.Serialization.Readers tableSize = (int)Math.Min(tableSize, data.Length - offset); // Read the table data - byte[]? tableData = data.ReadFrom(offset, tableSize, retainPosition: true); - if (tableData != null && tableData.Length < optionalHeader.ResourceTable.Size) + byte[] tableData = data.ReadFrom(offset, tableSize, retainPosition: true) ?? []; + if (tableData.Length > 0 && tableData.Length < optionalHeader.ResourceTable.Size) Array.Resize(ref tableData, (int)optionalHeader.ResourceTable.Size); // Set the resource directory table @@ -1016,7 +1016,9 @@ namespace SabreTools.Serialization.Readers var obj = new Data.Models.PortableExecutable.Import.HintNameTableEntry(); obj.Hint = data.ReadUInt16LittleEndian(); - obj.Name = data.ReadNullTerminatedAnsiString(); + string? name = data.ReadNullTerminatedAnsiString(); + if (name != null) + obj.Name = name; return obj; } @@ -1465,7 +1467,9 @@ namespace SabreTools.Serialization.Readers // Otherwise, read from the data stream else if (nextOffset + entry.DataEntry.Size <= data.Length) { - entry.DataEntry.Data = data.ReadFrom(nextOffset + initialOffset, (int)entry.DataEntry.Size, retainPosition: true); + byte[]? entryData = data.ReadFrom(nextOffset + initialOffset, (int)entry.DataEntry.Size, retainPosition: true); + if (entryData != null) + entry.DataEntry.Data = entryData; } } diff --git a/SabreTools.Serialization/Readers/SGA.cs b/SabreTools.Serialization/Readers/SGA.cs index a05fce01..04a8de52 100644 --- a/SabreTools.Serialization/Readers/SGA.cs +++ b/SabreTools.Serialization/Readers/SGA.cs @@ -246,7 +246,7 @@ namespace SabreTools.Serialization.Readers // TODO: If indexed by position, I think it needs to be adjusted by start of table // Create the strings dictionary - directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); + directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); // Get the current position to adjust the offsets long stringTableStart = data.Position; @@ -255,7 +255,7 @@ namespace SabreTools.Serialization.Readers for (int i = 0; i < directoryHeader.StringTableCount; i++) { long currentPosition = data.Position - stringTableStart; - directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString(); + directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Loop through all folders to assign names @@ -392,7 +392,7 @@ namespace SabreTools.Serialization.Readers // TODO: If indexed by position, I think it needs to be adjusted by start of table // Create the strings dictionary - directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); + directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); // Get the current position to adjust the offsets long stringTableStart = data.Position; @@ -401,7 +401,7 @@ namespace SabreTools.Serialization.Readers for (int i = 0; i < directoryHeader.StringTableCount; i++) { long currentPosition = data.Position - stringTableStart; - directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString(); + directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Loop through all folders to assign names @@ -538,7 +538,7 @@ namespace SabreTools.Serialization.Readers // TODO: If indexed by position, I think it needs to be adjusted by start of table // Create the strings dictionary - directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); + directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); // Get the current position to adjust the offsets long stringTableStart = data.Position; @@ -547,7 +547,7 @@ namespace SabreTools.Serialization.Readers for (int i = 0; i < directoryHeader.StringTableCount; i++) { long currentPosition = data.Position - stringTableStart; - directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString(); + directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Loop through all folders to assign names @@ -684,7 +684,7 @@ namespace SabreTools.Serialization.Readers // TODO: If indexed by position, I think it needs to be adjusted by start of table // Create the strings dictionary - directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); + directory.StringTable = new Dictionary((int)directoryHeader.StringTableCount); // Get the current position to adjust the offsets long stringTableStart = data.Position; @@ -693,7 +693,7 @@ namespace SabreTools.Serialization.Readers for (int i = 0; i < directoryHeader.StringTableCount; i++) { long currentPosition = data.Position - stringTableStart; - directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString(); + directory.StringTable[currentPosition] = data.ReadNullTerminatedAnsiString() ?? string.Empty; } // Loop through all folders to assign names @@ -883,7 +883,7 @@ namespace SabreTools.Serialization.Readers var file4 = new File4(); file4.NameOffset = data.ReadUInt32LittleEndian(); - file4.Name = null; // Read from string table + file4.Name = string.Empty; // Read from string table file4.Offset = data.ReadUInt32LittleEndian(); file4.SizeOnDisk = data.ReadUInt32LittleEndian(); file4.Size = data.ReadUInt32LittleEndian(); @@ -905,7 +905,7 @@ namespace SabreTools.Serialization.Readers var file6 = new File6(); file6.NameOffset = data.ReadUInt32LittleEndian(); - file6.Name = null; // Read from string table + file6.Name = string.Empty; // Read from string table file6.Offset = data.ReadUInt32LittleEndian(); file6.SizeOnDisk = data.ReadUInt32LittleEndian(); file6.Size = data.ReadUInt32LittleEndian(); @@ -928,7 +928,7 @@ namespace SabreTools.Serialization.Readers var file7 = new File7(); file7.NameOffset = data.ReadUInt32LittleEndian(); - file7.Name = null; // Read from string table + file7.Name = string.Empty; // Read from string table file7.Offset = data.ReadUInt32LittleEndian(); file7.SizeOnDisk = data.ReadUInt32LittleEndian(); file7.Size = data.ReadUInt32LittleEndian(); diff --git a/SabreTools.Serialization/Readers/SecuROMAddD.cs b/SabreTools.Serialization/Readers/SecuROMAddD.cs index e1a41027..c593438a 100644 --- a/SabreTools.Serialization/Readers/SecuROMAddD.cs +++ b/SabreTools.Serialization/Readers/SecuROMAddD.cs @@ -46,7 +46,7 @@ namespace SabreTools.Serialization.Readers byte[] signatureBytes = data.ReadBytes(4); obj.Signature = Encoding.ASCII.GetString(signatureBytes); obj.EntryCount = data.ReadUInt32LittleEndian(); - obj.Version = data.ReadNullTerminatedAnsiString(); + obj.Version = data.ReadNullTerminatedAnsiString() ?? string.Empty; byte[] buildBytes = data.ReadBytes(4); obj.Build = Encoding.ASCII.GetString(buildBytes); obj.Unknown1 = data.ReadBytes(44); @@ -92,7 +92,7 @@ namespace SabreTools.Serialization.Readers obj.Unknown14h = data.ReadUInt32LittleEndian(); obj.Unknown18h = data.ReadUInt32LittleEndian(); obj.Unknown1Ch = data.ReadUInt32LittleEndian(); - obj.FileName = data.ReadNullTerminatedAnsiString(); + obj.FileName = data.ReadNullTerminatedAnsiString() ?? string.Empty; obj.Unknown2Ch = data.ReadUInt32LittleEndian(); return obj; diff --git a/SabreTools.Serialization/Readers/VBSP.cs b/SabreTools.Serialization/Readers/VBSP.cs index 59628ae2..7eefc16e 100644 --- a/SabreTools.Serialization/Readers/VBSP.cs +++ b/SabreTools.Serialization/Readers/VBSP.cs @@ -311,7 +311,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_ENTITIES on success, null on error - private static EntitiesLump? ParseEntitiesLump(Stream data, int offset, int length) + private static EntitiesLump ParseEntitiesLump(Stream data, int offset, int length) { var entities = new List(); @@ -353,7 +353,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_PLANES on success, null on error - private static PlanesLump? ParsePlanesLump(Stream data, int offset, int length) + private static PlanesLump ParsePlanesLump(Stream data, int offset, int length) { var planes = new List(); while (data.Position < offset + length) @@ -371,7 +371,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_TEXDATA on success, null on error - private static TexdataLump? ParseTexdataLump(Stream data, int offset, int length) + private static TexdataLump ParseTexdataLump(Stream data, int offset, int length) { var texdatas = new List(); while (data.Position < offset + length) @@ -389,7 +389,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_VERTEXES on success, null on error - private static VerticesLump? ParseVerticesLump(Stream data, int offset, int length) + private static VerticesLump ParseVerticesLump(Stream data, int offset, int length) { var vertices = new List(); while (data.Position < offset + length) @@ -409,7 +409,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_VISIBILITY on success, null on error - private static VisibilityLump? ParseVisibilityLump(Stream data, int offset, int length) + private static VisibilityLump ParseVisibilityLump(Stream data, int offset, int length) { var lump = new VisibilityLump(); @@ -432,7 +432,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_NODES on success, null on error - private static VbspNodesLump? ParseNodesLump(Stream data, int offset, int length) + private static VbspNodesLump ParseNodesLump(Stream data, int offset, int length) { var nodes = new List(); while (data.Position < offset + length) @@ -450,7 +450,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_TEXINFO on success, null on error - private static VbspTexinfoLump? ParseTexinfoLump(Stream data, int offset, int length) + private static VbspTexinfoLump ParseTexinfoLump(Stream data, int offset, int length) { var texinfos = new List(); while (data.Position < offset + length) @@ -468,7 +468,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_FACES / LUMP_ORIGINALFACES on success, null on error - private static VbspFacesLump? ParseFacesLump(Stream data, int offset, int length) + private static VbspFacesLump ParseFacesLump(Stream data, int offset, int length) { var faces = new List(); while (data.Position < offset + length) @@ -486,7 +486,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_PHYSCOLLIDE on success, null on error - private static PhysCollideLump? ParsePhysCollideLump(Stream data, int offset, int length) + private static PhysCollideLump ParsePhysCollideLump(Stream data, int offset, int length) { var models = new List(); while (data.Position < offset + length) @@ -504,7 +504,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled PhysModel on success, null on error - private static PhysModel? ParsePhysModel(Stream data) + private static PhysModel ParsePhysModel(Stream data) { var model = new PhysModel(); @@ -528,7 +528,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled PhysSolid on success, null on error - private static PhysSolid? ParsePhysSolid(Stream data) + private static PhysSolid ParsePhysSolid(Stream data) { var solid = new PhysSolid(); @@ -544,7 +544,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LIGHTING on success, null on error - private static LightmapLump? ParseLightmapLump(Stream data, int offset, int length) + private static LightmapLump ParseLightmapLump(Stream data, int offset, int length) { var lump = new LightmapLump(); lump.Lightmap = new byte[length / 3][]; @@ -562,7 +562,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_OCCLUSION on success, null on error - private static OcclusionLump? ParseOcclusionLump(Stream data, int offset, int length) + private static OcclusionLump ParseOcclusionLump(Stream data, int offset, int length) { var lump = new OcclusionLump(); @@ -597,7 +597,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LEAVES on success, null on error - private static VbspLeavesLump? ParseLeavesLump(Stream data, uint version, int offset, int length) + private static VbspLeavesLump ParseLeavesLump(Stream data, uint version, int offset, int length) { var leaves = new List(); while (data.Position < offset + length) @@ -615,7 +615,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled VbspLeaf on success, null on error - private static VbspLeaf? ParseVbspLeaf(Stream data, uint version) + private static VbspLeaf ParseVbspLeaf(Stream data, uint version) { var leaf = new VbspLeaf(); @@ -639,7 +639,7 @@ namespace SabreTools.Serialization.Readers leaf.LeafWaterDataID = data.ReadInt16LittleEndian(); if (version == 1) - leaf.AmbientLighting = data.ReadType(); + leaf.AmbientLighting = data.ReadType() ?? new(); else leaf.Padding = data.ReadInt16LittleEndian(); @@ -651,7 +651,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_FACEIDS on success, null on error - private static MarksurfacesLump? ParseMarksurfacesLump(Stream data, int offset, int length) + private static MarksurfacesLump ParseMarksurfacesLump(Stream data, int offset, int length) { var marksurfaces = new List(); while (data.Position < offset + length) @@ -667,7 +667,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_EDGES on success, null on error - private static EdgesLump? ParseEdgesLump(Stream data, int offset, int length) + private static EdgesLump ParseEdgesLump(Stream data, int offset, int length) { var edges = new List(); while (data.Position < offset + length) @@ -685,7 +685,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_SURFEDGES on success, null on error - private static SurfedgesLump? ParseSurfedgesLump(Stream data, int offset, int length) + private static SurfedgesLump ParseSurfedgesLump(Stream data, int offset, int length) { var surfedges = new List(); while (data.Position < offset + length) @@ -701,7 +701,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_MODELS on success, null on error - private static VbspModelsLump? ParseModelsLump(Stream data, int offset, int length) + private static VbspModelsLump ParseModelsLump(Stream data, int offset, int length) { var models = new List(); while (data.Position < offset + length) @@ -719,7 +719,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_WORLDLIGHTS / LUMP_WORLDLIGHTS_HDR on success, null on error - private static WorldLightsLump? ParseWorldLightsLump(Stream data, int offset, int length) + private static WorldLightsLump ParseWorldLightsLump(Stream data, int offset, int length) { var worldLights = new List(); while (data.Position < offset + length) @@ -737,7 +737,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LEAFFACES on success, null on error - private static LeafFacesLump? ParseLeafFacesLump(Stream data, int offset, int length) + private static LeafFacesLump ParseLeafFacesLump(Stream data, int offset, int length) { var map = new List(); while (data.Position < offset + length) @@ -753,7 +753,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LEAFBRUSHES on success, null on error - private static LeafBrushesLump? ParseLeafBrushesLump(Stream data, int offset, int length) + private static LeafBrushesLump ParseLeafBrushesLump(Stream data, int offset, int length) { var map = new List(); while (data.Position < offset + length) @@ -769,7 +769,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_BRUSHES on success, null on error - private static BrushesLump? ParseBrushesLump(Stream data, int offset, int length) + private static BrushesLump ParseBrushesLump(Stream data, int offset, int length) { var brushes = new List(); while (data.Position < offset + length) @@ -787,7 +787,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_BRUSHSIDES on success, null on error - private static BrushsidesLump? ParseBrushsidesLump(Stream data, int offset, int length) + private static BrushsidesLump ParseBrushsidesLump(Stream data, int offset, int length) { var brushsides = new List(); while (data.Position < offset + length) @@ -805,7 +805,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_DISPINFO on success, null on error - private static DispInfosLump? ParseDispInfosLump(Stream data, int offset, int length) + private static DispInfosLump ParseDispInfosLump(Stream data, int offset, int length) { var dispInfos = new List(); while (data.Position < offset + length) @@ -823,7 +823,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_DISP_VERTS on success, null on error - private static DispVertsLump? ParseDispVertsLump(Stream data, int offset, int length) + private static DispVertsLump ParseDispVertsLump(Stream data, int offset, int length) { var verts = new List(); while (data.Position < offset + length) @@ -841,7 +841,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_GAME_LUMP on success, null on error - private static GameLump? ParseGameLump(Stream data, int offset, int length) + private static GameLump ParseGameLump(Stream data, int offset, int length) { var lump = new GameLump(); @@ -862,7 +862,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_CUBEMAPS on success, null on error - private static CubemapsLump? ParseCubemapsLump(Stream data, int offset, int length) + private static CubemapsLump ParseCubemapsLump(Stream data, int offset, int length) { var cubemaps = new List(); while (data.Position < offset + length) @@ -880,7 +880,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_PAKFILE on success, null on error - private static PakfileLump? ParsePakfileLump(Stream data, int offset, int length) + private static PakfileLump ParsePakfileLump(Stream data, int offset, int length) { var lump = new PakfileLump(); @@ -894,7 +894,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_TEXDATA_STRING_DATA on success, null on error - private static TexdataStringData? ParseTexdataStringData(Stream data, int offset, int length) + private static TexdataStringData ParseTexdataStringData(Stream data, int offset, int length) { var strings = new List(); while (data.Position < offset + length) @@ -912,7 +912,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_TEXDATA_STRING_TABLE on success, null on error - private static TexdataStringTable? ParseTexdataStringTable(Stream data, int offset, int length) + private static TexdataStringTable ParseTexdataStringTable(Stream data, int offset, int length) { var offsets = new List(); while (data.Position < offset + length) @@ -928,7 +928,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_OVERLAYS on success, null on error - private static OverlaysLump? ParseOverlaysLump(Stream data, int offset, int length) + private static OverlaysLump ParseOverlaysLump(Stream data, int offset, int length) { var overlays = new List(); while (data.Position < offset + length) @@ -946,7 +946,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_DISP_TRIS on success, null on error - private static DispTrisLump? ParseDispTrisLump(Stream data, int offset, int length) + private static DispTrisLump ParseDispTrisLump(Stream data, int offset, int length) { var tris = new List(); while (data.Position < offset + length) @@ -964,7 +964,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LIGHTMAPPAGES / LUMP_LEAF_AMBIENT_INDEX_HDR / LUMP_LIGHTMAPPAGEINFOS / LUMP_LEAF_AMBIENT_INDEX on success, null on error - private static AmbientIndexLump? ParseAmbientIndexLump(Stream data, int offset, int length) + private static AmbientIndexLump ParseAmbientIndexLump(Stream data, int offset, int length) { var indicies = new List(); while (data.Position < offset + length) @@ -982,7 +982,7 @@ namespace SabreTools.Serialization.Readers /// /// Stream to parse /// Filled LUMP_LEAF_AMBIENT_LIGHTING_HDR / LUMP_LEAF_AMBIENT_LIGHTING on success, null on error - private static AmbientLightingLump? ParseAmbientLightingLump(Stream data, int offset, int length) + private static AmbientLightingLump ParseAmbientLightingLump(Stream data, int offset, int length) { var lightings = new List(); while (data.Position < offset + length) diff --git a/SabreTools.Serialization/Readers/VPK.cs b/SabreTools.Serialization/Readers/VPK.cs index d10ee229..1995f21a 100644 --- a/SabreTools.Serialization/Readers/VPK.cs +++ b/SabreTools.Serialization/Readers/VPK.cs @@ -174,7 +174,7 @@ namespace SabreTools.Serialization.Readers } // Set the preload data - obj.PreloadData = preloadData; + obj.PreloadData = preloadData ?? []; return obj; } diff --git a/SabreTools.Serialization/Readers/WiseSectionHeader.cs b/SabreTools.Serialization/Readers/WiseSectionHeader.cs index 7726afd1..71e416eb 100644 --- a/SabreTools.Serialization/Readers/WiseSectionHeader.cs +++ b/SabreTools.Serialization/Readers/WiseSectionHeader.cs @@ -132,8 +132,8 @@ namespace SabreTools.Serialization.Readers } // Read the consistent strings - obj.TmpString = data.ReadNullTerminatedAnsiString(); - obj.GuidString = data.ReadNullTerminatedAnsiString(); + obj.TmpString = data.ReadNullTerminatedAnsiString() ?? string.Empty; + obj.GuidString = data.ReadNullTerminatedAnsiString() ?? string.Empty; // Parse the pre-string section int preStringBytesSize = GetPreStringBytesSize(data, obj, wisOffset); diff --git a/SabreTools.Serialization/Readers/XZP.cs b/SabreTools.Serialization/Readers/XZP.cs index 8fbf07ef..7bf8e7cb 100644 --- a/SabreTools.Serialization/Readers/XZP.cs +++ b/SabreTools.Serialization/Readers/XZP.cs @@ -167,7 +167,7 @@ namespace SabreTools.Serialization.Readers data.SeekIfPossible(initialOffset + obj.NameOffset, SeekOrigin.Begin); // Read the name - obj.Name = data.ReadNullTerminatedAnsiString(); + obj.Name = data.ReadNullTerminatedAnsiString() ?? string.Empty; // Seek back to the right position data.SeekIfPossible(currentPosition, SeekOrigin.Begin); diff --git a/SabreTools.Serialization/Wrappers/ISO9660.Printing.cs b/SabreTools.Serialization/Wrappers/ISO9660.Printing.cs index c9de852c..4769a0e6 100644 --- a/SabreTools.Serialization/Wrappers/ISO9660.Printing.cs +++ b/SabreTools.Serialization/Wrappers/ISO9660.Printing.cs @@ -309,9 +309,9 @@ namespace SabreTools.Serialization.Wrappers builder.AppendLine(); } - private static void Print(StringBuilder builder, PathTableRecord[] records, Encoding encoding) + private static void Print(StringBuilder builder, PathTableRecord[]? records, Encoding encoding) { - if (records.Length == 0) + if (records == null || records.Length == 0) { builder.AppendLine(" No records"); builder.AppendLine(); diff --git a/SabreTools.Serialization/Wrappers/LZKWAJ.Printing.cs b/SabreTools.Serialization/Wrappers/LZKWAJ.Printing.cs index d33c697b..ba69f4f9 100644 --- a/SabreTools.Serialization/Wrappers/LZKWAJ.Printing.cs +++ b/SabreTools.Serialization/Wrappers/LZKWAJ.Printing.cs @@ -19,7 +19,7 @@ namespace SabreTools.Serialization.Wrappers builder.AppendLine(); Print(builder, Model.Header); - Print(builder, Model.HeaderExtensions); + Print(builder, Model.HeaderExtensions ?? new()); } private static void Print(StringBuilder builder, KWAJHeader header) diff --git a/SabreTools.Serialization/Wrappers/LZKWAJ.cs b/SabreTools.Serialization/Wrappers/LZKWAJ.cs index 19b1b5a0..b37683fa 100644 --- a/SabreTools.Serialization/Wrappers/LZKWAJ.cs +++ b/SabreTools.Serialization/Wrappers/LZKWAJ.cs @@ -21,10 +21,10 @@ namespace SabreTools.Serialization.Wrappers public ushort DataOffset => Model.Header.DataOffset; /// - public string? FileName => Model.HeaderExtensions.FileName; + public string? FileName => Model.HeaderExtensions?.FileName; /// - public string? FileExtension => Model.HeaderExtensions.FileExtension; + public string? FileExtension => Model.HeaderExtensions?.FileExtension; #endregion diff --git a/SabreTools.Serialization/Wrappers/SGA.Printing.cs b/SabreTools.Serialization/Wrappers/SGA.Printing.cs index 573310bd..358448bd 100644 --- a/SabreTools.Serialization/Wrappers/SGA.Printing.cs +++ b/SabreTools.Serialization/Wrappers/SGA.Printing.cs @@ -62,28 +62,28 @@ namespace SabreTools.Serialization.Wrappers switch (directory) { case Directory4 directory4: - Print(builder, directory4.DirectoryHeader); + Print(builder, directory4.DirectoryHeader!); Print(builder, directory4.Sections); Print(builder, directory4.Folders); Print(builder, directory4.Files); break; case Directory5 directory5: - Print(builder, directory5.DirectoryHeader); + Print(builder, directory5.DirectoryHeader!); Print(builder, directory5.Sections); Print(builder, directory5.Folders); Print(builder, directory5.Files); break; case Directory6 directory6: - Print(builder, directory6.DirectoryHeader); + Print(builder, directory6.DirectoryHeader!); Print(builder, directory6.Sections); Print(builder, directory6.Folders); Print(builder, directory6.Files); break; case Directory7 directory7: - Print(builder, directory7.DirectoryHeader); + Print(builder, directory7.DirectoryHeader!); Print(builder, directory7.Sections); Print(builder, directory7.Folders); Print(builder, directory7.Files);