mirror of
https://github.com/SabreTools/SabreTools.Printing.git
synced 2026-04-22 06:03:32 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dff654af5c | ||
|
|
6f6451ff40 | ||
|
|
b28f5011ac | ||
|
|
56d8077216 | ||
|
|
9fd534f539 | ||
|
|
19aefca0e1 | ||
|
|
4dce7a7fa4 | ||
|
|
ed2f53526c | ||
|
|
9b1040e912 | ||
|
|
abc4701f9d | ||
|
|
03c0bc1802 | ||
|
|
a6e38f6868 | ||
|
|
d900eeb2d2 | ||
|
|
bd49efa14a | ||
|
|
93cd267b00 | ||
|
|
668b4bada7 | ||
|
|
36ddb62def | ||
|
|
1de4cede1b |
43
.github/workflows/build_nupkg.yml
vendored
Normal file
43
.github/workflows/build_nupkg.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
name: Nuget Pack
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack
|
||||
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 'Nuget Package'
|
||||
path: 'bin/Release/*.nupkg'
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: 'bin/Release/*.nupkg'
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
replacesArtifacts: True
|
||||
tag: "rolling"
|
||||
updateOnlyUnreleased: True
|
||||
17
.github/workflows/check_pr.yml
vendored
Normal file
17
.github/workflows/check_pr.yml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Build PR
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
@@ -14,11 +14,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, mediaKeyBlock.Records);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Record[] records)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Record?[]? records)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Records Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -37,11 +33,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Record record, int index)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Record? record, int index)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine($" Record Entry {index}");
|
||||
if (record == null)
|
||||
@@ -85,11 +77,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, EndOfMediaKeyBlockRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, EndOfMediaKeyBlockRecord record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -97,11 +85,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine(record.SignatureData, " Signature data");
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExplicitSubsetDifferenceRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExplicitSubsetDifferenceRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -130,11 +114,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, MediaKeyDataRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, MediaKeyDataRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -154,11 +134,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SubsetDifferenceIndexRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SubsetDifferenceIndexRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -179,11 +155,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, TypeAndVersionRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, TypeAndVersionRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -192,11 +164,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine(record.VersionNumber, " Version number");
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DriveRevocationListRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DriveRevocationListRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -247,11 +215,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, HostRevocationListRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, HostRevocationListRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -302,11 +266,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, VerifyMediaKeyRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, VerifyMediaKeyRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
@@ -314,11 +274,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine(record.CiphertextValue, " Ciphertext value");
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CopyrightRecord record)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CopyrightRecord? record)
|
||||
#endif
|
||||
{
|
||||
if (record == null)
|
||||
return;
|
||||
|
||||
8
BFPK.cs
8
BFPK.cs
@@ -15,11 +15,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, archive.Files);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -36,11 +32,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FileEntry[] files)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FileEntry?[]? files)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
16
BSP.cs
16
BSP.cs
@@ -18,11 +18,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.Textures);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -37,11 +33,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Lump[] lumps)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Lump?[]? lumps)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -79,11 +71,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, TextureHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, TextureHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Texture Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -110,11 +98,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Texture[] textures)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Texture?[]? textures)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Textures Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
12
CFB.cs
12
CFB.cs
@@ -19,11 +19,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, binary.DirectoryEntries);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FileHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FileHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -65,11 +61,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SectorNumber[] sectorNumbers, string name)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SectorNumber?[]? sectorNumbers, string name)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine($" {name} Sectors Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -87,11 +79,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[] directoryEntries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? directoryEntries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
24
CIA.cs
24
CIA.cs
@@ -19,11 +19,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, cia.MetaData);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CIAHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CIAHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" CIA Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -46,11 +42,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Certificate[] certificateChain)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Certificate?[]? certificateChain)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Certificate Chain Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -106,11 +98,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Ticket ticket)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Ticket? ticket)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Ticket Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -215,11 +203,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, TitleMetadata tmd)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, TitleMetadata? tmd)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Title Metadata Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -362,11 +346,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NCCHHeader[] partitions)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NCCHHeader?[]? partitions)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" NCCH Partition Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -446,11 +426,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, MetaData metaData)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, MetaData? metaData)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Meta Data Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
143
Extensions.cs
143
Extensions.cs
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
@@ -9,50 +10,27 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a boolean to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, bool value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, bool? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= false;
|
||||
#endif
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {value.ToString()}");
|
||||
return sb.AppendLine($"{prefixString}: {value}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Char to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET48
|
||||
string valueString = value.ToString();
|
||||
#else
|
||||
string valueString = (value == null ? "[NULL]" : value.Value.ToString());
|
||||
#endif
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int8 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, sbyte value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, sbyte? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -60,16 +38,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -77,16 +48,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a Int16 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -94,16 +58,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt16 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -111,16 +68,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a Int32 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -128,16 +78,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt32 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -145,16 +88,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a Int64 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -162,16 +98,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt64 to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= 0;
|
||||
#endif
|
||||
|
||||
string valueString = $"{value} (0x{value:X})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -179,16 +108,9 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a string to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, string value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, string? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
value ??= string.Empty;
|
||||
#endif
|
||||
|
||||
string valueString = value ?? "[NULL]";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
@@ -196,30 +118,17 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a Guid to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, Guid value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, Guid? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
#if NET48
|
||||
string valueString = value.ToString();
|
||||
#else
|
||||
value ??= Guid.Empty;
|
||||
string valueString = value.Value.ToString();
|
||||
#endif
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {value}");
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : BitConverter.ToString(value).Replace('-', ' '));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
@@ -228,11 +137,7 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8[] value as a string to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[] value, string prefixString, Encoding encoding)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[]? value, string prefixString, Encoding encoding)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : encoding.GetString(value).Replace("\0", string.Empty));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
@@ -241,91 +146,63 @@ namespace SabreTools.Printing
|
||||
/// <summary>
|
||||
/// Append a line containing a Char[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(c => c.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int16[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(s => s.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt16[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(u => u.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int32[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(i => i.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt32[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(u => u.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int64[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(l => l.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt64[] value to a StringBuilder
|
||||
/// </summary>
|
||||
#if NET48
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong[] value, string prefixString)
|
||||
#else
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong[]? value, string prefixString)
|
||||
#endif
|
||||
{
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value));
|
||||
string valueString = (value == null ? "[NULL]" : string.Join(", ", value.Select(u => u.ToString()).ToArray()));
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
}
|
||||
|
||||
80
GCF.cs
80
GCF.cs
@@ -47,11 +47,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.DataBlockHeader);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -76,11 +72,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, BlockEntryHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, BlockEntryHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Block Entry Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -102,11 +94,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, BlockEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, BlockEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Block Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -138,11 +126,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FragmentationMapHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FragmentationMapHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Fragmentation Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -160,11 +144,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FragmentationMap[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FragmentationMap?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Fragmentation Maps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -190,11 +170,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, BlockEntryMapHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, BlockEntryMapHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Block Entry Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -213,11 +189,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, BlockEntryMap[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, BlockEntryMap?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Block Entry Maps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -244,11 +216,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -276,11 +244,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -313,11 +277,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -343,11 +303,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -373,11 +329,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -403,11 +355,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -433,11 +381,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryMapHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryMapHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -453,11 +397,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryMapEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryMapEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -483,11 +423,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -503,11 +439,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumMapHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumMapHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -525,11 +457,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -556,11 +484,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -586,11 +510,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DataBlockHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DataBlockHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Data Block Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
49
IRD.cs
Normal file
49
IRD.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
{
|
||||
public static class IRD
|
||||
{
|
||||
public static void Print(StringBuilder builder, Models.IRD.File ird)
|
||||
{
|
||||
builder.AppendLine("IRD Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine(ird.Magic, "Magic", Encoding.ASCII);
|
||||
builder.AppendLine(ird.Version, "Version");
|
||||
builder.AppendLine(ird.TitleID, "Title ID");
|
||||
builder.AppendLine(ird.TitleLength, "Title length");
|
||||
builder.AppendLine(ird.Title, "Title");
|
||||
builder.AppendLine(ird.SystemVersion, "System version");
|
||||
builder.AppendLine(ird.GameVersion, "Game version");
|
||||
builder.AppendLine(ird.AppVersion, "App version");
|
||||
builder.AppendLine(ird.HeaderLength, "Header length");
|
||||
builder.AppendLine(ird.Header, "Header");
|
||||
builder.AppendLine(ird.FooterLength, "Footer length");
|
||||
builder.AppendLine(ird.Footer, "Footer");
|
||||
builder.AppendLine(ird.RegionCount, "Region count");
|
||||
if (ird.RegionCount != 0 && ird.RegionHashes != null && ird.RegionHashes.Length != 0)
|
||||
{
|
||||
for (int i = 0; i < ird.RegionCount; i++)
|
||||
{
|
||||
builder.AppendLine(ird.RegionHashes[i], $"Region {i} hash");
|
||||
}
|
||||
}
|
||||
builder.AppendLine(ird.FileCount, "File count");
|
||||
for (int i = 0; i < ird.FileCount; i++)
|
||||
{
|
||||
if (ird.FileKeys != null)
|
||||
builder.AppendLine(ird.FileKeys[i], $"File {i} key");
|
||||
if (ird.FileHashes != null)
|
||||
builder.AppendLine(ird.FileHashes[i], $"File {i} hash");
|
||||
}
|
||||
builder.AppendLine(ird.ExtraConfig, "Extra config");
|
||||
builder.AppendLine(ird.Attachments, "Attachments");
|
||||
builder.AppendLine(ird.Data1Key, "Data 1 key");
|
||||
builder.AppendLine(ird.Data2Key, "Data 2 key");
|
||||
builder.AppendLine(ird.PIC, "PIC");
|
||||
builder.AppendLine(ird.UID, "UID");
|
||||
builder.AppendLine(ird.CRC, "CRC");
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,17 +35,9 @@ namespace SabreTools.Printing
|
||||
Print(builder, cabinet.Components);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static int GetMajorVersion(CommonHeader header)
|
||||
#else
|
||||
private static int GetMajorVersion(CommonHeader? header)
|
||||
#endif
|
||||
{
|
||||
#if NET48
|
||||
uint majorVersion = header.Version;
|
||||
#else
|
||||
uint majorVersion = header?.Version ?? 0;
|
||||
#endif
|
||||
if (majorVersion >> 24 == 1)
|
||||
{
|
||||
majorVersion = (majorVersion >> 12) & 0x0F;
|
||||
@@ -60,11 +52,7 @@ namespace SabreTools.Printing
|
||||
return (int)majorVersion;
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CommonHeader header, int majorVersion)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CommonHeader? header, int majorVersion)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Common Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -83,11 +71,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, VolumeHeader header, int majorVersion)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, VolumeHeader? header, int majorVersion)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Volume Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -132,11 +116,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Descriptor descriptor)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Descriptor? descriptor)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Descriptor Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -203,11 +183,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, uint[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, uint[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File Descriptor Offsets:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -225,11 +201,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, string[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, string?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Names:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -247,11 +219,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FileDescriptor[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FileDescriptor?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File Descriptors:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -288,11 +256,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Dictionary<long, OffsetList> entries, string name)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Dictionary<long, OffsetList?>? entries, string name)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine($" {name} Offsets:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -323,11 +287,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FileGroup[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FileGroup?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File Groups:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -376,11 +336,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Component[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Component?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Components:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.LinearExecutable;
|
||||
using SabreTools.Models.MicrosoftCabinet;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
{
|
||||
@@ -36,11 +37,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.DebugInformation);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -77,11 +74,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, InformationBlock block)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, InformationBlock? block)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Information Block Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -141,11 +134,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ObjectTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ObjectTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Object Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -176,11 +165,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ObjectPageMapEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ObjectPageMapEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Object Page Map Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -208,11 +193,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ResourceTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ResourceTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Resource Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -242,11 +223,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ResidentNamesTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ResidentNamesTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Resident Names Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -274,11 +251,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, EntryTableBundle[] bundles)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, EntryTableBundle?[]? bundles)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Entry Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -364,11 +337,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ModuleFormatDirectivesTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ModuleFormatDirectivesTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Module Format Directives Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -396,11 +365,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, VerifyRecordDirectiveTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, VerifyRecordDirectiveTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Verify Record Directive Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -432,11 +397,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FixupPageTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FixupPageTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Fix-up Page Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -462,11 +423,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FixupRecordTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FixupRecordTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Fix-up Record Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -491,25 +448,45 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine($" Target flags: {entry.TargetFlags} (0x{entry.TargetFlags:X})");
|
||||
|
||||
// Source list flag
|
||||
#if NET20 || NET35
|
||||
if ((entry.SourceType & FixupRecordSourceType.SourceListFlag) != 0)
|
||||
#else
|
||||
if (entry.SourceType.HasFlag(FixupRecordSourceType.SourceListFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.SourceOffsetListCount, " Source offset list count");
|
||||
else
|
||||
builder.AppendLine(entry.SourceOffset, " Source offset");
|
||||
|
||||
// OBJECT / TRGOFF
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.InternalReference) != 0)
|
||||
#else
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.InternalReference))
|
||||
#endif
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag) != 0)
|
||||
#else
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.TargetObjectNumberWORD, " Target object number");
|
||||
else
|
||||
builder.AppendLine(entry.TargetObjectNumberByte, " Target object number");
|
||||
|
||||
// 16-bit Selector fixup
|
||||
#if NET20 || NET35
|
||||
if ((entry.SourceType & FixupRecordSourceType.SixteenBitSelectorFixup) != 0)
|
||||
#else
|
||||
if (!entry.SourceType.HasFlag(FixupRecordSourceType.SixteenBitSelectorFixup))
|
||||
#endif
|
||||
{
|
||||
// 32-bit Target Offset Flag
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag) != 0)
|
||||
#else
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.TargetOffsetDWORD, " Target offset");
|
||||
else
|
||||
builder.AppendLine(entry.TargetOffsetWORD, " Target offset");
|
||||
@@ -517,27 +494,51 @@ namespace SabreTools.Printing
|
||||
}
|
||||
|
||||
// MOD ORD# / IMPORT ORD / ADDITIVE
|
||||
#if NET20 || NET35
|
||||
else if ((entry.TargetFlags & FixupRecordTargetFlags.ImportedReferenceByOrdinal) != 0)
|
||||
#else
|
||||
else if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ImportedReferenceByOrdinal))
|
||||
#endif
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.OrdinalIndexImportModuleNameTableWORD, " Ordinal index import module name table");
|
||||
else
|
||||
builder.AppendLine(entry.OrdinalIndexImportModuleNameTableByte, " Ordinal index import module name table");
|
||||
|
||||
// 8-bit Ordinal Flag & 32-bit Target Offset Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.EightBitOrdinalFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.EightBitOrdinalFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.EightBitOrdinalFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.ImportedOrdinalNumberByte, " Imported ordinal number");
|
||||
else if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
#if NET20 || NET35
|
||||
else if ((entry.TargetFlags & FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag) != 0)
|
||||
#else
|
||||
else if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.ImportedOrdinalNumberDWORD, " Imported ordinal number");
|
||||
else
|
||||
builder.AppendLine(entry.ImportedOrdinalNumberWORD, " Imported ordinal number");
|
||||
|
||||
// Additive Fixup Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.AdditiveFixupFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
#endif
|
||||
{
|
||||
// 32-bit Additive Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.AdditiveFixupValueDWORD, " Additive fixup value");
|
||||
else
|
||||
builder.AppendLine(entry.AdditiveFixupValueWORD, " Additive fixup value");
|
||||
@@ -545,25 +546,45 @@ namespace SabreTools.Printing
|
||||
}
|
||||
|
||||
// MOD ORD# / PROCEDURE NAME OFFSET / ADDITIVE
|
||||
#if NET20 || NET35
|
||||
else if ((entry.TargetFlags & FixupRecordTargetFlags.ImportedReferenceByName) != 0)
|
||||
#else
|
||||
else if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ImportedReferenceByName))
|
||||
#endif
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.OrdinalIndexImportModuleNameTableWORD, " Ordinal index import module name table");
|
||||
else
|
||||
builder.AppendLine(entry.OrdinalIndexImportModuleNameTableByte, " Ordinal index import module name table");
|
||||
|
||||
// 32-bit Target Offset Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitTargetOffsetFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.OffsetImportProcedureNameTableDWORD, " Offset import procedure name table");
|
||||
else
|
||||
builder.AppendLine(entry.OffsetImportProcedureNameTableWORD, " Offset import procedure name table");
|
||||
|
||||
// Additive Fixup Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.AdditiveFixupFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
#endif
|
||||
{
|
||||
// 32-bit Additive Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.AdditiveFixupValueDWORD, " Additive fixup value");
|
||||
else
|
||||
builder.AppendLine(entry.AdditiveFixupValueWORD, " Additive fixup value");
|
||||
@@ -571,19 +592,35 @@ namespace SabreTools.Printing
|
||||
}
|
||||
|
||||
// ORD # / ADDITIVE
|
||||
#if NET20 || NET35
|
||||
else if ((entry.TargetFlags & FixupRecordTargetFlags.InternalReferenceViaEntryTable) != 0)
|
||||
#else
|
||||
else if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.InternalReferenceViaEntryTable))
|
||||
#endif
|
||||
{
|
||||
// 16-bit Object Number/Module Ordinal Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.SixteenBitObjectNumberModuleOrdinalFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.TargetObjectNumberWORD, " Target object number");
|
||||
else
|
||||
builder.AppendLine(entry.TargetObjectNumberByte, " Target object number");
|
||||
|
||||
// Additive Fixup Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.AdditiveFixupFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.AdditiveFixupFlag))
|
||||
#endif
|
||||
{
|
||||
// 32-bit Additive Flag
|
||||
if (entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
#if NET20 || NET35
|
||||
if ((entry.TargetFlags & FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag) != 0)
|
||||
#else
|
||||
if (!entry.TargetFlags.HasFlag(FixupRecordTargetFlags.ThirtyTwoBitAdditiveFixupFlag))
|
||||
#endif
|
||||
builder.AppendLine(entry.AdditiveFixupValueDWORD, " Additive fixup value");
|
||||
else
|
||||
builder.AppendLine(entry.AdditiveFixupValueWORD, " Additive fixup value");
|
||||
@@ -614,11 +651,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ImportModuleNameTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ImportModuleNameTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Import Module Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -645,11 +678,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ImportModuleProcedureNameTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ImportModuleProcedureNameTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Import Module Procedure Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -676,11 +705,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, PerPageChecksumTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, PerPageChecksumTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Per-Page Checksum Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -706,11 +731,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NonResidentNamesTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NonResidentNamesTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Non-Resident Names Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -738,11 +759,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DebugInformation di)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DebugInformation? di)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Debug Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
8
MSDOS.cs
8
MSDOS.cs
@@ -15,11 +15,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.RelocationTable);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExecutableHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExecutableHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -47,11 +43,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, RelocationEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, RelocationEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Relocation Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -17,11 +17,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, cabinet.Files);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CFHEADER header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CFHEADER? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -46,7 +42,11 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine(header.SetID, " Set ID");
|
||||
builder.AppendLine(header.CabinetIndex, " Cabinet index");
|
||||
|
||||
#if NET20 || NET35
|
||||
if ((header.Flags & HeaderFlags.RESERVE_PRESENT) != 0)
|
||||
#else
|
||||
if (header.Flags.HasFlag(HeaderFlags.RESERVE_PRESENT))
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(header.HeaderReservedSize, " Header reserved size");
|
||||
builder.AppendLine(header.FolderReservedSize, " Folder reserved size");
|
||||
@@ -54,13 +54,21 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine(header.ReservedData, " Reserved data");
|
||||
}
|
||||
|
||||
#if NET20 || NET35
|
||||
if ((header.Flags & HeaderFlags.PREV_CABINET) != 0)
|
||||
#else
|
||||
if (header.Flags.HasFlag(HeaderFlags.PREV_CABINET))
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(header.CabinetPrev, " Previous cabinet");
|
||||
builder.AppendLine(header.DiskPrev, " Previous disk");
|
||||
}
|
||||
|
||||
#if NET20 || NET35
|
||||
if ((header.Flags & HeaderFlags.NEXT_CABINET) != 0)
|
||||
#else
|
||||
if (header.Flags.HasFlag(HeaderFlags.NEXT_CABINET))
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(header.CabinetNext, " Next cabinet");
|
||||
builder.AppendLine(header.DiskNext, " Next disk");
|
||||
@@ -69,11 +77,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CFFOLDER[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CFFOLDER?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Folders:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -129,11 +133,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CFFILE[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CFFILE?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Files:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
28
N3DS.cs
28
N3DS.cs
@@ -20,11 +20,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, cart.RomFSHeaders);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NCSDHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NCSDHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" NCSD Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -107,11 +103,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CardInfoHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CardInfoHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Card Info Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -136,11 +128,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DevelopmentCardInfoHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DevelopmentCardInfoHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Development Card Info Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -234,11 +222,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NCCHHeader[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NCCHHeader?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" NCCH Partition Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -318,11 +302,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NCCHExtendedHeader[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NCCHExtendedHeader?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" NCCH Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -546,11 +526,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExeFSHeader[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExeFSHeader?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" ExeFS Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -620,11 +596,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, RomFSHeader[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, RomFSHeader?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" RomFS Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
52
NCF.cs
52
NCF.cs
@@ -32,11 +32,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.ChecksumEntries);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -61,11 +57,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -93,11 +85,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -130,11 +118,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryInfo1Entry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Info 1 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -160,11 +144,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryInfo2Entry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Info 2 Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -190,11 +170,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryCopyEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Copy Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -220,11 +196,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryLocalEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Local Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -250,11 +222,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, UnknownHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, UnknownHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -270,11 +238,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, UnknownEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, UnknownEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -300,11 +264,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -320,11 +280,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumMapHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumMapHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -342,11 +298,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumMapEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Map Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -373,11 +325,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ChecksumEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ChecksumEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Checksum Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -29,11 +29,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.NonResidentNameTable);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -70,11 +66,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExecutableHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExecutableHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -119,11 +111,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SegmentTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SegmentTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Segment Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -152,11 +140,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ResourceTable table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ResourceTable? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Resource Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -225,13 +209,12 @@ namespace SabreTools.Printing
|
||||
foreach (var typeAndNameString in table.TypeAndNameStrings)
|
||||
{
|
||||
builder.AppendLine($" Resource Type/Name Offset {typeAndNameString.Key}");
|
||||
#if NET6_0_OR_GREATER
|
||||
if (typeAndNameString.Value == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
builder.AppendLine(typeAndNameString.Value.Length, " Length");
|
||||
builder.AppendLine(typeAndNameString.Value.Text, " Text", Encoding.ASCII);
|
||||
}
|
||||
@@ -239,11 +222,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ResidentNameTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ResidentNameTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Resident-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -271,11 +250,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ModuleReferenceTableEntry[] entries, SabreTools.Models.MSDOS.ExecutableHeader stub, ExecutableHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ModuleReferenceTableEntry?[]? entries, SabreTools.Models.MSDOS.ExecutableHeader? stub, ExecutableHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Module-Reference Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -297,20 +272,12 @@ namespace SabreTools.Printing
|
||||
continue;
|
||||
}
|
||||
|
||||
#if NET48
|
||||
builder.AppendLine($" Offset: {entry.Offset} (adjusted to be {entry.Offset + stub.NewExeHeaderAddr + header.ImportedNamesTableOffset})");
|
||||
#else
|
||||
builder.AppendLine($" Offset: {entry.Offset} (adjusted to be {entry.Offset + (stub?.NewExeHeaderAddr ?? 0) + (header?.ImportedNamesTableOffset ?? 0)})");
|
||||
#endif
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Dictionary<ushort, ImportedNameTableEntry> entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Dictionary<ushort, ImportedNameTableEntry?>? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Imported-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -324,24 +291,19 @@ namespace SabreTools.Printing
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
builder.AppendLine($" Imported-Name Table at Offset {entry.Key}");
|
||||
#if NET6_0_OR_GREATER
|
||||
if (entry.Value == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (entry.Value == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.Value.Length, " Length");
|
||||
builder.AppendLine(entry.Value.NameString, " Name string", Encoding.ASCII);
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, EntryTableBundle[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, EntryTableBundle?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Entry Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -381,11 +343,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NonResidentNameTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NonResidentNameTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Nonresident-Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
28
Nitro.cs
28
Nitro.cs
@@ -18,11 +18,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, cart.FileAllocationTable);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, CommonHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, CommonHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Common Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -76,11 +72,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExtendedDSiHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExtendedDSiHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Extended DSi Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -142,11 +134,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, byte[] secureArea)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, byte[]? secureArea)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Secure Area Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -154,11 +142,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NameTable table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NameTable? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Name Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -174,11 +158,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, table.NameList);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FolderAllocationTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FolderAllocationTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Folder Allocation Table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -215,11 +195,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, NameListEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, NameListEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Name List:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -248,11 +224,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FileAllocationTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FileAllocationTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File Allocation Table:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
8
PAK.cs
8
PAK.cs
@@ -15,11 +15,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.DirectoryItems);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -36,11 +32,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryItem[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryItem?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
12
PFF.cs
12
PFF.cs
@@ -16,11 +16,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, archive.Footer);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -39,11 +35,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Segment[] segments)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Segment?[]? segments)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Segments Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -75,11 +67,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Footer footer)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Footer? footer)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Footer Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -25,11 +25,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, AudioHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, AudioHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Audio Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -103,11 +99,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, UnknownBlock1 block)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, UnknownBlock1? block)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Block 1 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -123,32 +115,22 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, uint value)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, uint? value)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Value 2 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
#if NET6_0_OR_GREATER
|
||||
if (value == null)
|
||||
{
|
||||
builder.AppendLine(" No unknown block 1r");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
builder.AppendLine(value, " Value");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, UnknownBlock3 block)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, UnknownBlock3? block)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Unknown Block 3 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -163,11 +145,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, uint count, DataFile[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, uint count, DataFile?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Data Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using SabreTools.ASN1;
|
||||
@@ -39,11 +40,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.ResourceDirectoryTable);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -80,11 +77,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, string signature, COFFFileHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, string? signature, COFFFileHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" COFF File Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -106,11 +99,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, OptionalHeader header, SectionHeader[] table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, OptionalHeader? header, SectionHeader?[]? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Optional Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -171,49 +160,49 @@ namespace SabreTools.Printing
|
||||
{
|
||||
builder.AppendLine(" Export Table (1)");
|
||||
builder.AppendLine(header.ExportTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.ExportTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.ExportTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.ExportTable.Size, " Size");
|
||||
}
|
||||
if (header.ImportTable != null)
|
||||
{
|
||||
builder.AppendLine(" Import Table (2)");
|
||||
builder.AppendLine(header.ImportTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.ImportTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.ImportTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.ImportTable.Size, " Size");
|
||||
}
|
||||
if (header.ResourceTable != null)
|
||||
{
|
||||
builder.AppendLine(" Resource Table (3)");
|
||||
builder.AppendLine(header.ResourceTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.ResourceTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.ResourceTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.ResourceTable.Size, " Size");
|
||||
}
|
||||
if (header.ExceptionTable != null)
|
||||
{
|
||||
builder.AppendLine(" Exception Table (4)");
|
||||
builder.AppendLine(header.ExceptionTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.ExceptionTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.ExceptionTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.ExceptionTable.Size, " Size");
|
||||
}
|
||||
if (header.CertificateTable != null)
|
||||
{
|
||||
builder.AppendLine(" Certificate Table (5)");
|
||||
builder.AppendLine(header.CertificateTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.CertificateTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.CertificateTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.CertificateTable.Size, " Size");
|
||||
}
|
||||
if (header.BaseRelocationTable != null)
|
||||
{
|
||||
builder.AppendLine(" Base Relocation Table (6)");
|
||||
builder.AppendLine(header.BaseRelocationTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.BaseRelocationTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.BaseRelocationTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.BaseRelocationTable.Size, " Size");
|
||||
}
|
||||
if (header.Debug != null)
|
||||
{
|
||||
builder.AppendLine(" Debug Table (7)");
|
||||
builder.AppendLine(header.Debug.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.Debug.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.Debug.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.Debug.Size, " Size");
|
||||
}
|
||||
if (header.NumberOfRvaAndSizes >= 8)
|
||||
@@ -227,49 +216,49 @@ namespace SabreTools.Printing
|
||||
{
|
||||
builder.AppendLine(" Global Pointer Register (9)");
|
||||
builder.AppendLine(header.GlobalPtr.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.GlobalPtr.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.GlobalPtr.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.GlobalPtr.Size, " Size");
|
||||
}
|
||||
if (header.ThreadLocalStorageTable != null)
|
||||
{
|
||||
builder.AppendLine(" Thread Local Storage (TLS) Table (10)");
|
||||
builder.AppendLine(header.ThreadLocalStorageTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.ThreadLocalStorageTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.ThreadLocalStorageTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.ThreadLocalStorageTable.Size, " Size");
|
||||
}
|
||||
if (header.LoadConfigTable != null)
|
||||
{
|
||||
builder.AppendLine(" Load Config Table (11)");
|
||||
builder.AppendLine(header.LoadConfigTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.LoadConfigTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.LoadConfigTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.LoadConfigTable.Size, " Size");
|
||||
}
|
||||
if (header.BoundImport != null)
|
||||
{
|
||||
builder.AppendLine(" Bound Import Table (12)");
|
||||
builder.AppendLine(header.BoundImport.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.BoundImport.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.BoundImport.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.BoundImport.Size, " Size");
|
||||
}
|
||||
if (header.ImportAddressTable != null)
|
||||
{
|
||||
builder.AppendLine(" Import Address Table (13)");
|
||||
builder.AppendLine(header.ImportAddressTable.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.ImportAddressTable.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.ImportAddressTable.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.ImportAddressTable.Size, " Size");
|
||||
}
|
||||
if (header.DelayImportDescriptor != null)
|
||||
{
|
||||
builder.AppendLine(" Delay Import Descriptior (14)");
|
||||
builder.AppendLine(header.DelayImportDescriptor.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.DelayImportDescriptor.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.DelayImportDescriptor.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.DelayImportDescriptor.Size, " Size");
|
||||
}
|
||||
if (header.CLRRuntimeHeader != null)
|
||||
{
|
||||
builder.AppendLine(" CLR Runtime Header (15)");
|
||||
builder.AppendLine(header.CLRRuntimeHeader.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(header.CLRRuntimeHeader.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(header.CLRRuntimeHeader.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(header.CLRRuntimeHeader.Size, " Size");
|
||||
}
|
||||
if (header.NumberOfRvaAndSizes >= 16)
|
||||
@@ -282,11 +271,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, SectionHeader[] table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, SectionHeader?[]? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Section Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -297,11 +282,7 @@ namespace SabreTools.Printing
|
||||
return;
|
||||
}
|
||||
|
||||
#if NET48
|
||||
for (int i = 0; i < table.Length; i++)
|
||||
#else
|
||||
for (int i = 0; i < table!.Length; i++)
|
||||
#endif
|
||||
for (int i = 0; i < table!.Length; i++)
|
||||
{
|
||||
var entry = table[i];
|
||||
builder.AppendLine($" Section Table Entry {i}");
|
||||
@@ -311,10 +292,10 @@ namespace SabreTools.Printing
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.Name, " Name");
|
||||
builder.AppendLine(entry.Name, " Name", Encoding.ASCII);
|
||||
builder.AppendLine(entry.VirtualSize, " Virtual size");
|
||||
builder.AppendLine(entry.VirtualAddress, " Virtual address");
|
||||
builder.AppendLine(entry.VirtualAddress.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Physical address");
|
||||
builder.AppendLine(entry.VirtualAddress.ConvertVirtualAddress(table), " Physical address");
|
||||
builder.AppendLine(entry.SizeOfRawData, " Size of raw data");
|
||||
builder.AppendLine(entry.PointerToRawData, " Pointer to raw data");
|
||||
builder.AppendLine(entry.PointerToRelocations, " Pointer to relocations");
|
||||
@@ -328,11 +309,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, COFFSymbolTableEntry[] symbolTable)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, COFFSymbolTableEntry?[]? symbolTable)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" COFF Symbol Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -360,7 +337,7 @@ namespace SabreTools.Printing
|
||||
{
|
||||
if (entry.ShortName != null)
|
||||
{
|
||||
builder.AppendLine(entry.ShortName, " Short name");
|
||||
builder.AppendLine(entry.ShortName, " Short name", Encoding.ASCII);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -438,7 +415,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
else if (currentSymbolType == 4)
|
||||
{
|
||||
builder.AppendLine(entry.AuxFormat4FileName, " File name");
|
||||
builder.AppendLine(entry.AuxFormat4FileName, " File name", Encoding.ASCII);
|
||||
auxSymbolsRemaining--;
|
||||
}
|
||||
else if (currentSymbolType == 5)
|
||||
@@ -468,11 +445,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, COFFStringTable stringTable)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, COFFStringTable? stringTable)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" COFF String Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -486,22 +459,14 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine(stringTable.TotalSize, " Total size");
|
||||
for (int i = 0; i < stringTable.Strings.Length; i++)
|
||||
{
|
||||
#if NET48
|
||||
string entry = stringTable.Strings[i];
|
||||
#else
|
||||
string? entry = stringTable.Strings[i];
|
||||
#endif
|
||||
builder.AppendLine($" COFF String Table Entry {i})");
|
||||
builder.AppendLine(entry, " Value");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, AttributeCertificateTableEntry[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, AttributeCertificateTableEntry?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Attribute Certificate Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -570,11 +535,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DelayLoadDirectoryTable table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DelayLoadDirectoryTable? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Delay-Load Directory Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -596,11 +557,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, BaseRelocationBlock[] entries, SectionHeader[] table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, BaseRelocationBlock?[]? entries, SectionHeader?[]? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Base Relocation Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -622,7 +579,7 @@ namespace SabreTools.Printing
|
||||
}
|
||||
|
||||
builder.AppendLine(baseRelocationTableEntry.PageRVA, " Page RVA");
|
||||
builder.AppendLine(baseRelocationTableEntry.PageRVA.ConvertVirtualAddress(table ?? Array.Empty<SectionHeader>()), " Page physical address");
|
||||
builder.AppendLine(baseRelocationTableEntry.PageRVA.ConvertVirtualAddress(table), " Page physical address");
|
||||
builder.AppendLine(baseRelocationTableEntry.BlockSize, " Block size");
|
||||
|
||||
builder.AppendLine($" Base Relocation Table {i} Type and Offset Information:");
|
||||
@@ -637,13 +594,12 @@ namespace SabreTools.Printing
|
||||
{
|
||||
var typeOffsetFieldEntry = baseRelocationTableEntry.TypeOffsetFieldEntries[j];
|
||||
builder.AppendLine($" Type and Offset Entry {j}");
|
||||
#if NET6_0_OR_GREATER
|
||||
if (typeOffsetFieldEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (typeOffsetFieldEntry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine($" Type: {typeOffsetFieldEntry.BaseRelocationType} (0x{typeOffsetFieldEntry.BaseRelocationType:X})");
|
||||
builder.AppendLine(typeOffsetFieldEntry.Offset, " Offset");
|
||||
}
|
||||
@@ -651,11 +607,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DebugTable table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DebugTable? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Debug Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -689,11 +641,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExportTable table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExportTable? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Export Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -802,11 +750,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ImportTable table, SectionHeader[] sectionTable)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ImportTable? table, SectionHeader?[]? sectionTable)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Import Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -837,13 +781,13 @@ namespace SabreTools.Printing
|
||||
}
|
||||
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportLookupTableRVA, " Import lookup table RVA");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportLookupTableRVA.ConvertVirtualAddress(sectionTable ?? Array.Empty<SectionHeader>()), " Import lookup table Physical Address");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportLookupTableRVA.ConvertVirtualAddress(sectionTable), " Import lookup table Physical Address");
|
||||
builder.AppendLine(importDirectoryTableEntry.TimeDateStamp, " Time/Date stamp");
|
||||
builder.AppendLine(importDirectoryTableEntry.ForwarderChain, " Forwarder chain");
|
||||
builder.AppendLine(importDirectoryTableEntry.NameRVA, " Name RVA");
|
||||
builder.AppendLine(importDirectoryTableEntry.Name, " Name");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportAddressTableRVA, " Import address table RVA");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportAddressTableRVA.ConvertVirtualAddress(sectionTable ?? Array.Empty<SectionHeader>()), " Import address table Physical Address");
|
||||
builder.AppendLine(importDirectoryTableEntry.ImportAddressTableRVA.ConvertVirtualAddress(sectionTable), " Import address table Physical Address");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
@@ -888,7 +832,7 @@ namespace SabreTools.Printing
|
||||
else
|
||||
{
|
||||
builder.AppendLine(importLookupTableEntry.HintNameTableRVA, " Hint/Name table RVA");
|
||||
builder.AppendLine(importLookupTableEntry.HintNameTableRVA.ConvertVirtualAddress(sectionTable ?? Array.Empty<SectionHeader>()), " Hint/Name table Physical Address");
|
||||
builder.AppendLine(importLookupTableEntry.HintNameTableRVA.ConvertVirtualAddress(sectionTable), " Hint/Name table Physical Address");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -935,7 +879,7 @@ namespace SabreTools.Printing
|
||||
else
|
||||
{
|
||||
builder.AppendLine(importAddressTableEntry.HintNameTableRVA, " Hint/Name table RVA");
|
||||
builder.AppendLine(importAddressTableEntry.HintNameTableRVA.ConvertVirtualAddress(sectionTable ?? Array.Empty<SectionHeader>()), " Hint/Name table Physical Address");
|
||||
builder.AppendLine(importAddressTableEntry.HintNameTableRVA.ConvertVirtualAddress(sectionTable), " Hint/Name table Physical Address");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -967,11 +911,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ResourceDirectoryTable table)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ResourceDirectoryTable? table)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Resource Directory Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -982,13 +922,13 @@ namespace SabreTools.Printing
|
||||
return;
|
||||
}
|
||||
|
||||
Print(table, level: 0, types: new List<object>(), builder);
|
||||
Print(table, level: 0, types: [], builder);
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(ResourceDirectoryTable table, int level, List<object> types, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
builder.AppendLine(level, $"{padding}Table level");
|
||||
builder.AppendLine(table.Characteristics, $"{padding}Characteristics");
|
||||
@@ -1017,7 +957,7 @@ namespace SabreTools.Printing
|
||||
if (entry == null)
|
||||
continue;
|
||||
|
||||
var newTypes = new List<object>(types ?? new List<object>());
|
||||
var newTypes = new List<object>(types ?? []);
|
||||
if (entry.Name?.UnicodeString != null)
|
||||
newTypes.Add(Encoding.UTF8.GetString(entry.Name.UnicodeString));
|
||||
else
|
||||
@@ -1030,13 +970,13 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceDirectoryEntry(ResourceDirectoryEntry entry, int level, List<object> types, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
builder.AppendLine(level, $"{padding}Item level");
|
||||
if (entry.NameOffset != default)
|
||||
{
|
||||
builder.AppendLine(entry.NameOffset, $"{padding}Name offset");
|
||||
builder.AppendLine(entry.Name?.UnicodeString, $"{padding}Name ({entry.Name?.Length ?? 0})");
|
||||
builder.AppendLine(entry.Name?.UnicodeString, $"{padding}Name ({entry.Name?.Length ?? 0})", Encoding.Unicode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1051,10 +991,10 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceDataEntry(ResourceDataEntry entry, int level, List<object> types, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
// TODO: Use ordered list of base types to determine the shape of the data
|
||||
builder.AppendLine($"{padding}Base types: {string.Join(", ", types)}");
|
||||
builder.AppendLine($"{padding}Base types: {string.Join(", ", types.Select(t => t.ToString()).ToArray())}");
|
||||
|
||||
builder.AppendLine(level, $"{padding}Entry level");
|
||||
builder.AppendLine(entry.DataRVA, $"{padding}Data RVA");
|
||||
@@ -1145,31 +1085,27 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_CURSOR(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Hardware-dependent cursor resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_BITMAP(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Bitmap resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_ICON(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Hardware-dependent icon resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_MENU(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
MenuResource menu = null;
|
||||
#else
|
||||
MenuResource? menu = null;
|
||||
#endif
|
||||
try { menu = entry.AsMenu(); } catch { }
|
||||
if (menu == null)
|
||||
{
|
||||
@@ -1257,13 +1193,9 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_DIALOG(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
DialogBoxResource dialogBox = null;
|
||||
#else
|
||||
DialogBoxResource? dialogBox = null;
|
||||
#endif
|
||||
try { dialogBox = entry.AsDialogBox(); } catch { }
|
||||
if (dialogBox == null)
|
||||
{
|
||||
@@ -1396,13 +1328,9 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_STRING(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
Dictionary<int, string> stringTable = null;
|
||||
#else
|
||||
Dictionary<int, string?>? stringTable = null;
|
||||
#endif
|
||||
try { stringTable = entry.AsStringTable(); } catch { }
|
||||
if (stringTable == null)
|
||||
{
|
||||
@@ -1413,36 +1341,28 @@ namespace SabreTools.Printing
|
||||
foreach (var kvp in stringTable)
|
||||
{
|
||||
int index = kvp.Key;
|
||||
#if NET48
|
||||
string stringValue = kvp.Value;
|
||||
#else
|
||||
string? stringValue = kvp.Value;
|
||||
#endif
|
||||
builder.AppendLine(stringValue, $"{padding}String entry {index}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_FONTDIR(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Font directory resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_FONT(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Font resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_ACCELERATOR(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
AcceleratorTableEntry[] acceleratorTable = null;
|
||||
#else
|
||||
AcceleratorTableEntry[]? acceleratorTable = null;
|
||||
#endif
|
||||
try { acceleratorTable = entry.AsAcceleratorTableResource(); } catch { }
|
||||
if (acceleratorTable == null)
|
||||
{
|
||||
@@ -1463,7 +1383,7 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_RCDATA(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Application-defined resource found, not parsed yet");
|
||||
|
||||
// Then print the data, if needed
|
||||
@@ -1474,11 +1394,7 @@ namespace SabreTools.Printing
|
||||
else
|
||||
{
|
||||
int offset = 0;
|
||||
#if NET48
|
||||
byte[] magic = entry.Data.ReadBytes(ref offset, Math.Min(entry.Data.Length, 16));
|
||||
#else
|
||||
byte[]? magic = entry.Data.ReadBytes(ref offset, Math.Min(entry.Data.Length, 16));
|
||||
#endif
|
||||
|
||||
if (magic == null)
|
||||
{
|
||||
@@ -1510,13 +1426,9 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_MESSAGETABLE(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
MessageResourceData messageTable = null;
|
||||
#else
|
||||
MessageResourceData? messageTable = null;
|
||||
#endif
|
||||
try { messageTable = entry.AsMessageResourceData(); } catch { }
|
||||
if (messageTable == null)
|
||||
{
|
||||
@@ -1581,25 +1493,21 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_GROUP_CURSOR(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Hardware-independent cursor resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_GROUP_ICON(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Hardware-independent icon resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_VERSION(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
VersionInfo versionInfo = null;
|
||||
#else
|
||||
VersionInfo? versionInfo = null;
|
||||
#endif
|
||||
try { versionInfo = entry.AsVersionInfo(); } catch { }
|
||||
if (versionInfo == null)
|
||||
{
|
||||
@@ -1718,37 +1626,37 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_DLGINCLUDE(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}External header resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_PLUGPLAY(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Plug and Play resource found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_VXD(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}VXD found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_ANICURSOR(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Animated cursor found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_ANIICON(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}Animated icon found, not parsed yet");
|
||||
}
|
||||
|
||||
private static void PrintResourceRT_HTML(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
builder.AppendLine($"{padding}HTML resource found, not parsed yet");
|
||||
|
||||
//if (entry.Data != null)
|
||||
@@ -1761,13 +1669,9 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceRT_MANIFEST(ResourceDataEntry entry, int level, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
#if NET48
|
||||
AssemblyManifest assemblyManifest = null;
|
||||
#else
|
||||
AssemblyManifest? assemblyManifest = null;
|
||||
#endif
|
||||
try { assemblyManifest = entry.AsAssemblyManifest(); } catch { }
|
||||
if (assemblyManifest == null)
|
||||
{
|
||||
@@ -1983,7 +1887,7 @@ namespace SabreTools.Printing
|
||||
|
||||
private static void PrintResourceUNKNOWN(ResourceDataEntry entry, int level, object resourceType, StringBuilder builder)
|
||||
{
|
||||
string padding = new string(' ', (level + 1) * 2);
|
||||
string padding = new(' ', (level + 1) * 2);
|
||||
|
||||
// Print the type first
|
||||
if (resourceType is uint numericType)
|
||||
@@ -2001,12 +1905,8 @@ namespace SabreTools.Printing
|
||||
else
|
||||
{
|
||||
int offset = 0;
|
||||
#if NET48
|
||||
byte[] magic = entry.Data.ReadBytes(ref offset, Math.Min(entry.Data.Length, 16));
|
||||
#else
|
||||
byte[]? magic = entry.Data.ReadBytes(ref offset, Math.Min(entry.Data.Length, 16));
|
||||
#endif
|
||||
|
||||
byte[]? magic = entry.Data.ReadBytes(ref offset, Math.Min(entry.Data.Length, 16));
|
||||
if (magic == null)
|
||||
{
|
||||
// No-op
|
||||
|
||||
@@ -17,11 +17,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -41,11 +37,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, FileDescriptor[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, FileDescriptor?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" File List Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# SabreTools.Printing
|
||||
|
||||
This library comprises of code to output human-readable representations of various (usually binary) models. All of the classes here are `static` and utilize `StringBuilder`.
|
||||
|
||||
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Printing).
|
||||
|
||||
48
SGA.cs
48
SGA.cs
@@ -19,11 +19,7 @@ namespace SabreTools.Printing
|
||||
// TODO: Should we print the string table?
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -58,11 +54,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Directory directory)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Directory? directory)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -110,11 +102,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryHeader4 header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryHeader4? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -136,11 +124,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryHeader5 header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryHeader5? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -162,11 +146,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryHeader7 header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryHeader7? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -190,11 +170,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Section4[] sections)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Section4?[]? sections)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Sections Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -226,11 +202,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Section5[] sections)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Section5?[]? sections)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Sections Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -262,11 +234,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Folder4[] folders)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Folder4?[]? folders)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Folders Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -297,11 +265,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Folder5[] folders)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Folder5?[]? folders)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Folders Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -332,11 +296,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, File4[] files)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, File4?[]? files)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -369,11 +329,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, File6[] files)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, File6?[]? files)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -407,11 +363,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, File7[] files)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, File7?[]? files)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
@@ -2,15 +2,17 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net48;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
|
||||
<Version>1.1.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.3.1</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
<Description>Pretty-printing library for various models</Description>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2022-2023</Copyright>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2022-2024</Copyright>
|
||||
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/SabreTools/SabreTools.Printing</RepositoryUrl>
|
||||
@@ -19,19 +21,15 @@
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(TargetFramework)'!='net48'">
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath=""/>
|
||||
<None Include="README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.ASN1" Version="1.1.0" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.1.1" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.1.2" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.1.5" />
|
||||
<PackageReference Include="SabreTools.ASN1" Version="1.3.0" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.3.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.3.0" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.3.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
8
VBSP.cs
8
VBSP.cs
@@ -15,11 +15,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.Header);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -38,11 +34,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, header.Lumps);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Lump[] lumps)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Lump?[]? lumps)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
20
VPK.cs
20
VPK.cs
@@ -17,11 +17,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.DirectoryItems);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -38,11 +34,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ExtendedHeader header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ExtendedHeader? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Extended Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -60,11 +52,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, ArchiveHash[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, ArchiveHash?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Archive Hashes Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -93,11 +81,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryItem[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryItem?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -130,11 +114,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryEntry entry)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryEntry? entry)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Entry:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
12
WAD.cs
12
WAD.cs
@@ -16,11 +16,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.LumpInfos);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -37,11 +33,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Lump[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Lump?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Lumps Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -74,11 +66,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, LumpInfo[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, LumpInfo?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Lump Infos Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
23
XMID.cs
Normal file
23
XMID.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.Text;
|
||||
using static SabreTools.Models.Xbox.Constants;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
{
|
||||
public static class XMID
|
||||
{
|
||||
public static void Print(StringBuilder builder, Models.Xbox.XMID xmid)
|
||||
{
|
||||
builder.AppendLine("Xbox Media Identifier Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine(xmid.PublisherIdentifier, "Publisher identifier");
|
||||
if (!string.IsNullOrEmpty(xmid.PublisherIdentifier) && Publishers.ContainsKey(xmid.PublisherIdentifier ?? string.Empty))
|
||||
builder.AppendLine(Publishers[xmid.PublisherIdentifier ?? string.Empty], "Publisher");
|
||||
builder.AppendLine(xmid.GameID, "Game ID");
|
||||
builder.AppendLine(xmid.VersionNumber, "Version number");
|
||||
builder.AppendLine(xmid.RegionIdentifier, "Region identifier");
|
||||
if (Regions.ContainsKey(xmid.RegionIdentifier))
|
||||
builder.AppendLine(Regions[xmid.RegionIdentifier], "Region");
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
20
XZP.cs
20
XZP.cs
@@ -19,11 +19,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, file.Footer);
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -46,11 +42,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryEntry[] entries, string prefix)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryEntry?[]? entries, string prefix)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine($" {prefix} Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -78,11 +70,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryMapping[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryMapping?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Preload Directory Mappings Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -108,11 +96,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, DirectoryItem[] entries)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, DirectoryItem?[]? entries)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Directory Items Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -141,11 +125,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
#if NET48
|
||||
private static void Print(StringBuilder builder, Footer footer)
|
||||
#else
|
||||
private static void Print(StringBuilder builder, Footer? footer)
|
||||
#endif
|
||||
{
|
||||
builder.AppendLine(" Footer Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
|
||||
30
XeMID.cs
Normal file
30
XeMID.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Text;
|
||||
using static SabreTools.Models.Xbox.Constants;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
{
|
||||
public static class XeMID
|
||||
{
|
||||
public static void Print(StringBuilder builder, Models.Xbox.XeMID xemid)
|
||||
{
|
||||
builder.AppendLine("Xbox Media Identifier Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine(xemid.PublisherIdentifier, "Publisher identifier");
|
||||
if (!string.IsNullOrEmpty(xemid.PublisherIdentifier) && Publishers.ContainsKey(xemid.PublisherIdentifier ?? string.Empty))
|
||||
builder.AppendLine(Publishers[xemid.PublisherIdentifier ?? string.Empty], "Publisher");
|
||||
builder.AppendLine(xemid.PlatformIdentifier, "Platform identifier");
|
||||
builder.AppendLine(xemid.GameID, "Game ID");
|
||||
builder.AppendLine(xemid.SKU, "SKU");
|
||||
builder.AppendLine(xemid.RegionIdentifier, "Region identifier");
|
||||
if (Regions.ContainsKey(xemid.RegionIdentifier))
|
||||
builder.AppendLine(Regions[xemid.RegionIdentifier], "Region");
|
||||
builder.AppendLine(xemid.BaseVersion, "Base version");
|
||||
builder.AppendLine(xemid.MediaSubtypeIdentifier, "Media subtype identifier");
|
||||
if (MediaSubtypes.ContainsKey(xemid.MediaSubtypeIdentifier))
|
||||
builder.AppendLine(MediaSubtypes[xemid.MediaSubtypeIdentifier], "Media subtype");
|
||||
builder.AppendLine(xemid.DiscNumberIdentifier, "Disc number identifier");
|
||||
builder.AppendLine(xemid.CertificationSubmissionIdentifier, "Certification submission identifier");
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user