Minor formatting changes in extensions

This commit is contained in:
Matt Nadareski
2024-11-27 22:07:48 -05:00
parent f42c5d04ee
commit 2152ba43a8
2 changed files with 6 additions and 18 deletions

View File

@@ -10,9 +10,7 @@ namespace SabreTools.Serialization
/// <param name="entry">Resource type information entry to check</param>
/// <returns>True if the entry is an integer type, false if an offset, null on error</returns>
public static bool IsIntegerType(this ResourceTypeInformationEntry entry)
{
return (entry.TypeID & 0x8000) != 0;
}
=> (entry.TypeID & 0x8000) != 0;
/// <summary>
/// Determine if a resource type resource entry is an integer or offset
@@ -20,9 +18,7 @@ namespace SabreTools.Serialization
/// <param name="entry">Resource type resource entry to check</param>
/// <returns>True if the entry is an integer type, false if an offset, null on error</returns>
public static bool IsIntegerType(this ResourceTypeResourceEntry entry)
{
return (entry.ResourceID & 0x8000) != 0;
}
=> (entry.ResourceID & 0x8000) != 0;
/// <summary>
/// Get the segment entry type for an entry table bundle

View File

@@ -102,10 +102,7 @@ namespace SabreTools.Serialization
public static NB10ProgramDatabase? AsNB10ProgramDatabase(this byte[] data, ref int offset)
{
var nb10ProgramDatabase = data.ReadType<NB10ProgramDatabase>(ref offset);
if (nb10ProgramDatabase == null)
return null;
if (nb10ProgramDatabase.Signature != 0x3031424E)
if (nb10ProgramDatabase?.Signature != 0x3031424E)
return null;
return nb10ProgramDatabase;
@@ -120,10 +117,7 @@ namespace SabreTools.Serialization
public static RSDSProgramDatabase? AsRSDSProgramDatabase(this byte[] data, ref int offset)
{
var rsdsProgramDatabase = data.ReadType<RSDSProgramDatabase>(ref offset);
if (rsdsProgramDatabase == null)
return null;
if (rsdsProgramDatabase.Signature != 0x53445352)
if (rsdsProgramDatabase?.Signature != 0x53445352)
return null;
#if NET20 || NET35 || NET40 || NET452 || NET462
@@ -211,6 +205,7 @@ namespace SabreTools.Serialization
// Read in the table
var header = new ResourceHeader();
header.DataSize = data.ReadUInt32(ref offset);
header.HeaderSize = data.ReadUInt32(ref offset);
header.ResourceType = (ResourceType)data.ReadUInt32(ref offset); // TODO: Could be a string too
@@ -1127,10 +1122,7 @@ namespace SabreTools.Serialization
if (versionInfo.ValueLength > 0 && offset + versionInfo.ValueLength <= entry.Data.Length)
{
var fixedFileInfo = entry.Data.ReadType<FixedFileInfo>(ref offset);
if (fixedFileInfo == null)
return null;
if (fixedFileInfo.Signature != 0xFEEF04BD)
if (fixedFileInfo?.Signature != 0xFEEF04BD)
return null;
versionInfo.Value = fixedFileInfo;