mirror of
https://github.com/SabreTools/SabreTools.Printing.git
synced 2026-04-22 22:23:07 +00:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f450da1621 | ||
|
|
d2c68eef4b | ||
|
|
65facd03d1 | ||
|
|
606d2268e7 | ||
|
|
c65bbe9fd6 | ||
|
|
e4a98f1e73 | ||
|
|
0cf4d46de0 | ||
|
|
913caddb10 | ||
|
|
df6b77812a | ||
|
|
a175ab0309 | ||
|
|
792e5042bd | ||
|
|
2d08b97910 | ||
|
|
d6a60070bb | ||
|
|
5956e15486 | ||
|
|
ead32b3422 | ||
|
|
b320fc8985 | ||
|
|
f4bd465866 | ||
|
|
3a2371b64f | ||
|
|
ca8f8a7838 | ||
|
|
b1866d9710 | ||
|
|
29af485574 | ||
|
|
17fefa2ab4 | ||
|
|
3ff29666ed | ||
|
|
e093e4e768 | ||
|
|
25b6c52327 | ||
|
|
dff654af5c | ||
|
|
6f6451ff40 | ||
|
|
b28f5011ac | ||
|
|
56d8077216 | ||
|
|
9fd534f539 | ||
|
|
19aefca0e1 | ||
|
|
4dce7a7fa4 | ||
|
|
ed2f53526c |
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: 'SabreTools.Printing/bin/Release/*.nupkg'
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: 'SabreTools.Printing/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
|
||||
@@ -1,5 +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`.
|
||||
This library comprises of code to output human-readable representations of various (usually binary) models. All of the classes here implement the `IPrinter` interface to associate them with a top-level model and utilize `StringBuilder` within `static` implementations.
|
||||
|
||||
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Printing).
|
||||
|
||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Printing", "SabreTools.Printing.csproj", "{4274AA02-00A0-48F1-98C4-B3286E547246}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Printing", "SabreTools.Printing\SabreTools.Printing.csproj", "{4274AA02-00A0-48F1-98C4-B3286E547246}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
18
SabreTools.Printing/Interfaces/IPrinter.cs
Normal file
18
SabreTools.Printing/Interfaces/IPrinter.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Printing.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Marks a class as a printer associated with a model
|
||||
/// </summary>
|
||||
/// <typeparam name="TModel">Type of the top-level model</typeparam>
|
||||
public interface IPrinter<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Print information associated with a model
|
||||
/// </summary>
|
||||
/// <param name="builder">StringBuilder to append information to</param>
|
||||
/// <param name="model">Model to print</param>
|
||||
void PrintInformation(StringBuilder builder, TModel model);
|
||||
}
|
||||
}
|
||||
430
SabreTools.Printing/PrintExtensions.cs
Normal file
430
SabreTools.Printing/PrintExtensions.cs
Normal file
@@ -0,0 +1,430 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Printing.Printers;
|
||||
using SabreTools.Serialization.Interfaces;
|
||||
using Wrapper = SabreTools.Serialization.Wrappers;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic wrapper around printing methods
|
||||
/// </summary>
|
||||
public static class PrintExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Print the item information from a wrapper to console as
|
||||
/// pretty-printed text
|
||||
/// </summary>
|
||||
public static void PrintToConsole(this IWrapper wrapper)
|
||||
{
|
||||
var sb = wrapper.ExportStringBuilder();
|
||||
if (sb == null)
|
||||
{
|
||||
Console.WriteLine("No item information could be generated");
|
||||
return;
|
||||
}
|
||||
|
||||
Console.WriteLine(sb.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder? ExportStringBuilder(this IWrapper wrapper)
|
||||
{
|
||||
return wrapper switch
|
||||
{
|
||||
Wrapper.AACSMediaKeyBlock item => item.PrettyPrint(),
|
||||
Wrapper.BDPlusSVM item => item.PrettyPrint(),
|
||||
Wrapper.BFPK item => item.PrettyPrint(),
|
||||
Wrapper.BSP item => item.PrettyPrint(),
|
||||
Wrapper.CFB item => item.PrettyPrint(),
|
||||
Wrapper.CIA item => item.PrettyPrint(),
|
||||
Wrapper.GCF item => item.PrettyPrint(),
|
||||
Wrapper.InstallShieldCabinet item => item.PrettyPrint(),
|
||||
Wrapper.IRD item => item.PrettyPrint(),
|
||||
Wrapper.LinearExecutable item => item.PrettyPrint(),
|
||||
Wrapper.MicrosoftCabinet item => item.PrettyPrint(),
|
||||
Wrapper.MoPaQ item => item.PrettyPrint(),
|
||||
Wrapper.MSDOS item => item.PrettyPrint(),
|
||||
Wrapper.N3DS item => item.PrettyPrint(),
|
||||
Wrapper.NCF item => item.PrettyPrint(),
|
||||
Wrapper.NewExecutable item => item.PrettyPrint(),
|
||||
Wrapper.Nitro item => item.PrettyPrint(),
|
||||
Wrapper.PAK item => item.PrettyPrint(),
|
||||
Wrapper.PFF item => item.PrettyPrint(),
|
||||
Wrapper.PIC item => item.PrettyPrint(),
|
||||
Wrapper.PlayJAudioFile item => item.PrettyPrint(),
|
||||
Wrapper.PlayJPlaylist item => item.PrettyPrint(),
|
||||
Wrapper.PortableExecutable item => item.PrettyPrint(),
|
||||
Wrapper.Quantum item => item.PrettyPrint(),
|
||||
Wrapper.SGA item => item.PrettyPrint(),
|
||||
Wrapper.VBSP item => item.PrettyPrint(),
|
||||
Wrapper.VPK item => item.PrettyPrint(),
|
||||
Wrapper.WAD item => item.PrettyPrint(),
|
||||
Wrapper.XeMID item => item.PrettyPrint(),
|
||||
Wrapper.XMID item => item.PrettyPrint(),
|
||||
Wrapper.XZP item => item.PrettyPrint(),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Export the item information as JSON
|
||||
/// </summary>
|
||||
public static string ExportJSON(this IWrapper wrapper)
|
||||
{
|
||||
return wrapper switch
|
||||
{
|
||||
Wrapper.AACSMediaKeyBlock item => item.ExportJSON(),
|
||||
Wrapper.BDPlusSVM item => item.ExportJSON(),
|
||||
Wrapper.BFPK item => item.ExportJSON(),
|
||||
Wrapper.BSP item => item.ExportJSON(),
|
||||
Wrapper.CFB item => item.ExportJSON(),
|
||||
Wrapper.CIA item => item.ExportJSON(),
|
||||
Wrapper.GCF item => item.ExportJSON(),
|
||||
Wrapper.InstallShieldCabinet item => item.ExportJSON(),
|
||||
Wrapper.IRD item => item.ExportJSON(),
|
||||
Wrapper.LinearExecutable item => item.ExportJSON(),
|
||||
Wrapper.MicrosoftCabinet item => item.ExportJSON(),
|
||||
Wrapper.MoPaQ item => item.ExportJSON(),
|
||||
Wrapper.MSDOS item => item.ExportJSON(),
|
||||
Wrapper.N3DS item => item.ExportJSON(),
|
||||
Wrapper.NCF item => item.ExportJSON(),
|
||||
Wrapper.NewExecutable item => item.ExportJSON(),
|
||||
Wrapper.Nitro item => item.ExportJSON(),
|
||||
Wrapper.PAK item => item.ExportJSON(),
|
||||
Wrapper.PFF item => item.ExportJSON(),
|
||||
Wrapper.PIC item => item.ExportJSON(),
|
||||
Wrapper.PlayJAudioFile item => item.ExportJSON(),
|
||||
Wrapper.PlayJPlaylist item => item.ExportJSON(),
|
||||
Wrapper.PortableExecutable item => item.ExportJSON(),
|
||||
Wrapper.Quantum item => item.ExportJSON(),
|
||||
Wrapper.SGA item => item.ExportJSON(),
|
||||
Wrapper.VBSP item => item.ExportJSON(),
|
||||
Wrapper.VPK item => item.ExportJSON(),
|
||||
Wrapper.WAD item => item.ExportJSON(),
|
||||
Wrapper.XeMID item => item.ExportJSON(),
|
||||
Wrapper.XMID item => item.ExportJSON(),
|
||||
Wrapper.XZP item => item.ExportJSON(),
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#region Static Printing Implementations
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.AACSMediaKeyBlock item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
AACSMediaKeyBlock.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.BDPlusSVM item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
BDPlusSVM.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.BFPK item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
BFPK.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.BSP item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
BSP.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.CFB item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
CFB.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.CIA item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
CIA.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.GCF item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
GCF.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.InstallShieldCabinet item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
InstallShieldCabinet.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.IRD item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
IRD.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.LinearExecutable item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
LinearExecutable.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.MicrosoftCabinet item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
MicrosoftCabinet.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.MoPaQ item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
MoPaQ.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.MSDOS item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
MSDOS.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.N3DS item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
N3DS.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.NCF item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
NCF.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.NewExecutable item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
NewExecutable.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.Nitro item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
Nitro.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.PAK item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
PAK.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.PFF item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
PFF.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.PIC item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
PIC.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.PlayJAudioFile item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
PlayJAudioFile.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.PlayJPlaylist item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
PlayJPlaylist.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.PortableExecutable item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
PortableExecutable.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.Quantum item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
Quantum.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.SGA item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
SGA.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.VBSP item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
VBSP.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.VPK item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
VPK.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.WAD item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
WAD.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.XeMID item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
XeMID.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.XMID item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
XMID.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Export the item information as pretty-printed text
|
||||
/// </summary>
|
||||
private static StringBuilder PrettyPrint(this Wrapper.XZP item)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
XZP.Print(builder, item.Model);
|
||||
return builder;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.AACS;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class AACSMediaKeyBlock
|
||||
public class AACSMediaKeyBlock : IPrinter<MediaKeyBlock>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, MediaKeyBlock model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, MediaKeyBlock mediaKeyBlock)
|
||||
{
|
||||
builder.AppendLine("AACS Media Key Block Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.BDPlus;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class BDPlusSVM
|
||||
public class BDPlusSVM : IPrinter<SVM>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, SVM model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, SVM svm)
|
||||
{
|
||||
builder.AppendLine("BD+ SVM Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.BFPK;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class BFPK
|
||||
public class BFPK : IPrinter<Archive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Archive model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Archive archive)
|
||||
{
|
||||
builder.AppendLine("BFPK Information:");
|
||||
@@ -1,11 +1,16 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.BSP;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
using static SabreTools.Models.BSP.Constants;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class BSP
|
||||
public class BSP : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("BSP Information:");
|
||||
@@ -141,6 +146,5 @@ namespace SabreTools.Printing
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Models.CFB;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class CFB
|
||||
public class CFB : IPrinter<Binary>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Binary model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Binary binary)
|
||||
{
|
||||
builder.AppendLine("Compound File Binary Information:");
|
||||
@@ -116,6 +121,5 @@ namespace SabreTools.Printing
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.N3DS;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class CIA
|
||||
public class CIA : IPrinter<Models.N3DS.CIA>
|
||||
{
|
||||
public static void Print(StringBuilder builder, SabreTools.Models.N3DS.CIA cia)
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Models.N3DS.CIA model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Models.N3DS.CIA cia)
|
||||
{
|
||||
builder.AppendLine("CIA Archive Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.GCF;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class GCF
|
||||
public class GCF : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("GCF Information:");
|
||||
@@ -1,10 +1,16 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.IRD;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class IRD
|
||||
public class IRD : IPrinter<File>
|
||||
{
|
||||
public static void Print(StringBuilder builder, Models.IRD.File ird)
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File ird)
|
||||
{
|
||||
builder.AppendLine("IRD Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
@@ -1,12 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Models.InstallShieldCabinet;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class InstallShieldCabinet
|
||||
public class InstallShieldCabinet : IPrinter<Cabinet>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Cabinet model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Cabinet cabinet)
|
||||
{
|
||||
builder.AppendLine("InstallShield Cabinet Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.LinearExecutable;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class LinearExecutable
|
||||
public class LinearExecutable : IPrinter<Executable>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Executable model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Executable executable)
|
||||
{
|
||||
builder.AppendLine("New Executable Information:");
|
||||
@@ -36,7 +41,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.DebugInformation);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader? header)
|
||||
private static void Print(StringBuilder builder, Models.MSDOS.ExecutableHeader? header)
|
||||
{
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -447,25 +452,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");
|
||||
@@ -473,27 +498,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");
|
||||
@@ -501,25 +550,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");
|
||||
@@ -527,19 +596,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");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.MSDOS;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class MSDOS
|
||||
public class MSDOS : IPrinter<Executable>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Executable model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Executable executable)
|
||||
{
|
||||
builder.AppendLine("MS-DOS Executable Information:");
|
||||
@@ -1,11 +1,15 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Models.MicrosoftCabinet;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class MicrosoftCabinet
|
||||
public class MicrosoftCabinet : IPrinter<Cabinet>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Cabinet model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Cabinet cabinet)
|
||||
{
|
||||
builder.AppendLine("Microsoft Cabinet Information:");
|
||||
@@ -42,7 +46,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");
|
||||
@@ -50,13 +58,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");
|
||||
243
SabreTools.Printing/Printers/MoPaQ.cs
Normal file
243
SabreTools.Printing/Printers/MoPaQ.cs
Normal file
@@ -0,0 +1,243 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.MoPaQ;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public class MoPaQ : IPrinter<Archive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Archive model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Archive archive)
|
||||
{
|
||||
builder.AppendLine("MoPaQ Archive Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
Print(builder, archive.UserData);
|
||||
Print(builder, archive.ArchiveHeader);
|
||||
Print(builder, archive.HetTable);
|
||||
Print(builder, archive.BetTable);
|
||||
Print(builder, archive.HashTable);
|
||||
Print(builder, archive.BlockTable);
|
||||
Print(builder, archive.HiBlockTable);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, UserData? userData)
|
||||
{
|
||||
builder.AppendLine(" User Data Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (userData == null)
|
||||
{
|
||||
builder.AppendLine(" No user data");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(userData.Signature, " Signature");
|
||||
builder.AppendLine(userData.UserDataSize, " User data size");
|
||||
builder.AppendLine(userData.HeaderOffset, " Header offset");
|
||||
builder.AppendLine(userData.UserDataHeaderSize, " User data header size");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ArchiveHeader? header)
|
||||
{
|
||||
builder.AppendLine(" Archive Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No archive header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Signature, " Signature");
|
||||
builder.AppendLine(header.HeaderSize, " Header size");
|
||||
builder.AppendLine(header.ArchiveSize, " Archive size");
|
||||
builder.AppendLine($" Format version: {header.FormatVersion} (0x{header.FormatVersion:X})");
|
||||
builder.AppendLine(header.BlockSize, " Block size");
|
||||
builder.AppendLine(header.HashTablePosition, " Hash table position");
|
||||
builder.AppendLine(header.BlockTablePosition, " Block table position");
|
||||
builder.AppendLine(header.HashTableSize, " Hash table size");
|
||||
builder.AppendLine(header.BlockTableSize, " Block table size");
|
||||
builder.AppendLine(header.HiBlockTablePosition, " Hi-block table position");
|
||||
builder.AppendLine(header.HashTablePositionHi, " Hash table position hi");
|
||||
builder.AppendLine(header.BlockTablePositionHi, " Block table position hi");
|
||||
builder.AppendLine(header.ArchiveSizeLong, " Archive size long");
|
||||
builder.AppendLine(header.BetTablePosition, " BET table position");
|
||||
builder.AppendLine(header.HetTablePosition, " HET table position");
|
||||
builder.AppendLine(header.HashTableSizeLong, " Hash table size long");
|
||||
builder.AppendLine(header.BlockTableSizeLong, " Block table size long");
|
||||
builder.AppendLine(header.HiBlockTableSize, " Hi-block table size");
|
||||
builder.AppendLine(header.HetTableSize, " HET table size");
|
||||
builder.AppendLine(header.BetTablesize, " BET table size"); // TODO: Fix casing
|
||||
builder.AppendLine(header.RawChunkSize, " Raw chunk size");
|
||||
builder.AppendLine(header.BlockTableMD5, " Block table MD5");
|
||||
builder.AppendLine(header.HashTableMD5, " Hash table MD5");
|
||||
builder.AppendLine(header.HiBlockTableMD5, " Hi-block table MD5");
|
||||
builder.AppendLine(header.BetTableMD5, " BET table MD5");
|
||||
builder.AppendLine(header.HetTableMD5, " HET table MD5");
|
||||
builder.AppendLine(header.MpqHeaderMD5, " MPQ header MD5");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, HetTable? table)
|
||||
{
|
||||
builder.AppendLine(" HET Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (table == null)
|
||||
{
|
||||
builder.AppendLine(" No HET table");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(table.Signature, " Signature");
|
||||
builder.AppendLine(table.Version, " Version");
|
||||
builder.AppendLine(table.DataSize, " Data size");
|
||||
builder.AppendLine(table.TableSize, " Table size");
|
||||
builder.AppendLine(table.MaxFileCount, " Max file count");
|
||||
builder.AppendLine(table.HashTableSize, " Hash table size");
|
||||
builder.AppendLine(table.HashEntrySize, " Hash entry size");
|
||||
builder.AppendLine(table.TotalIndexSize, " Total index size");
|
||||
builder.AppendLine(table.IndexSizeExtra, " Index size extra");
|
||||
builder.AppendLine(table.IndexSize, " Index size");
|
||||
builder.AppendLine(table.BlockTableSize, " Block table size");
|
||||
builder.AppendLine(table.HashTable, " Hash table");
|
||||
|
||||
builder.AppendLine(" File indexes:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (table.FileIndexes == null)
|
||||
{
|
||||
builder.AppendLine(" No file indexes ");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < table.FileIndexes.Length; i++)
|
||||
{
|
||||
builder.AppendLine(table.FileIndexes[i], $" File index {i}");
|
||||
}
|
||||
}
|
||||
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, BetTable? table)
|
||||
{
|
||||
builder.AppendLine(" BET Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (table == null)
|
||||
{
|
||||
builder.AppendLine(" No BET table");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(table.Signature, " Signature");
|
||||
builder.AppendLine(table.Version, " Version");
|
||||
builder.AppendLine(table.DataSize, " Data size");
|
||||
builder.AppendLine(table.TableSize, " Table size");
|
||||
builder.AppendLine(table.FileCount, " File count");
|
||||
builder.AppendLine(table.Unknown, " Unknown");
|
||||
builder.AppendLine(table.TableEntrySize, " Table entry size");
|
||||
builder.AppendLine(table.FilePositionBitIndex, " File position bit index");
|
||||
builder.AppendLine(table.FileSizeBitIndex, " File size bit index");
|
||||
builder.AppendLine(table.CompressedSizeBitIndex, " Compressed size bit index");
|
||||
builder.AppendLine(table.FlagIndexBitIndex, " Flag index bit index");
|
||||
builder.AppendLine(table.UnknownBitIndex, " Unknown bit index");
|
||||
builder.AppendLine(table.FilePositionBitCount, " File position bit count");
|
||||
builder.AppendLine(table.FileSizeBitCount, " File size bit count");
|
||||
builder.AppendLine(table.CompressedSizeBitCount, " Compressed size bit count");
|
||||
builder.AppendLine(table.FlagIndexBitCount, " Flag index bit count");
|
||||
builder.AppendLine(table.UnknownBitCount, " Unknown bit count");
|
||||
builder.AppendLine(table.TotalBetHashSize, " Total BET hash size");
|
||||
builder.AppendLine(table.BetHashSizeExtra, " BET hash size extra");
|
||||
builder.AppendLine(table.BetHashSize, " BET hash size");
|
||||
builder.AppendLine(table.BetHashArraySize, " BET hash array size");
|
||||
builder.AppendLine(table.FlagCount, " Flag count");
|
||||
builder.AppendLine(table.FlagsArray, " Flags array");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, HashEntry?[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Hash Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No hash table items");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Hash Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.NameHashPartA, " Name hash, part A");
|
||||
builder.AppendLine(entry.NameHashPartB, " Name hash, part B");
|
||||
builder.AppendLine($" Locale: {entry.Locale} (0x{entry.Locale:X})");
|
||||
builder.AppendLine(entry.Platform, " Platform");
|
||||
builder.AppendLine(entry.BlockIndex, " BlockIndex");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, BlockEntry?[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Block Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No block table items");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Block Table Entry {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.FilePosition, " File position");
|
||||
builder.AppendLine(entry.CompressedSize, " Compressed size");
|
||||
builder.AppendLine(entry.UncompressedSize, " Uncompressed size");
|
||||
builder.AppendLine($" Flags: {entry.Flags} (0x{entry.Flags:X})");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, short[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Hi-block Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No hi-block table items");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Hi-block Table Entry {i}: {entry}");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.N3DS;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class N3DS
|
||||
public class N3DS : IPrinter<Cart>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Cart model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Cart cart)
|
||||
{
|
||||
builder.AppendLine("3DS Cart Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.NCF;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class NCF
|
||||
public class NCF : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("NCF Information:");
|
||||
@@ -1,12 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Models.NewExecutable;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
using static SabreTools.Serialization.Extensions;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class NewExecutable
|
||||
public class NewExecutable : IPrinter<Executable>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Executable model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Executable executable)
|
||||
{
|
||||
builder.AppendLine("New Executable Information:");
|
||||
@@ -29,7 +34,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.NonResidentNameTable);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader? header)
|
||||
private static void Print(StringBuilder builder, Models.MSDOS.ExecutableHeader? header)
|
||||
{
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -250,7 +255,7 @@ namespace SabreTools.Printing
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, ModuleReferenceTableEntry?[]? entries, SabreTools.Models.MSDOS.ExecutableHeader? stub, ExecutableHeader? header)
|
||||
private static void Print(StringBuilder builder, ModuleReferenceTableEntry?[]? entries, Models.MSDOS.ExecutableHeader? stub, ExecutableHeader? header)
|
||||
{
|
||||
builder.AppendLine(" Module-Reference Table Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.Nitro;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class Nitro
|
||||
public class Nitro : IPrinter<Cart>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Cart model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Cart cart)
|
||||
{
|
||||
builder.AppendLine("NDS Cart Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.PAK;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class PAK
|
||||
public class PAK : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("PAK Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.PFF;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class PFF
|
||||
public class PFF : IPrinter<Archive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Archive model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Archive archive)
|
||||
{
|
||||
builder.AppendLine("PFF Information:");
|
||||
87
SabreTools.Printing/Printers/PIC.cs
Normal file
87
SabreTools.Printing/Printers/PIC.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.PIC;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public class PIC : IPrinter<DiscInformation>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, DiscInformation model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, DiscInformation di)
|
||||
{
|
||||
builder.AppendLine("PIC Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine(di.DataStructureLength, "Data structure length");
|
||||
builder.AppendLine(di.Reserved0, "Reserved");
|
||||
builder.AppendLine(di.Reserved1, "Reserved");
|
||||
builder.AppendLine();
|
||||
|
||||
Print(builder, di.Units);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DiscInformationUnit?[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Disc Information Units:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No disc information units");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Disc Information Unit {i}");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.Header == null)
|
||||
{
|
||||
builder.AppendLine(" No header");
|
||||
}
|
||||
else
|
||||
{
|
||||
var header = entry.Header;
|
||||
builder.AppendLine(header.DiscInformationIdentifier, " Disc information identifier");
|
||||
builder.AppendLine(header.DiscInformationFormat, " Disc information format");
|
||||
builder.AppendLine(header.Reserved0, " Reserved");
|
||||
builder.AppendLine(header.SequenceNumber, " Sequence number");
|
||||
builder.AppendLine(header.BytesInUse, " Bytes in use");
|
||||
builder.AppendLine(header.Reserved1, " Reserved");
|
||||
}
|
||||
if (entry.Body == null)
|
||||
{
|
||||
builder.AppendLine(" No body");
|
||||
}
|
||||
else
|
||||
{
|
||||
DiscInformationUnitBody body = entry.Body;
|
||||
builder.AppendLine(body.DiscTypeIdentifier, " Disc type identifer");
|
||||
builder.AppendLine(body.DiscSizeClassVersion, " Disc size class version");
|
||||
builder.AppendLine(body.FormatDependentContents, " Format-dependent contents");
|
||||
}
|
||||
if (entry.Trailer == null)
|
||||
{
|
||||
builder.AppendLine(" No trailer");
|
||||
}
|
||||
else
|
||||
{
|
||||
DiscInformationUnitTrailer trailer = entry.Trailer;
|
||||
builder.AppendLine(trailer.DiscManufacturerID, " Disc manufacturer ID");
|
||||
builder.AppendLine(trailer.MediaTypeID, " Media type ID");
|
||||
builder.AppendLine(trailer.TimeStamp, " Timestamp");
|
||||
builder.AppendLine(trailer.ProductRevisionNumber, " Product revision number");
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.PlayJ;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class PlayJAudioFile
|
||||
public class PlayJAudioFile : IPrinter<AudioFile>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, AudioFile model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, AudioFile audio)
|
||||
{
|
||||
builder.AppendLine("PlayJ Audio File Information:");
|
||||
226
SabreTools.Printing/Printers/PlayJPlaylist.cs
Normal file
226
SabreTools.Printing/Printers/PlayJPlaylist.cs
Normal file
@@ -0,0 +1,226 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.PlayJ;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public class PlayJPlaylist : IPrinter<Playlist>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Playlist model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Playlist playlist)
|
||||
{
|
||||
builder.AppendLine("PlayJ Playlist Information:");
|
||||
builder.AppendLine("-------------------------");
|
||||
builder.AppendLine();
|
||||
|
||||
Print(builder, playlist.Header);
|
||||
Print(builder, playlist.AudioFiles);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, PlaylistHeader? header)
|
||||
{
|
||||
builder.AppendLine(" Playlist Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No playlist header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.TrackCount, " Track count");
|
||||
builder.AppendLine(header.Data, " Data");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, AudioFile?[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Audio Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No audio files");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Audio File {i}:");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
Print(builder, entry.Header);
|
||||
Print(builder, entry.UnknownBlock1);
|
||||
|
||||
if (entry.Header?.Version == 0x00000000)
|
||||
{
|
||||
Print(builder, entry.UnknownValue2);
|
||||
Print(builder, entry.UnknownBlock3);
|
||||
}
|
||||
else if (entry.Header?.Version == 0x0000000A)
|
||||
{
|
||||
Print(builder, entry.DataFilesCount, entry.DataFiles);
|
||||
}
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, AudioHeader? header)
|
||||
{
|
||||
builder.AppendLine(" Audio Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No audio header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Signature, " Signature");
|
||||
builder.AppendLine(header.Version, " Version");
|
||||
if (header.Version == 0x00000000 && header is AudioHeaderV1 headerV1)
|
||||
{
|
||||
builder.AppendLine(headerV1.TrackID, " Track ID");
|
||||
builder.AppendLine(headerV1.UnknownOffset1, " Unknown offset 1");
|
||||
builder.AppendLine(headerV1.UnknownOffset2, " Unknown offset 2");
|
||||
builder.AppendLine(headerV1.UnknownOffset3, " Unknown offset 3");
|
||||
builder.AppendLine(headerV1.Unknown1, " Unknown 1");
|
||||
builder.AppendLine(headerV1.Unknown2, " Unknown 2");
|
||||
builder.AppendLine(headerV1.Year, " Year");
|
||||
builder.AppendLine(headerV1.TrackNumber, " Track number");
|
||||
builder.AppendLine($" Subgenre: {headerV1.Subgenre} (0x{headerV1.Subgenre:X})");
|
||||
builder.AppendLine(headerV1.Duration, " Duration in seconds");
|
||||
}
|
||||
else if (header.Version == 0x0000000A && header is AudioHeaderV2 headerV2)
|
||||
{
|
||||
builder.AppendLine(headerV2.Unknown1, " Unknown 1");
|
||||
builder.AppendLine(headerV2.Unknown2, " Unknown 2");
|
||||
builder.AppendLine(headerV2.Unknown3, " Unknown 3");
|
||||
builder.AppendLine(headerV2.Unknown4, " Unknown 4");
|
||||
builder.AppendLine(headerV2.Unknown5, " Unknown 5");
|
||||
builder.AppendLine(headerV2.Unknown6, " Unknown 6");
|
||||
builder.AppendLine(headerV2.UnknownOffset1, " Unknown Offset 1");
|
||||
builder.AppendLine(headerV2.Unknown7, " Unknown 7");
|
||||
builder.AppendLine(headerV2.Unknown8, " Unknown 8");
|
||||
builder.AppendLine(headerV2.Unknown9, " Unknown 9");
|
||||
builder.AppendLine(headerV2.UnknownOffset2, " Unknown Offset 2");
|
||||
builder.AppendLine(headerV2.Unknown10, " Unknown 10");
|
||||
builder.AppendLine(headerV2.Unknown11, " Unknown 11");
|
||||
builder.AppendLine(headerV2.Unknown12, " Unknown 12");
|
||||
builder.AppendLine(headerV2.Unknown13, " Unknown 13");
|
||||
builder.AppendLine(headerV2.Unknown14, " Unknown 14");
|
||||
builder.AppendLine(headerV2.Unknown15, " Unknown 15");
|
||||
builder.AppendLine(headerV2.Unknown16, " Unknown 16");
|
||||
builder.AppendLine(headerV2.Unknown17, " Unknown 17");
|
||||
builder.AppendLine(headerV2.TrackID, " Track ID");
|
||||
builder.AppendLine(headerV2.Year, " Year");
|
||||
builder.AppendLine(headerV2.TrackNumber, " Track number");
|
||||
builder.AppendLine(headerV2.Unknown18, " Unknown 18");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.AppendLine(" Unrecognized version, not parsed...");
|
||||
}
|
||||
|
||||
builder.AppendLine(header.TrackLength, " Track length");
|
||||
builder.AppendLine(header.Track, " Track");
|
||||
builder.AppendLine(header.ArtistLength, " Artist length");
|
||||
builder.AppendLine(header.Artist, " Artist");
|
||||
builder.AppendLine(header.AlbumLength, " Album length");
|
||||
builder.AppendLine(header.Album, " Album");
|
||||
builder.AppendLine(header.WriterLength, " Writer length");
|
||||
builder.AppendLine(header.Writer, " Writer");
|
||||
builder.AppendLine(header.PublisherLength, " Publisher length");
|
||||
builder.AppendLine(header.Publisher, " Publisher");
|
||||
builder.AppendLine(header.LabelLength, " Label length");
|
||||
builder.AppendLine(header.Label, " Label");
|
||||
builder.AppendLine(header.CommentsLength, " Comments length");
|
||||
builder.AppendLine(header.Comments, " Comments");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, UnknownBlock1? block)
|
||||
{
|
||||
builder.AppendLine(" Unknown Block 1 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (block == null)
|
||||
{
|
||||
builder.AppendLine(" No unknown block 1r");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(block.Length, " Length");
|
||||
builder.AppendLine(block.Data, " Data");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, uint? value)
|
||||
{
|
||||
builder.AppendLine(" Unknown Value 2 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (value == null)
|
||||
{
|
||||
builder.AppendLine(" No unknown block 1r");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(value, " Value");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, UnknownBlock3? block)
|
||||
{
|
||||
builder.AppendLine(" Unknown Block 3 Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (block == null)
|
||||
{
|
||||
builder.AppendLine(" No unknown block 1r");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(block.Data, " Data");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, uint count, DataFile?[]? entries)
|
||||
{
|
||||
builder.AppendLine(" Data Files Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
builder.AppendLine(count, " Data files count");
|
||||
if (count == 0 || entries == null || entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No data files");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < entries.Length; i++)
|
||||
{
|
||||
var entry = entries[i];
|
||||
builder.AppendLine($" Data File {i}:");
|
||||
if (entry == null)
|
||||
{
|
||||
builder.AppendLine(" [NULL]");
|
||||
continue;
|
||||
}
|
||||
|
||||
builder.AppendLine(entry.FileNameLength, " File name length");
|
||||
builder.AppendLine(entry.FileName, " File name");
|
||||
builder.AppendLine(entry.DataLength, " Data length");
|
||||
builder.AppendLine(entry.Data, " Data");
|
||||
}
|
||||
builder.AppendLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using SabreTools.ASN1;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Models.PortableExecutable;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
using static SabreTools.Serialization.Extensions;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class PortableExecutable
|
||||
public class PortableExecutable : IPrinter<Executable>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Executable model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Executable executable)
|
||||
{
|
||||
builder.AppendLine("Portable Executable Information:");
|
||||
@@ -39,7 +45,7 @@ namespace SabreTools.Printing
|
||||
Print(builder, executable.ResourceDirectoryTable);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, SabreTools.Models.MSDOS.ExecutableHeader? header)
|
||||
private static void Print(StringBuilder builder, Models.MSDOS.ExecutableHeader? header)
|
||||
{
|
||||
builder.AppendLine(" MS-DOS Stub Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
@@ -921,13 +927,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");
|
||||
@@ -956,7 +962,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
|
||||
@@ -969,7 +975,7 @@ 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)
|
||||
@@ -990,10 +996,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");
|
||||
@@ -1084,25 +1090,25 @@ 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);
|
||||
|
||||
MenuResource? menu = null;
|
||||
try { menu = entry.AsMenu(); } catch { }
|
||||
@@ -1192,7 +1198,7 @@ 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);
|
||||
|
||||
DialogBoxResource? dialogBox = null;
|
||||
try { dialogBox = entry.AsDialogBox(); } catch { }
|
||||
@@ -1327,7 +1333,7 @@ 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);
|
||||
|
||||
Dictionary<int, string?>? stringTable = null;
|
||||
try { stringTable = entry.AsStringTable(); } catch { }
|
||||
@@ -1347,19 +1353,19 @@ namespace SabreTools.Printing
|
||||
|
||||
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);
|
||||
|
||||
AcceleratorTableEntry[]? acceleratorTable = null;
|
||||
try { acceleratorTable = entry.AsAcceleratorTableResource(); } catch { }
|
||||
@@ -1382,7 +1388,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
|
||||
@@ -1425,7 +1431,7 @@ 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);
|
||||
|
||||
MessageResourceData? messageTable = null;
|
||||
try { messageTable = entry.AsMessageResourceData(); } catch { }
|
||||
@@ -1492,19 +1498,19 @@ 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);
|
||||
|
||||
VersionInfo? versionInfo = null;
|
||||
try { versionInfo = entry.AsVersionInfo(); } catch { }
|
||||
@@ -1625,37 +1631,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)
|
||||
@@ -1668,7 +1674,7 @@ 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);
|
||||
|
||||
AssemblyManifest? assemblyManifest = null;
|
||||
try { assemblyManifest = entry.AsAssemblyManifest(); } catch { }
|
||||
@@ -1886,7 +1892,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)
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.Quantum;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class Quantum
|
||||
public class Quantum : IPrinter<Archive>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Archive model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, Archive archive)
|
||||
{
|
||||
builder.AppendLine("Quantum Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.SGA;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class SGA
|
||||
public class SGA : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("SGA Information:");
|
||||
@@ -1,11 +1,16 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.VBSP;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
using static SabreTools.Models.VBSP.Constants;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class VBSP
|
||||
public class VBSP : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("VBSP Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.VPK;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class VPK
|
||||
public class VPK : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("VPK Information:");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.WAD;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class WAD
|
||||
public class WAD : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("WAD Information:");
|
||||
@@ -1,16 +1,21 @@
|
||||
using System.Text;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
using static SabreTools.Models.Xbox.Constants;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class XMID
|
||||
public class XMID : IPrinter<Models.Xbox.XMID>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Models.Xbox.XMID model)
|
||||
=> Print(builder, model);
|
||||
|
||||
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 ?? string.Empty))
|
||||
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");
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.Text;
|
||||
using SabreTools.Models.XZP;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class XZP
|
||||
public class XZP : IPrinter<File>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, File model)
|
||||
=> Print(builder, model);
|
||||
|
||||
public static void Print(StringBuilder builder, File file)
|
||||
{
|
||||
builder.AppendLine("XZP Information:");
|
||||
@@ -1,16 +1,21 @@
|
||||
using System.Text;
|
||||
using SabreTools.Printing.Interfaces;
|
||||
using static SabreTools.Models.Xbox.Constants;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
namespace SabreTools.Printing.Printers
|
||||
{
|
||||
public static class XeMID
|
||||
public class XeMID : IPrinter<Models.Xbox.XeMID>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void PrintInformation(StringBuilder builder, Models.Xbox.XeMID model)
|
||||
=> Print(builder, model);
|
||||
|
||||
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 ?? string.Empty))
|
||||
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");
|
||||
@@ -2,17 +2,17 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<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.2.0</Version>
|
||||
<Version>1.3.6</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>
|
||||
@@ -22,14 +22,14 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath=""/>
|
||||
<None Include="../README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SabreTools.ASN1" Version="1.2.0" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.2.0" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.2.0" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.2.0" />
|
||||
<PackageReference Include="SabreTools.ASN1" Version="1.3.1" />
|
||||
<PackageReference Include="SabreTools.IO" Version="1.3.6" />
|
||||
<PackageReference Include="SabreTools.Models" Version="1.4.2" />
|
||||
<PackageReference Include="SabreTools.Serialization" Version="1.5.2" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace SabreTools.Printing
|
||||
{
|
||||
// TODO: Add extension for printing enums, if possible
|
||||
internal static class Extensions
|
||||
internal static class StringBuilderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Append a line containing a boolean to a StringBuilder
|
||||
@@ -12,7 +13,7 @@ namespace SabreTools.Printing
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, bool? value, string prefixString)
|
||||
{
|
||||
value ??= false;
|
||||
return sb.AppendLine($"{prefixString}: {value.ToString()}");
|
||||
return sb.AppendLine($"{prefixString}: {value}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,7 +148,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
|
||||
@@ -174,7 +175,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
|
||||
@@ -183,7 +184,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
|
||||
@@ -192,7 +193,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
|
||||
@@ -201,7 +202,7 @@ namespace SabreTools.Printing
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong[]? value, string prefixString)
|
||||
{
|
||||
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}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user