MSDOS model cleanup

This commit is contained in:
Matt Nadareski
2025-10-30 22:15:10 -04:00
parent 73dec51a4d
commit c4f73abcb6
5 changed files with 10 additions and 10 deletions

View File

@@ -8,4 +8,4 @@ namespace SabreTools.Data.Models.MSDOS
public const ushort SignatureUInt16 = 0x5a4d;
}
}
}

View File

@@ -14,7 +14,7 @@ namespace SabreTools.Data.Models.MSDOS
/// <summary>
/// MS-DOS executable header
/// </summary>
public ExecutableHeader? Header { get; set; }
public ExecutableHeader Header { get; set; }
/// <summary>
/// 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.
/// </summary>
public RelocationEntry[]? RelocationTable { get; set; }
public RelocationEntry[] RelocationTable { get; set; }
}
}

View File

@@ -18,7 +18,7 @@ namespace SabreTools.Data.Models.MSDOS
/// </summary>
/// <remarks>15 bytes</remarks>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 2)]
public string? Magic;
public string Magic;
/// <summary>
/// Number of bytes in the last page.
@@ -104,7 +104,7 @@ namespace SabreTools.Data.Models.MSDOS
/// </summary>
/// <remarks>4 entries/remarks>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public ushort[]? Reserved1;
public ushort[] Reserved1 = new ushort[4];
/// <summary>
/// Defined by name but no other information is given; typically zeroes
@@ -121,7 +121,7 @@ namespace SabreTools.Data.Models.MSDOS
/// </summary>
/// <remarks>10 entries/remarks>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public ushort[]? Reserved2;
public ushort[] Reserved2 = new ushort[10];
/// <summary>
/// Starting address of the PE header

View File

@@ -86,7 +86,7 @@ namespace SabreTools.Serialization
return null;
// Check for a valid new executable address
if (msdos.Model.Header?.NewExeHeaderAddr == null || initialOffset + msdos.Model.Header.NewExeHeaderAddr >= stream.Length)
if (initialOffset + msdos.Model.Header.NewExeHeaderAddr >= stream.Length)
return wrapper;
// Try to read the executable info
@@ -833,7 +833,7 @@ namespace SabreTools.Serialization
return WrapperType.XZP;
#endregion
#region ZSTD
if (magic.StartsWith([null, 0xB5, 0x2F, 0xFD]))

View File

@@ -50,11 +50,11 @@ namespace SabreTools.Serialization.Wrappers
builder.AppendLine();
}
private static void Print(StringBuilder builder, RelocationEntry[]? entries)
private static void Print(StringBuilder builder, RelocationEntry[] entries)
{
builder.AppendLine(" Relocation Table Information:");
builder.AppendLine(" -------------------------");
if (entries == null || entries.Length == 0)
if (entries.Length == 0)
{
builder.AppendLine(" No relocation table items");
builder.AppendLine();