mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-21 22:35:06 +00:00
Update Models and IO
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.IO" Version="1.6.0" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.6.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -28,7 +28,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
|
||||
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.4" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.5" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
|
||||
@@ -41,15 +41,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
break;
|
||||
|
||||
// Align to the 4-byte boundary if we're not at the end
|
||||
if (data.Position < data.Length)
|
||||
{
|
||||
while (data.Position < data.Length && (data.Position % 4) != 0)
|
||||
_ = data.ReadByteValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!data.AlignToBoundary(4))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -42,10 +42,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
#endregion
|
||||
|
||||
// Align to 64-byte boundary, if needed
|
||||
while (data.Position < data.Length - 1 && data.Position % 64 != 0)
|
||||
{
|
||||
_ = data.ReadByteValue();
|
||||
}
|
||||
if (!data.AlignToBoundary(64))
|
||||
return null;
|
||||
|
||||
#region Certificate Chain
|
||||
|
||||
@@ -65,10 +63,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
#endregion
|
||||
|
||||
// Align to 64-byte boundary, if needed
|
||||
while (data.Position < data.Length - 1 && data.Position % 64 != 0)
|
||||
{
|
||||
_ = data.ReadByteValue();
|
||||
}
|
||||
if (!data.AlignToBoundary(64))
|
||||
return null;
|
||||
|
||||
#region Ticket
|
||||
|
||||
@@ -83,10 +79,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
#endregion
|
||||
|
||||
// Align to 64-byte boundary, if needed
|
||||
while (data.Position < data.Length - 1 && data.Position % 64 != 0)
|
||||
{
|
||||
_ = data.ReadByteValue();
|
||||
}
|
||||
if (!data.AlignToBoundary(64))
|
||||
return null;
|
||||
|
||||
#region Title Metadata
|
||||
|
||||
@@ -101,10 +95,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
#endregion
|
||||
|
||||
// Align to 64-byte boundary, if needed
|
||||
while (data.Position < data.Length - 1 && data.Position % 64 != 0)
|
||||
{
|
||||
_ = data.ReadByteValue();
|
||||
}
|
||||
if (!data.AlignToBoundary(64))
|
||||
return null;
|
||||
|
||||
#region Content File Data
|
||||
|
||||
@@ -120,10 +112,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
#endregion
|
||||
|
||||
// Align to 64-byte boundary, if needed
|
||||
while (data.Position < data.Length - 1 && data.Position % 64 != 0)
|
||||
{
|
||||
_ = data.ReadByteValue();
|
||||
}
|
||||
if (!data.AlignToBoundary(64))
|
||||
return null;
|
||||
|
||||
#region Meta Data
|
||||
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
/// </summary>
|
||||
/// <param name="flagStrings">Possible flags as strings</param>
|
||||
/// <returns>CueTrackFlag value representing the strings, if possible</returns>
|
||||
private static CueTrackFlag GetFlags(string?[]? flagStrings)
|
||||
private static CueTrackFlag GetFlags(string[]? flagStrings)
|
||||
{
|
||||
CueTrackFlag flag = 0;
|
||||
if (flagStrings == null)
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace SabreTools.Serialization.Deserializers
|
||||
|
||||
// Create the tables
|
||||
cart.Partitions = new NCCHHeader[8];
|
||||
cart.ExtendedHeaders = new NCCHExtendedHeader?[8];
|
||||
cart.ExeFSHeaders = new ExeFSHeader?[8];
|
||||
cart.RomFSHeaders = new RomFSHeader?[8];
|
||||
cart.ExtendedHeaders = new NCCHExtendedHeader[8];
|
||||
cart.ExeFSHeaders = new ExeFSHeader[8];
|
||||
cart.RomFSHeaders = new RomFSHeader[8];
|
||||
|
||||
// Iterate and build the partitions
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
||||
@@ -167,10 +167,10 @@ namespace SabreTools.Serialization.Deserializers
|
||||
|
||||
// Setup all of the collections
|
||||
var localFileHeaders = new List<LocalFileHeader>();
|
||||
var encryptionHeaders = new List<byte[]?>();
|
||||
var encryptionHeaders = new List<byte[]>();
|
||||
var fileData = new List<byte[]>(); // TODO: Should this data be read here?
|
||||
var dataDescriptors = new List<DataDescriptor?>();
|
||||
var zip64DataDescriptors = new List<DataDescriptor64?>();
|
||||
var dataDescriptors = new List<DataDescriptor>();
|
||||
var zip64DataDescriptors = new List<DataDescriptor64>();
|
||||
|
||||
// Read the local file headers
|
||||
for (int i = 0; i < archive.CentralDirectoryHeaders.Length; i++)
|
||||
@@ -199,10 +199,10 @@ namespace SabreTools.Serialization.Deserializers
|
||||
{
|
||||
// Add a placeholder null item
|
||||
localFileHeaders.Add(new LocalFileHeader());
|
||||
encryptionHeaders.Add(null);
|
||||
encryptionHeaders.Add([]);
|
||||
fileData.Add([]);
|
||||
dataDescriptors.Add(null);
|
||||
zip64DataDescriptors.Add(null);
|
||||
dataDescriptors.Add(new DataDescriptor());
|
||||
zip64DataDescriptors.Add(new DataDescriptor64());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -226,8 +226,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the null encryption header
|
||||
encryptionHeaders.Add(null);
|
||||
// Add the empty encryption header
|
||||
encryptionHeaders.Add([]);
|
||||
}
|
||||
|
||||
// Try to read the file data
|
||||
@@ -254,7 +254,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
return null;
|
||||
|
||||
// Add the data descriptor
|
||||
dataDescriptors.Add(null);
|
||||
dataDescriptors.Add(new DataDescriptor());
|
||||
zip64DataDescriptors.Add(dataDescriptor64);
|
||||
}
|
||||
else
|
||||
@@ -266,14 +266,14 @@ namespace SabreTools.Serialization.Deserializers
|
||||
|
||||
// Add the data descriptor
|
||||
dataDescriptors.Add(dataDescriptor);
|
||||
zip64DataDescriptors.Add(null);
|
||||
zip64DataDescriptors.Add(new DataDescriptor64());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add the null data descriptor
|
||||
dataDescriptors.Add(null);
|
||||
zip64DataDescriptors.Add(null);
|
||||
dataDescriptors.Add(new DataDescriptor());
|
||||
zip64DataDescriptors.Add(new DataDescriptor64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -663,8 +663,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
attributeCertificateTable.Add(entry);
|
||||
|
||||
// Align to the 8-byte boundary
|
||||
while ((data.Position % 8) != 0 && data.Position < endOffset && data.Position < data.Length)
|
||||
_ = data.ReadByteValue();
|
||||
data.AlignToBoundary(8);
|
||||
}
|
||||
|
||||
return [.. attributeCertificateTable];
|
||||
@@ -677,7 +676,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
/// <param name="endOffset">First address not part of the base relocation table</param>
|
||||
/// <param name="sections">Section table to use for virtual address translation</param>
|
||||
/// <returns>Filled base relocation table on success, null on error</returns>
|
||||
public static BaseRelocationBlock[] ParseBaseRelocationTable(Stream data, int endOffset, SectionHeader?[] sections)
|
||||
public static BaseRelocationBlock[] ParseBaseRelocationTable(Stream data, int endOffset, SectionHeader[] sections)
|
||||
{
|
||||
var baseRelocationTable = new List<BaseRelocationBlock>();
|
||||
|
||||
@@ -745,7 +744,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
/// <param name="data">Stream to parse</param>
|
||||
/// <param name="sections">Section table to use for virtual address translation</param>
|
||||
/// <returns>Filled export table on success, null on error</returns>
|
||||
public static ExportTable? ParseExportTable(Stream data, SectionHeader?[] sections)
|
||||
public static ExportTable? ParseExportTable(Stream data, SectionHeader[] sections)
|
||||
{
|
||||
var exportTable = new ExportTable();
|
||||
|
||||
@@ -859,7 +858,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
/// <param name="magic">Optional header magic number indicating PE32 or PE32+</param>
|
||||
/// <param name="sections">Section table to use for virtual address translation</param>
|
||||
/// <returns>Filled import table on success, null on error</returns>
|
||||
public static ImportTable? ParseImportTable(Stream data, OptionalHeaderMagicNumber magic, SectionHeader?[] sections)
|
||||
public static ImportTable? ParseImportTable(Stream data, OptionalHeaderMagicNumber magic, SectionHeader[] sections)
|
||||
{
|
||||
var importTable = new ImportTable();
|
||||
|
||||
@@ -908,7 +907,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
}
|
||||
|
||||
// Lookup tables
|
||||
var importLookupTables = new Dictionary<int, ImportLookupTableEntry?[]?>();
|
||||
var importLookupTables = new Dictionary<int, ImportLookupTableEntry[]?>();
|
||||
|
||||
for (int i = 0; i < importTable.ImportDirectoryTable.Length; i++)
|
||||
{
|
||||
@@ -962,7 +961,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
importTable.ImportLookupTables = importLookupTables;
|
||||
|
||||
// Address tables
|
||||
var importAddressTables = new Dictionary<int, ImportAddressTableEntry?[]?>();
|
||||
var importAddressTables = new Dictionary<int, ImportAddressTableEntry[]?>();
|
||||
|
||||
for (int i = 0; i < importTable.ImportDirectoryTable.Length; i++)
|
||||
{
|
||||
@@ -1116,7 +1115,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
/// <param name="sections">Section table to use for virtual address translation</param>
|
||||
/// <param name="topLevel">Indicates if this is the top level or not</param>
|
||||
/// <returns>Filled resource directory table on success, null on error</returns>
|
||||
public static ResourceDirectoryTable? ParseResourceDirectoryTable(Stream data, long initialOffset, SectionHeader?[] sections, bool topLevel = false)
|
||||
public static ResourceDirectoryTable? ParseResourceDirectoryTable(Stream data, long initialOffset, SectionHeader[] sections, bool topLevel = false)
|
||||
{
|
||||
var resourceDirectoryTable = new ResourceDirectoryTable();
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ using static SabreTools.Models.SGA.Constants;
|
||||
|
||||
namespace SabreTools.Serialization.Deserializers
|
||||
{
|
||||
public class SGA : BaseBinaryDeserializer<Models.SGA.File>
|
||||
public class SGA : BaseBinaryDeserializer<Archive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override Models.SGA.File? Deserialize(Stream? data)
|
||||
public override Archive? Deserialize(Stream? data)
|
||||
{
|
||||
// If the data is invalid
|
||||
if (data == null || !data.CanRead)
|
||||
@@ -19,7 +19,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
try
|
||||
{
|
||||
// Create a new SGA to fill
|
||||
var file = new Models.SGA.File();
|
||||
var archive = new Archive();
|
||||
|
||||
#region Header
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
return null;
|
||||
|
||||
// Set the SGA header
|
||||
file.Header = header;
|
||||
archive.Header = header;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,11 +41,11 @@ namespace SabreTools.Serialization.Deserializers
|
||||
return null;
|
||||
|
||||
// Set the SGA directory
|
||||
file.Directory = directory;
|
||||
archive.Directory = directory;
|
||||
|
||||
#endregion
|
||||
|
||||
return file;
|
||||
return archive;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
#region File Entries
|
||||
|
||||
// Create the file entry array
|
||||
file.FileEntries = new FileEntry?[header.NumDirs];
|
||||
file.FileEntries = new FileEntry[header.NumDirs];
|
||||
for (int i = 0; i < header.NumDirs; i++)
|
||||
{
|
||||
var dirEntry = file.DirEntries[i];
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace SabreTools.Serialization
|
||||
/// <param name="rva">Relative virtual address to convert</param>
|
||||
/// <param name="sections">Array of sections to check against</param>
|
||||
/// <returns>Physical address, 0 on error</returns>
|
||||
public static uint ConvertVirtualAddress(this uint rva, SectionHeader?[]? sections)
|
||||
public static uint ConvertVirtualAddress(this uint rva, SectionHeader[]? sections)
|
||||
{
|
||||
// If we have an invalid section table, we can't do anything
|
||||
if (sections == null || sections.Length == 0)
|
||||
@@ -59,7 +59,7 @@ namespace SabreTools.Serialization
|
||||
/// <param name="rva">Relative virtual address to convert</param>
|
||||
/// <param name="sections">Array of sections to check against</param>
|
||||
/// <returns>Section index, null on error</returns>
|
||||
public static int ContainingSectionIndex(this uint rva, SectionHeader?[]? sections)
|
||||
public static int ContainingSectionIndex(this uint rva, SectionHeader[]? sections)
|
||||
{
|
||||
// If we have an invalid section table, we can't do anything
|
||||
if (sections == null || sections.Length == 0)
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace SabreTools.Serialization.Printers
|
||||
Print(builder, mediaKeyBlock.Records);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Record?[]? records)
|
||||
private static void Print(StringBuilder builder, Record[]? records)
|
||||
{
|
||||
builder.AppendLine(" Records Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileEntry?[]? files)
|
||||
private static void Print(StringBuilder builder, FileEntry[]? files)
|
||||
{
|
||||
builder.AppendLine(" File Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? directoryEntries)
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[]? directoryEntries)
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Certificate?[]? certificateChain)
|
||||
private static void Print(StringBuilder builder, Certificate[]? certificateChain)
|
||||
{
|
||||
builder.AppendLine(" Certificate Chain Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -351,7 +351,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, NCCHHeader?[]? partitions)
|
||||
private static void Print(StringBuilder builder, NCCHHeader[]? partitions)
|
||||
{
|
||||
builder.AppendLine(" NCCH Partition Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, BlockEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, BlockEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Block Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -150,7 +150,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FragmentationMap?[]? entries)
|
||||
private static void Print(StringBuilder builder, FragmentationMap[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Fragmentation Maps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -195,7 +195,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, BlockEntryMap?[]? entries)
|
||||
private static void Print(StringBuilder builder, BlockEntryMap[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Block Entry Maps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -250,7 +250,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries, Dictionary<long, string?>? entryNames)
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[]? entries, Dictionary<long, string?>? entryNames)
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -283,7 +283,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -309,7 +309,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -335,7 +335,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -361,7 +361,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -403,7 +403,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryMapEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryMapEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -463,7 +463,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -490,7 +490,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ChecksumEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ChecksumEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -205,7 +205,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, string?[]? entries)
|
||||
private static void Print(StringBuilder builder, string[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Names:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -223,7 +223,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileDescriptor?[]? entries)
|
||||
private static void Print(StringBuilder builder, FileDescriptor[]? entries)
|
||||
{
|
||||
builder.AppendLine(" File Descriptors:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -291,7 +291,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileGroup?[]? entries)
|
||||
private static void Print(StringBuilder builder, FileGroup[]? entries)
|
||||
{
|
||||
builder.AppendLine(" File Groups:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -332,7 +332,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Component?[]? entries)
|
||||
private static void Print(StringBuilder builder, Component[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Components:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ObjectTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ObjectTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Object Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -169,7 +169,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ObjectPageMapEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ObjectPageMapEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Object Page Map Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -197,7 +197,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ResourceTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ResourceTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Resource Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -227,7 +227,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ResidentNamesTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ResidentNamesTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Resident Names Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -255,7 +255,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, EntryTableBundle?[]? bundles)
|
||||
private static void Print(StringBuilder builder, EntryTableBundle[]? bundles)
|
||||
{
|
||||
builder.AppendLine(" Entry Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -341,7 +341,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ModuleFormatDirectivesTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ModuleFormatDirectivesTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Module Format Directives Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -369,7 +369,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, VerifyRecordDirectiveTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, VerifyRecordDirectiveTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Verify Record Directive Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -401,7 +401,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FixupPageTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, FixupPageTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Fix-up Page Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -427,7 +427,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FixupRecordTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, FixupRecordTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Fix-up Record Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -655,7 +655,7 @@ namespace SabreTools.Serialization.Printers
|
||||
}
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ImportModuleNameTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ImportModuleNameTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Import Module Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -682,7 +682,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ImportModuleProcedureNameTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ImportModuleProcedureNameTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Import Module Procedure Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -709,7 +709,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, PerPageChecksumTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, PerPageChecksumTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Per-Page Checksum Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -735,7 +735,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, NonResidentNamesTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, NonResidentNamesTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Non-Resident Names Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace SabreTools.Serialization.Printers
|
||||
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(" -------------------------");
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, CFFOLDER?[]? entries)
|
||||
private static void Print(StringBuilder builder, CFFOLDER[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Folders:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -137,7 +137,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, CFFILE?[]? entries)
|
||||
private static void Print(StringBuilder builder, CFFILE[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Files:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -162,7 +162,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, HashEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, HashEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Hash Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -192,7 +192,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, BlockEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, BlockEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Block Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, NCCHHeader?[]? entries)
|
||||
private static void Print(StringBuilder builder, NCCHHeader[]? entries)
|
||||
{
|
||||
builder.AppendLine(" NCCH Partition Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -344,7 +344,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, NCCHExtendedHeader?[]? entries)
|
||||
private static void Print(StringBuilder builder, NCCHExtendedHeader[]? entries)
|
||||
{
|
||||
builder.AppendLine(" NCCH Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -580,7 +580,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ExeFSHeader?[]? entries)
|
||||
private static void Print(StringBuilder builder, ExeFSHeader[]? entries)
|
||||
{
|
||||
builder.AppendLine(" ExeFS Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -650,7 +650,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, RomFSHeader?[]? entries)
|
||||
private static void Print(StringBuilder builder, RomFSHeader[]? entries)
|
||||
{
|
||||
builder.AppendLine(" RomFS Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries, Dictionary<long, string?>? entryNames)
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[]? entries, Dictionary<long, string?>? entryNames)
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -124,7 +124,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -150,7 +150,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -176,7 +176,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -202,7 +202,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -244,7 +244,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, UnknownEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, UnknownEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Unknown Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -304,7 +304,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -331,7 +331,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ChecksumEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ChecksumEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -2,7 +2,6 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Models.NewExecutable;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
using static SabreTools.Serialization.Extensions;
|
||||
|
||||
namespace SabreTools.Serialization.Printers
|
||||
{
|
||||
@@ -116,7 +115,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, SegmentTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, SegmentTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Segment Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -227,7 +226,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ResidentNameTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, ResidentNameTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Resident-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -255,7 +254,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ModuleReferenceTableEntry?[]? entries, Models.MSDOS.ExecutableHeader? stub, ExecutableHeader? header)
|
||||
private static void Print(StringBuilder builder, ModuleReferenceTableEntry[]? entries, Models.MSDOS.ExecutableHeader? stub, ExecutableHeader? header)
|
||||
{
|
||||
builder.AppendLine(" Module-Reference Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -308,7 +307,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, EntryTableBundle?[]? entries)
|
||||
private static void Print(StringBuilder builder, EntryTableBundle[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Entry Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -348,7 +347,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, NonResidentNameTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, NonResidentNameTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Nonresident-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace SabreTools.Serialization.Printers
|
||||
Print(builder, table.NameList);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FolderAllocationTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, FolderAllocationTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Folder Allocation Table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -200,7 +200,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, NameListEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, NameListEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Name List:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -229,7 +229,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileAllocationTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, FileAllocationTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" File Allocation Table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryItem?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryItem[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Segment?[]? segments)
|
||||
private static void Print(StringBuilder builder, Segment[]? segments)
|
||||
{
|
||||
builder.AppendLine(" Segments Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace SabreTools.Serialization.Printers
|
||||
Print(builder, di.Units);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DiscInformationUnit?[]? entries)
|
||||
private static void Print(StringBuilder builder, DiscInformationUnit[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Disc Information Units:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, CentralDirectoryFileHeader?[]? headers)
|
||||
private static void Print(StringBuilder builder, CentralDirectoryFileHeader[]? headers)
|
||||
{
|
||||
builder.AppendLine(" Central Directory File Headers Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -166,10 +166,10 @@ namespace SabreTools.Serialization.Printers
|
||||
|
||||
private static void Print(StringBuilder builder,
|
||||
LocalFileHeader[]? localFileHeaders,
|
||||
byte[]?[]? encryptionHeaders,
|
||||
byte[][]? encryptionHeaders,
|
||||
byte[][]? fileData,
|
||||
DataDescriptor?[]? dataDescriptors,
|
||||
DataDescriptor64?[]? zip64DataDescriptors)
|
||||
DataDescriptor[]? dataDescriptors,
|
||||
DataDescriptor64[]? zip64DataDescriptors)
|
||||
{
|
||||
builder.AppendLine(" Local File Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, uint count, DataFile?[]? entries)
|
||||
private static void Print(StringBuilder builder, uint count, DataFile[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Data Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, AudioFile?[]? entries)
|
||||
private static void Print(StringBuilder builder, AudioFile[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Audio Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -193,7 +193,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, uint count, DataFile?[]? entries)
|
||||
private static void Print(StringBuilder builder, uint count, DataFile[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Data Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, OptionalHeader? header, SectionHeader?[]? table)
|
||||
private static void Print(StringBuilder builder, OptionalHeader? header, SectionHeader[]? table)
|
||||
{
|
||||
builder.AppendLine(" Optional Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -274,7 +274,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, SectionHeader?[]? table)
|
||||
private static void Print(StringBuilder builder, SectionHeader[]? table)
|
||||
{
|
||||
builder.AppendLine(" Section Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -312,7 +312,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, COFFSymbolTableEntry?[]? symbolTable)
|
||||
private static void Print(StringBuilder builder, COFFSymbolTableEntry[]? symbolTable)
|
||||
{
|
||||
builder.AppendLine(" COFF Symbol Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -469,7 +469,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, AttributeCertificateTableEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, AttributeCertificateTableEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Attribute Certificate Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -560,7 +560,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, BaseRelocationBlock?[]? entries, SectionHeader?[]? table)
|
||||
private static void Print(StringBuilder builder, BaseRelocationBlock[]? entries, SectionHeader[]? table)
|
||||
{
|
||||
builder.AppendLine(" Base Relocation Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -753,7 +753,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ImportTable? table, SectionHeader?[]? sectionTable)
|
||||
private static void Print(StringBuilder builder, ImportTable? table, SectionHeader[]? sectionTable)
|
||||
{
|
||||
builder.AppendLine(" Import Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileDescriptor?[]? entries)
|
||||
private static void Print(StringBuilder builder, FileDescriptor[]? entries)
|
||||
{
|
||||
builder.AppendLine(" File List Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -4,13 +4,13 @@ using SabreTools.Serialization.Interfaces;
|
||||
|
||||
namespace SabreTools.Serialization.Printers
|
||||
{
|
||||
public class SGA : IPrinter<File>
|
||||
public class SGA : IPrinter<Archive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
public void PrintInformation(StringBuilder builder, Archive model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
public static void Print(StringBuilder builder, Archive file)
|
||||
{
|
||||
builder.AppendLine("SGA Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
@@ -175,7 +175,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Section4?[]? sections)
|
||||
private static void Print(StringBuilder builder, Section4[]? sections)
|
||||
{
|
||||
builder.AppendLine(" Sections Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -207,7 +207,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Section5?[]? sections)
|
||||
private static void Print(StringBuilder builder, Section5[]? sections)
|
||||
{
|
||||
builder.AppendLine(" Sections Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -239,7 +239,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Folder4?[]? folders)
|
||||
private static void Print(StringBuilder builder, Folder4[]? folders)
|
||||
{
|
||||
builder.AppendLine(" Folders Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -270,7 +270,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Folder5?[]? folders)
|
||||
private static void Print(StringBuilder builder, Folder5[]? folders)
|
||||
{
|
||||
builder.AppendLine(" Folders Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -301,7 +301,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, File4?[]? files)
|
||||
private static void Print(StringBuilder builder, File4[]? files)
|
||||
{
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -334,7 +334,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, File6?[]? files)
|
||||
private static void Print(StringBuilder builder, File6[]? files)
|
||||
{
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -368,7 +368,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, File7?[]? files)
|
||||
private static void Print(StringBuilder builder, File7[]? files)
|
||||
{
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ArchiveHash?[]? entries)
|
||||
private static void Print(StringBuilder builder, ArchiveHash[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Archive Hashes Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -86,7 +86,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryItem?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryItem[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -70,7 +70,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileEntry?[]? entries)
|
||||
private static void Print(StringBuilder builder, FileEntry[]? entries)
|
||||
{
|
||||
builder.AppendLine(" File Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries, string prefix)
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[]? entries, string prefix)
|
||||
{
|
||||
builder.AppendLine($" {prefix} Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -75,7 +75,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryMapping?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryMapping[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Preload Directory Mappings Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -101,7 +101,7 @@ namespace SabreTools.Serialization.Printers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirectoryItem?[]? entries)
|
||||
private static void Print(StringBuilder builder, DirectoryItem[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -32,8 +32,8 @@
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="SabreTools.ASN1" Version="1.5.0" />
|
||||
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.6.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.4" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.6.1" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.5.5" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -165,7 +165,7 @@ namespace SabreTools.Serialization.Serializers
|
||||
/// <param name="rows">Array of Row objects representing the rows information</param>
|
||||
/// <param name="writer">SeparatedValueWriter representing the output</param>
|
||||
/// <param name="longHeader">True if the long variant of the row should be written, false otherwise</param>
|
||||
private static void WriteRows(Row?[]? rows, SeparatedValueWriter writer, bool longHeader)
|
||||
private static void WriteRows(Row[]? rows, SeparatedValueWriter writer, bool longHeader)
|
||||
{
|
||||
// If the games information is missing, we can't do anything
|
||||
if (rows == null || rows.Length == 0)
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace SabreTools.Serialization.Serializers
|
||||
/// </summary>
|
||||
/// <param name="games">Array of GameBase objects representing the games information</param>
|
||||
/// <param name="writer">ClrMameProWriter representing the output</param>
|
||||
private static void WriteGames(GameBase?[]? games, ClrMameProWriter writer)
|
||||
private static void WriteGames(GameBase[]? games, ClrMameProWriter writer)
|
||||
{
|
||||
// If the games information is missing, we can't do anything
|
||||
if (games == null || games.Length == 0)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <summary>
|
||||
/// Media key block records
|
||||
/// </summary>
|
||||
public Record?[] Records => Model.Records ?? [];
|
||||
public Record[] Records => Model.Records ?? [];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <summary>
|
||||
/// Array of block entries
|
||||
/// </summary>
|
||||
public Models.GCF.BlockEntry?[]? BlockEntries;
|
||||
public Models.GCF.BlockEntry[]? BlockEntries;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <summary>
|
||||
/// ExeFS headers
|
||||
/// </summary>
|
||||
public ExeFSHeader?[] ExeFSHeaders => Model.ExeFSHeaders ?? [];
|
||||
public ExeFSHeader[] ExeFSHeaders => Model.ExeFSHeaders ?? [];
|
||||
|
||||
/// <summary>
|
||||
/// Media unit size in bytes
|
||||
@@ -43,12 +43,12 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <summary>
|
||||
/// Partitions data table
|
||||
/// </summary>
|
||||
public NCCHHeader?[] Partitions => Model.Partitions ?? [];
|
||||
public NCCHHeader[] Partitions => Model.Partitions ?? [];
|
||||
|
||||
/// <summary>
|
||||
/// Partitions header table
|
||||
/// </summary>
|
||||
public PartitionTableEntry?[] PartitionsTable => Model.Header?.PartitionsTable ?? [];
|
||||
public PartitionTableEntry[] PartitionsTable => Model.Header?.PartitionsTable ?? [];
|
||||
|
||||
#region Named Partition Entries
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="Models.PAK.File.DirectoryItems"/>
|
||||
public DirectoryItem?[] DirectoryItems => Model.DirectoryItems ?? [];
|
||||
public DirectoryItem[] DirectoryItems => Model.DirectoryItems ?? [];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public long FileCount => Model.Header?.NumberOfFiles ?? 0;
|
||||
|
||||
/// <inheritdoc cref="Archive.Segments"/>
|
||||
public Segment?[] Segments => Model.Segments ?? [];
|
||||
public Segment[] Segments => Model.Segments ?? [];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="DiscInformation.Units"/>
|
||||
public DiscInformationUnit?[] Units => Model.Units ?? [];
|
||||
public DiscInformationUnit[] Units => Model.Units ?? [];
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using SabreTools.Models.SGA;
|
||||
|
||||
namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
public class SGA : WrapperBase<Models.SGA.File>
|
||||
public class SGA : WrapperBase<Archive>
|
||||
{
|
||||
#region Descriptive Properties
|
||||
|
||||
@@ -28,10 +29,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
return Directory switch
|
||||
{
|
||||
Models.SGA.Directory4 d4 => d4.Files?.Length ?? 0,
|
||||
Models.SGA.Directory5 d5 => d5.Files?.Length ?? 0,
|
||||
Models.SGA.Directory6 d6 => d6.Files?.Length ?? 0,
|
||||
Models.SGA.Directory7 d7 => d7.Files?.Length ?? 0,
|
||||
Directory4 d4 => d4.Files?.Length ?? 0,
|
||||
Directory5 d5 => d5.Files?.Length ?? 0,
|
||||
Directory6 d6 => d6.Files?.Length ?? 0,
|
||||
Directory7 d7 => d7.Files?.Length ?? 0,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
@@ -46,8 +47,8 @@ namespace SabreTools.Serialization.Wrappers
|
||||
{
|
||||
return Model.Header switch
|
||||
{
|
||||
Models.SGA.Header4 h4 => h4.FileDataOffset,
|
||||
Models.SGA.Header6 h6 => h6.FileDataOffset,
|
||||
Header4 h4 => h4.FileDataOffset,
|
||||
Header6 h6 => h6.FileDataOffset,
|
||||
_ => -1,
|
||||
};
|
||||
}
|
||||
@@ -58,14 +59,14 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Constructors
|
||||
|
||||
/// <inheritdoc/>
|
||||
public SGA(Models.SGA.File? model, byte[]? data, int offset)
|
||||
public SGA(Archive? model, byte[]? data, int offset)
|
||||
: base(model, data, offset)
|
||||
{
|
||||
// All logic is handled by the base class
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public SGA(Models.SGA.File? model, Stream? data)
|
||||
public SGA(Archive? model, Stream? data)
|
||||
: base(model, data)
|
||||
{
|
||||
// All logic is handled by the base class
|
||||
@@ -152,7 +153,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
/// <summary>
|
||||
/// Get a file header from the archive
|
||||
/// </summary>
|
||||
public Models.SGA.File4? GetFile(int index)
|
||||
public Models.SGA.File? GetFile(int index)
|
||||
{
|
||||
// If the index is invalid
|
||||
if (index < 0 || index >= FileCount)
|
||||
@@ -160,10 +161,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
return Directory switch
|
||||
{
|
||||
Models.SGA.Directory4 d4 => d4.Files![index],
|
||||
Models.SGA.Directory5 d5 => d5.Files![index],
|
||||
Models.SGA.Directory6 d6 => d6.Files![index],
|
||||
Models.SGA.Directory7 d7 => d7.Files![index],
|
||||
Directory4 d4 => d4.Files![index],
|
||||
Directory5 d5 => d5.Files![index],
|
||||
Directory6 d6 => d6.Files![index],
|
||||
Directory7 d7 => d7.Files![index],
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
@@ -206,20 +207,20 @@ namespace SabreTools.Serialization.Wrappers
|
||||
return null;
|
||||
|
||||
// Get the folder
|
||||
object? folder = Directory switch
|
||||
Folder? folder = Directory switch
|
||||
{
|
||||
Models.SGA.Directory4 d4 => Array.Find(d4.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Models.SGA.Directory5 d5 => Array.Find(d5.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Models.SGA.Directory6 d6 => Array.Find(d6.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Models.SGA.Directory7 d7 => Array.Find(d7.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Directory4 d4 => Array.Find(d4.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Directory5 d5 => Array.Find(d5.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Directory6 d6 => Array.Find(d6.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
Directory7 d7 => Array.Find(d7.Folders ?? [], f => f != null && index >= f.FileStartIndex && index <= f.FileEndIndex),
|
||||
_ => default,
|
||||
};
|
||||
|
||||
// Get the folder name
|
||||
return folder switch
|
||||
{
|
||||
Models.SGA.Folder4 f4 => f4.Name,
|
||||
Models.SGA.Folder5 f5 => f5.Name,
|
||||
Folder4 f4 => f4.Name,
|
||||
Folder5 f5 => f5.Name,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -92,35 +92,22 @@ namespace SabreTools.Serialization.Wrappers
|
||||
}
|
||||
|
||||
// New Executable
|
||||
#if NET20
|
||||
else if (Matching.Extensions.StartsWith(magic, Models.NewExecutable.Constants.SignatureBytes))
|
||||
#else
|
||||
else if (magic.StartsWith(Models.NewExecutable.Constants.SignatureBytes))
|
||||
#endif
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return NewExecutable.Create(stream);
|
||||
}
|
||||
|
||||
// Linear Executable
|
||||
#if NET20
|
||||
else if (Matching.Extensions.StartsWith(magic, Models.LinearExecutable.Constants.LESignatureBytes)
|
||||
|| Matching.Extensions.StartsWith(magic, Models.LinearExecutable.Constants.LXSignatureBytes))
|
||||
#else
|
||||
else if (magic.StartsWith(Models.LinearExecutable.Constants.LESignatureBytes)
|
||||
|| magic.StartsWith(Models.LinearExecutable.Constants.LXSignatureBytes))
|
||||
#endif
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return LinearExecutable.Create(stream);
|
||||
}
|
||||
|
||||
// Portable Executable
|
||||
#if NET20
|
||||
else if (Matching.Extensions.StartsWith(magic, Models.PortableExecutable.Constants.SignatureBytes))
|
||||
#else
|
||||
else if (magic.StartsWith(Models.PortableExecutable.Constants.SignatureBytes))
|
||||
#endif
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return PortableExecutable.Create(stream);
|
||||
@@ -147,19 +134,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region AACSMediaKeyBlock
|
||||
|
||||
// Block starting with verify media key record
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x81, 0x00, 0x00, 0x14 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x81, 0x00, 0x00, 0x14 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x81, 0x00, 0x00, 0x14]))
|
||||
return WrapperType.AACSMediaKeyBlock;
|
||||
|
||||
// Block starting with type and version record
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x10, 0x00, 0x00, 0x0C }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x10, 0x00, 0x00, 0x0C }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x10, 0x00, 0x00, 0x0C]))
|
||||
return WrapperType.AACSMediaKeyBlock;
|
||||
|
||||
// Shares an extension with INF setup information so it can't be used accurately
|
||||
@@ -175,11 +154,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region BDPlusSVM
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x42, 0x44, 0x53, 0x56, 0x4D, 0x5F, 0x43, 0x43 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x42, 0x44, 0x53, 0x56, 0x4D, 0x5F, 0x43, 0x43 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x42, 0x44, 0x53, 0x56, 0x4D, 0x5F, 0x43, 0x43]))
|
||||
return WrapperType.BDPlusSVM;
|
||||
|
||||
if (extension.Equals("svm", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -189,11 +164,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region BFPK
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x42, 0x46, 0x50, 0x4b }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x42, 0x46, 0x50, 0x4b }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x42, 0x46, 0x50, 0x4b]))
|
||||
return WrapperType.BFPK;
|
||||
|
||||
#endregion
|
||||
@@ -202,31 +173,19 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
// Shares a first 4 bytes with some .mc files
|
||||
// Shares an extension with VBSP
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x1d, 0x00, 0x00, 0x00 }) && extension.Equals("bsp", StringComparison.OrdinalIgnoreCase))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x1d, 0x00, 0x00, 0x00 }) && extension.Equals("bsp", StringComparison.OrdinalIgnoreCase))
|
||||
#endif
|
||||
if (magic.StartsWith([0x1d, 0x00, 0x00, 0x00]) && extension.Equals("bsp", StringComparison.OrdinalIgnoreCase))
|
||||
return WrapperType.BSP;
|
||||
|
||||
// Shares a first 4 bytes with some .mc files
|
||||
// Shares an extension with VBSP
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x1e, 0x00, 0x00, 0x00 }) && extension.Equals("bsp", StringComparison.OrdinalIgnoreCase))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x1e, 0x00, 0x00, 0x00 }) && extension.Equals("bsp", StringComparison.OrdinalIgnoreCase))
|
||||
#endif
|
||||
if (magic.StartsWith([0x1e, 0x00, 0x00, 0x00]) && extension.Equals("bsp", StringComparison.OrdinalIgnoreCase))
|
||||
return WrapperType.BSP;
|
||||
|
||||
#endregion
|
||||
|
||||
#region BZip2
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x42, 0x52, 0x68 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x42, 0x52, 0x68 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x42, 0x52, 0x68]))
|
||||
return WrapperType.BZip2;
|
||||
|
||||
if (extension.Equals("bz2", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -236,11 +195,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region CFB
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1]))
|
||||
return WrapperType.CFB;
|
||||
|
||||
// Installer package
|
||||
@@ -267,11 +222,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region CHD
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x4D, 0x43, 0x6F, 0x6D, 0x70, 0x72, 0x48, 0x44]))
|
||||
return WrapperType.CHD;
|
||||
|
||||
#endregion
|
||||
@@ -286,63 +237,34 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Executable
|
||||
|
||||
// DOS MZ executable file format (and descendants)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4d, 0x5a }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4d, 0x5a }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x4d, 0x5a]))
|
||||
return WrapperType.Executable;
|
||||
|
||||
/*
|
||||
// None of the following are supported yet
|
||||
|
||||
/*
|
||||
// Executable and Linkable Format
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x7f, 0x45, 0x4c, 0x46 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x7f, 0x45, 0x4c, 0x46 }))
|
||||
#endif
|
||||
return FileTypes.Executable;
|
||||
if (magic.StartsWith([0x7f, 0x45, 0x4c, 0x46]))
|
||||
return WrapperType.Executable;
|
||||
|
||||
// Mach-O binary (32-bit)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xfe, 0xed, 0xfa, 0xce }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xfe, 0xed, 0xfa, 0xce }))
|
||||
#endif
|
||||
return FileTypes.Executable;
|
||||
if (magic.StartsWith([0xfe, 0xed, 0xfa, 0xce]))
|
||||
return WrapperType.Executable;
|
||||
|
||||
// Mach-O binary (32-bit, reverse byte ordering scheme)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xce, 0xfa, 0xed, 0xfe }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xce, 0xfa, 0xed, 0xfe }))
|
||||
#endif
|
||||
return FileTypes.Executable;
|
||||
if (magic.StartsWith([0xce, 0xfa, 0xed, 0xfe]))
|
||||
return WrapperType.Executable;
|
||||
|
||||
// Mach-O binary (64-bit)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xfe, 0xed, 0xfa, 0xcf }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xfe, 0xed, 0xfa, 0xcf }))
|
||||
#endif
|
||||
return FileTypes.Executable;
|
||||
if (magic.StartsWith([0xfe, 0xed, 0xfa, 0xcf]))
|
||||
return WrapperType.Executable;
|
||||
|
||||
// Mach-O binary (64-bit, reverse byte ordering scheme)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xcf, 0xfa, 0xed, 0xfe }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xcf, 0xfa, 0xed, 0xfe }))
|
||||
#endif
|
||||
return FileTypes.Executable;
|
||||
if (magic.StartsWith([0xcf, 0xfa, 0xed, 0xfe]))
|
||||
return WrapperType.Executable;
|
||||
|
||||
// Prefrred Executable File Format
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66 }))
|
||||
#endif
|
||||
return FileTypes.Executable;
|
||||
if (magic.StartsWith([0x4a, 0x6f, 0x79, 0x21, 0x70, 0x65, 0x66, 0x66]))
|
||||
return WrapperType.Executable;
|
||||
*/
|
||||
|
||||
// DOS MZ executable file format (and descendants)
|
||||
@@ -357,11 +279,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region GCF
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]))
|
||||
return WrapperType.GCF;
|
||||
|
||||
if (extension.Equals("gcf", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -371,11 +289,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region GZIP
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x1f, 0x8b }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x1f, 0x8b }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x1f, 0x8b]))
|
||||
return WrapperType.GZIP;
|
||||
|
||||
if (extension.Equals("gz", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -392,11 +306,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region InstallShieldArchiveV3
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x13, 0x5D, 0x65, 0x8C }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x13, 0x5D, 0x65, 0x8C }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x13, 0x5D, 0x65, 0x8C]))
|
||||
return WrapperType.InstallShieldArchiveV3;
|
||||
|
||||
if (extension.Equals("z", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -406,11 +316,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region InstallShieldCAB
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x49, 0x53, 0x63 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x49, 0x53, 0x63 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x49, 0x53, 0x63]))
|
||||
return WrapperType.InstallShieldCAB;
|
||||
|
||||
// Both InstallShieldCAB and MicrosoftCAB share the same extension
|
||||
@@ -419,22 +325,14 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region LDSCRYPT
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x4C, 0x44, 0x53, 0x43, 0x52, 0x59, 0x50, 0x54]))
|
||||
return WrapperType.LDSCRYPT;
|
||||
|
||||
#endregion
|
||||
|
||||
#region MicrosoftCAB
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4d, 0x53, 0x43, 0x46 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4d, 0x53, 0x43, 0x46 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x4d, 0x53, 0x43, 0x46]))
|
||||
return WrapperType.MicrosoftCAB;
|
||||
|
||||
// Both InstallShieldCAB and MicrosoftCAB share the same extension
|
||||
@@ -443,29 +341,17 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region MicrosoftLZ
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x53, 0x5a, 0x44, 0x44, 0x88, 0xf0, 0x27, 0x33 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x53, 0x5a, 0x44, 0x44, 0x88, 0xf0, 0x27, 0x33 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x53, 0x5a, 0x44, 0x44, 0x88, 0xf0, 0x27, 0x33]))
|
||||
return WrapperType.MicrosoftLZ;
|
||||
|
||||
#endregion
|
||||
|
||||
#region MoPaQ
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4d, 0x50, 0x51, 0x1a }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4d, 0x50, 0x51, 0x1a }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x4d, 0x50, 0x51, 0x1a]))
|
||||
return WrapperType.MoPaQ;
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x4d, 0x50, 0x51, 0x1b }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x4d, 0x50, 0x51, 0x1b }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x4d, 0x50, 0x51, 0x1b]))
|
||||
return WrapperType.MoPaQ;
|
||||
|
||||
if (extension.Equals("mpq", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -487,11 +373,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region NCF
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]))
|
||||
return WrapperType.NCF;
|
||||
|
||||
if (extension.Equals("ncf", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -521,11 +403,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region PAK
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x50, 0x41, 0x43, 0x4B }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x50, 0x41, 0x43, 0x4B }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x50, 0x41, 0x43, 0x4B]))
|
||||
return WrapperType.PAK;
|
||||
|
||||
// Both PAK and Quantum share one extension
|
||||
@@ -537,27 +415,15 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region PFF
|
||||
|
||||
// Version 2
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x32 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x32 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x32]))
|
||||
return WrapperType.PFF;
|
||||
|
||||
// Version 3
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x33 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x33 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x33]))
|
||||
return WrapperType.PFF;
|
||||
|
||||
// Version 4
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x34 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x34 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x14, 0x00, 0x00, 0x00, 0x50, 0x46, 0x46, 0x34]))
|
||||
return WrapperType.PFF;
|
||||
|
||||
if (extension.Equals("pff", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -568,35 +434,19 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region PKZIP
|
||||
|
||||
// PKZIP (Unknown)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x50, 0x4b, 0x00, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x00, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x50, 0x4b, 0x00, 0x00]))
|
||||
return WrapperType.PKZIP;
|
||||
|
||||
// PKZIP
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x50, 0x4b, 0x03, 0x04 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x03, 0x04 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x50, 0x4b, 0x03, 0x04]))
|
||||
return WrapperType.PKZIP;
|
||||
|
||||
// PKZIP (Empty Archive)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x50, 0x4b, 0x05, 0x06 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x05, 0x06 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x50, 0x4b, 0x05, 0x06]))
|
||||
return WrapperType.PKZIP;
|
||||
|
||||
// PKZIP (Spanned Archive)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x50, 0x4b, 0x07, 0x08 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x50, 0x4b, 0x07, 0x08 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x50, 0x4b, 0x07, 0x08]))
|
||||
return WrapperType.PKZIP;
|
||||
|
||||
// PKZIP
|
||||
@@ -688,11 +538,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region PLJ
|
||||
|
||||
// https://www.iana.org/assignments/media-types/audio/vnd.everad.plj
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xFF, 0x9D, 0x53, 0x4B }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xFF, 0x9D, 0x53, 0x4B }))
|
||||
#endif
|
||||
if (magic.StartsWith([0xFF, 0x9D, 0x53, 0x4B]))
|
||||
return WrapperType.PlayJAudioFile;
|
||||
|
||||
// https://www.iana.org/assignments/media-types/audio/vnd.everad.plj
|
||||
@@ -703,11 +549,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region Quantum
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x44, 0x53 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x44, 0x53 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x44, 0x53]))
|
||||
return WrapperType.Quantum;
|
||||
|
||||
if (extension.Equals("q", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -722,19 +564,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region RAR
|
||||
|
||||
// RAR archive version 1.50 onwards
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00]))
|
||||
return WrapperType.RAR;
|
||||
|
||||
// RAR archive version 5.0 onwards
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00]))
|
||||
return WrapperType.RAR;
|
||||
|
||||
if (extension.Equals("rar", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -746,31 +580,19 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
// RASGI2.0
|
||||
// Found in the ".rgs files in IA item "Nova_RealArcadeCD_USA".
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x52, 0x41, 0x53, 0x47, 0x49, 0x32, 0x2E, 0x30 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x52, 0x41, 0x53, 0x47, 0x49, 0x32, 0x2E, 0x30 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x52, 0x41, 0x53, 0x47, 0x49, 0x32, 0x2E, 0x30]))
|
||||
return WrapperType.RealArcadeInstaller;
|
||||
|
||||
// XZip2.0
|
||||
// Found in the ".mez" files in IA item "Nova_RealArcadeCD_USA".
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x58, 0x5A, 0x69, 0x70, 0x32, 0x2E, 0x30 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x58, 0x5A, 0x69, 0x70, 0x32, 0x2E, 0x30 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x58, 0x5A, 0x69, 0x70, 0x32, 0x2E, 0x30]))
|
||||
return WrapperType.RealArcadeMezzanine;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SevenZip
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c]))
|
||||
return WrapperType.SevenZip;
|
||||
|
||||
if (extension.Equals("7z", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -781,22 +603,14 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region SFFS
|
||||
|
||||
// Found in Redump entry 81756, confirmed to be "StarForce Filesystem" by PiD.
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x53, 0x46, 0x46, 0x53 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x53, 0x46, 0x46, 0x53 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x53, 0x46, 0x46, 0x53]))
|
||||
return WrapperType.SFFS;
|
||||
|
||||
#endregion
|
||||
|
||||
#region SGA
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x5F, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x5F, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x5F, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45]))
|
||||
return WrapperType.SGA;
|
||||
|
||||
if (extension.Equals("sga", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -806,18 +620,10 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region TapeArchive
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x75, 0x73, 0x74, 0x61, 0x72, 0x00, 0x30, 0x30]))
|
||||
return WrapperType.TapeArchive;
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x75, 0x73, 0x74, 0x61, 0x72, 0x20, 0x20, 0x00]))
|
||||
return WrapperType.TapeArchive;
|
||||
|
||||
if (extension.Equals("tar", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -830,60 +636,32 @@ namespace SabreTools.Serialization.Wrappers
|
||||
// Not all textfiles can be determined through magic number
|
||||
|
||||
// HTML
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x3c, 0x68, 0x74, 0x6d, 0x6c }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x3c, 0x68, 0x74, 0x6d, 0x6c }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x3c, 0x68, 0x74, 0x6d, 0x6c]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// HTML and XML
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x3c, 0x21, 0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// InstallShield Compiled Rules
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x61, 0x4C, 0x75, 0x5A }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x61, 0x4C, 0x75, 0x5A }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x61, 0x4C, 0x75, 0x5A]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// Microsoft Office File (old)
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// Rich Text File
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x7b, 0x5c, 0x72, 0x74, 0x66, 0x31 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x7b, 0x5c, 0x72, 0x74, 0x66, 0x31 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x7b, 0x5c, 0x72, 0x74, 0x66, 0x31]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// Windows Help File
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x3F, 0x5F, 0x03, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x3F, 0x5F, 0x03, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x3F, 0x5F, 0x03, 0x00]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// XML
|
||||
// "<?xml"
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x3C, 0x3F, 0x78, 0x6D, 0x6C }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x3C, 0x3F, 0x78, 0x6D, 0x6C }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x3C, 0x3F, 0x78, 0x6D, 0x6C]))
|
||||
return WrapperType.Textfile;
|
||||
|
||||
// "Description in Zip"
|
||||
@@ -936,11 +714,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region VBSP
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x56, 0x42, 0x53, 0x50 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x56, 0x42, 0x53, 0x50 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x56, 0x42, 0x53, 0x50]))
|
||||
return WrapperType.VBSP;
|
||||
|
||||
// Shares an extension with BSP
|
||||
@@ -951,11 +725,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region VPK
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x34, 0x12, 0xaa, 0x55 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x34, 0x12, 0xaa, 0x55 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x34, 0x12, 0xaa, 0x55]))
|
||||
return WrapperType.VPK;
|
||||
|
||||
// Common extension so this cannot be used accurately
|
||||
@@ -966,11 +736,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region WAD
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x57, 0x41, 0x44, 0x33 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x57, 0x41, 0x44, 0x33 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x57, 0x41, 0x44, 0x33]))
|
||||
return WrapperType.WAD;
|
||||
|
||||
// Common extension so this cannot be used accurately
|
||||
@@ -981,11 +747,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region XZ
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00]))
|
||||
return WrapperType.XZ;
|
||||
|
||||
if (extension.Equals("xz", StringComparison.OrdinalIgnoreCase))
|
||||
@@ -995,11 +757,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
|
||||
#region XZP
|
||||
|
||||
#if NET20
|
||||
if (Matching.Extensions.StartsWith(magic, new byte?[] { 0x70, 0x69, 0x5A, 0x78 }))
|
||||
#else
|
||||
if (magic.StartsWith(new byte?[] { 0x70, 0x69, 0x5A, 0x78 }))
|
||||
#endif
|
||||
if (magic.StartsWith([0x70, 0x69, 0x5A, 0x78]))
|
||||
return WrapperType.XZP;
|
||||
|
||||
if (extension.Equals("xzp", StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
Reference in New Issue
Block a user