mirror of
https://github.com/SabreTools/SabreTools.Printing.git
synced 2026-04-22 22:23:07 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6e38f6868 | ||
|
|
d900eeb2d2 | ||
|
|
bd49efa14a | ||
|
|
93cd267b00 | ||
|
|
668b4bada7 | ||
|
|
36ddb62def | ||
|
|
1de4cede1b |
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.IRD 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ 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");
|
||||
@@ -360,7 +360,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 +438,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)
|
||||
@@ -1036,7 +1036,7 @@ namespace SabreTools.Printing
|
||||
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
|
||||
{
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!-- 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>
|
||||
<Version>1.1.2</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
||||
<!-- Package Properties -->
|
||||
@@ -30,8 +30,8 @@
|
||||
<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.Models" Version="1.1.5" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.1.7" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
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.IsNullOrWhiteSpace(xmid.PublisherIdentifier) && Publishers.ContainsKey(xmid.PublisherIdentifier))
|
||||
builder.AppendLine(Publishers[xmid.PublisherIdentifier], "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();
|
||||
}
|
||||
}
|
||||
}
|
||||
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.IsNullOrWhiteSpace(xemid.PublisherIdentifier) && Publishers.ContainsKey(xemid.PublisherIdentifier))
|
||||
builder.AppendLine(Publishers[xemid.PublisherIdentifier], "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