mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-05 22:01:33 +00:00
Run tests and fix the rest
This commit is contained in:
@@ -1,495 +0,0 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Numerics;
|
||||
|
||||
namespace SabreTools.Data.Extensions
|
||||
{
|
||||
// TODO: Add extension for printing enums, if possible
|
||||
// TODO: Remove when IO is updated (SabreTools.IO.Extensions)
|
||||
public static class StringBuilderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Append a line containing a boolean to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, bool? value, string prefixString)
|
||||
{
|
||||
value ??= false;
|
||||
return sb.AppendLine($"{prefixString}: {value}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Char to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char? value, string prefixString)
|
||||
{
|
||||
string valueString = value is null ? "[NULL]" : value.Value.ToString();
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int8 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, sbyte? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X2})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian Int8 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothInt8? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X2})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian UInt8 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothUInt8? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int16 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X4})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian Int16 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothInt16? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt16 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X4})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian UInt16 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothUInt16? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int32 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X8})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian Int32 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothInt32? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt32 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X8})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian UInt32 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothUInt32? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Single to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, float? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value}";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int64 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X16})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian Int64 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothInt64? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt64 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value} (0x{value:X16})";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a potentially both-endian UInt64 to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLineBothEndian(this StringBuilder sb, BothUInt64? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
if (value.IsValid)
|
||||
return sb.AppendLine(value, prefixString);
|
||||
|
||||
sb = sb.AppendLine(value.LittleEndian, $"{prefixString} (Little-Endian)");
|
||||
return sb.AppendLine(value.BigEndian, $"{prefixString} (Big-Endian)");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Double to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, double? value, string prefixString)
|
||||
{
|
||||
value ??= 0;
|
||||
string valueString = $"{value}";
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a string to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, string? value, string prefixString)
|
||||
{
|
||||
string valueString = value ?? "[NULL]";
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Guid to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, Guid? value, string prefixString)
|
||||
{
|
||||
value ??= Guid.Empty;
|
||||
string valueString = value.Value.ToString();
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[]? value, string prefixString)
|
||||
{
|
||||
string valueString = value is null ? "[NULL]" : BitConverter.ToString(value).Replace('-', ' ');
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8[] value as a string to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[]? value, string prefixString, Encoding encoding)
|
||||
{
|
||||
string valueString = value is null ? "[NULL]" : encoding.GetString(value).Replace("\0", string.Empty);
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt8[][] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, byte[][]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, ba => ba is null ? "[NULL]" : BitConverter.ToString(ba).Replace('-', ' '));
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Char[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, char[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, c => c.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int16[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, short[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, s => s.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt16[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ushort[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, u => u.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int32[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, int[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, i => i.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt32[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, uint[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, u => u.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Single[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, float[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, u => u.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Int64[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, long[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, l => l.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt64[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, ulong[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, u => u.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a Double[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, double[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, u => u.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a String[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, string?[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, s => s is null ? "[NULL]" : s);
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Append a line containing a UInt64[] value to a StringBuilder
|
||||
/// </summary>
|
||||
public static StringBuilder AppendLine(this StringBuilder sb, Guid[]? value, string prefixString)
|
||||
{
|
||||
string valueString = "[NULL]";
|
||||
if (value is not null)
|
||||
{
|
||||
var valueArr = Array.ConvertAll(value, g => g.ToString());
|
||||
valueString = string.Join(", ", valueArr);
|
||||
}
|
||||
|
||||
if (valueString.Length == 0)
|
||||
return sb.AppendLine($"{prefixString}: [EMPTY]");
|
||||
|
||||
return sb.AppendLine($"{prefixString}: {valueString}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,9 +204,7 @@ namespace SabreTools.Metadata.DatFiles
|
||||
public void ClearMarked()
|
||||
{
|
||||
string[] keys = [.. SortedKeys];
|
||||
#if NET452_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.ForEach(keys, Core.Globals.ParallelOptions, key =>
|
||||
#elif NET40_OR_GREATER
|
||||
#if NET40_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.ForEach(keys, key =>
|
||||
#else
|
||||
foreach (var key in keys)
|
||||
@@ -386,9 +384,7 @@ namespace SabreTools.Metadata.DatFiles
|
||||
/// </summary>
|
||||
public void Deduplicate()
|
||||
{
|
||||
#if NET452_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
||||
#elif NET40_OR_GREATER
|
||||
#if NET40_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.ForEach(SortedKeys, key =>
|
||||
#else
|
||||
foreach (var key in SortedKeys)
|
||||
@@ -741,9 +737,7 @@ namespace SabreTools.Metadata.DatFiles
|
||||
// First do the initial sort of all of the roms inplace
|
||||
List<string> oldkeys = [.. SortedKeys];
|
||||
|
||||
#if NET452_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.For(0, oldkeys.Count, Core.Globals.ParallelOptions, k =>
|
||||
#elif NET40_OR_GREATER
|
||||
#if NET40_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.For(0, oldkeys.Count, k =>
|
||||
#else
|
||||
for (int k = 0; k < oldkeys.Count; k++)
|
||||
@@ -794,9 +788,7 @@ namespace SabreTools.Metadata.DatFiles
|
||||
/// </summary>
|
||||
private void PerformSorting(bool norename)
|
||||
{
|
||||
#if NET452_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.ForEach(SortedKeys, Core.Globals.ParallelOptions, key =>
|
||||
#elif NET40_OR_GREATER
|
||||
#if NET40_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
Parallel.ForEach(SortedKeys, key =>
|
||||
#else
|
||||
foreach (var key in SortedKeys)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.AACS;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.Atari7800;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.AtariLynx;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.BFPK;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.BSP;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.CFB;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.CHD;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.N3DS;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.NES;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.GCF;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.GZIP;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.ISO9660;
|
||||
using SabreTools.Numerics.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.InstallShieldArchiveV3;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.InstallShieldCabinet;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.LZ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.LZ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.LZ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.LinearExecutable;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.MSDOS;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.MicrosoftCabinet;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.MoPaQ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.IO;
|
||||
using SabreTools.Data.Models.N3DS;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Numerics.Extensions;
|
||||
using SabreTools.Security.Cryptography;
|
||||
using static SabreTools.Data.Models.N3DS.Constants;
|
||||
@@ -73,7 +72,7 @@ namespace SabreTools.Wrappers
|
||||
/// <summary>
|
||||
/// Get KeyX value for a crypto method and development status combination
|
||||
/// </summary>
|
||||
private static byte[] GetKeyXForCryptoMethod(EncryptionSettings settings, CryptoMethod method)
|
||||
private static byte[] GetKeyXForCryptoMethod(N3DSEncryptionSettings settings, CryptoMethod method)
|
||||
{
|
||||
switch (method)
|
||||
{
|
||||
@@ -142,7 +141,7 @@ namespace SabreTools.Wrappers
|
||||
}
|
||||
|
||||
// Create a new set of encryption settings
|
||||
var settings = new EncryptionSettings
|
||||
var settings = new N3DSEncryptionSettings
|
||||
{
|
||||
Development = development,
|
||||
AESHardwareConstant = aesHardwareConstant ?? [],
|
||||
@@ -209,10 +208,10 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="settings">Encryption settings</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void DecryptPartition(int index, EncryptionSettings settings, Stream reader, Stream writer)
|
||||
private void DecryptPartition(int index, N3DSEncryptionSettings settings, Stream reader, Stream writer)
|
||||
{
|
||||
// Determine the keys needed for this partition
|
||||
PartitionKeys? keys = GetDecryptionKeys(index, settings);
|
||||
N3DSPartitionKeys? keys = GetDecryptionKeys(index, settings);
|
||||
if (keys == null)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} could not generate keys. Skipping...");
|
||||
@@ -233,7 +232,7 @@ namespace SabreTools.Wrappers
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the partition</param>
|
||||
/// <param name="settings">Encryption settings</param>
|
||||
private PartitionKeys? GetDecryptionKeys(int index, EncryptionSettings settings)
|
||||
private N3DSPartitionKeys? GetDecryptionKeys(int index, N3DSEncryptionSettings settings)
|
||||
{
|
||||
// Get the partition
|
||||
var partition = Partitions?[index];
|
||||
@@ -253,7 +252,7 @@ namespace SabreTools.Wrappers
|
||||
#endif
|
||||
byte[] keyX = GetKeyXForCryptoMethod(settings, method);
|
||||
byte[] keyX0x2C = settings.Development ? settings.DevKeyX0x2C : settings.KeyX0x2C;
|
||||
return new PartitionKeys(signature, fixedCryptoKey, settings.AESHardwareConstant, keyX, keyX0x2C);
|
||||
return new N3DSPartitionKeys(signature, fixedCryptoKey, settings.AESHardwareConstant, keyX, keyX0x2C);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -263,7 +262,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool DecryptExtendedHeader(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private bool DecryptExtendedHeader(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Get required offsets
|
||||
uint partitionOffset = GetPartitionOffset(index);
|
||||
@@ -307,7 +306,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool DecryptExeFS(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private bool DecryptExeFS(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Validate the ExeFS
|
||||
uint exeFsHeaderOffset = GetExeFSOffset(index);
|
||||
@@ -361,7 +360,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void DecryptExeFSFilenameTable(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private void DecryptExeFSFilenameTable(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Get ExeFS offset
|
||||
uint exeFsOffset = GetExeFSOffset(index);
|
||||
@@ -399,7 +398,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void DecryptExeFSFileEntries(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private void DecryptExeFSFileEntries(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
if (ExeFSHeaders is null || index < 0 || index > ExeFSHeaders.Length)
|
||||
{
|
||||
@@ -462,7 +461,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="index">Index of the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool DecryptRomFS(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private bool DecryptRomFS(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Validate the RomFS
|
||||
uint romFsOffset = GetRomFSOffset(index);
|
||||
@@ -566,7 +565,7 @@ namespace SabreTools.Wrappers
|
||||
}
|
||||
|
||||
// Create a new set of encryption settings
|
||||
var settings = new EncryptionSettings
|
||||
var settings = new N3DSEncryptionSettings
|
||||
{
|
||||
Development = development,
|
||||
AESHardwareConstant = aesHardwareConstant ?? [],
|
||||
@@ -634,10 +633,10 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="settings">Encryption settings</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void EncryptPartition(int index, EncryptionSettings settings, Stream reader, Stream writer)
|
||||
private void EncryptPartition(int index, N3DSEncryptionSettings settings, Stream reader, Stream writer)
|
||||
{
|
||||
// Determine the keys needed for this partition
|
||||
PartitionKeys? keys = GetEncryptionKeys(index, settings);
|
||||
N3DSPartitionKeys? keys = GetEncryptionKeys(index, settings);
|
||||
if (keys == null)
|
||||
{
|
||||
Console.WriteLine($"Partition {index} could not generate keys. Skipping...");
|
||||
@@ -658,7 +657,7 @@ namespace SabreTools.Wrappers
|
||||
/// </summary>
|
||||
/// <param name="index">Index of the partition</param>
|
||||
/// <param name="settings">Encryption settings</param>
|
||||
private PartitionKeys? GetEncryptionKeys(int index, EncryptionSettings settings)
|
||||
private N3DSPartitionKeys? GetEncryptionKeys(int index, N3DSEncryptionSettings settings)
|
||||
{
|
||||
// Get the partition
|
||||
var partition = Partitions?[index];
|
||||
@@ -683,7 +682,7 @@ namespace SabreTools.Wrappers
|
||||
#endif
|
||||
byte[] keyX = GetKeyXForCryptoMethod(settings, method);
|
||||
byte[] keyX0x2C = settings.Development ? settings.DevKeyX0x2C : settings.KeyX0x2C;
|
||||
return new PartitionKeys(signature, fixedCryptoKey, settings.AESHardwareConstant, keyX, keyX0x2C);
|
||||
return new N3DSPartitionKeys(signature, fixedCryptoKey, settings.AESHardwareConstant, keyX, keyX0x2C);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -693,7 +692,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool EncryptExtendedHeader(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private bool EncryptExtendedHeader(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Get required offsets
|
||||
uint partitionOffset = GetPartitionOffset(index);
|
||||
@@ -737,7 +736,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool EncryptExeFS(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private bool EncryptExeFS(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
if (ExeFSHeaders is null || index < 0 || index > ExeFSHeaders.Length)
|
||||
{
|
||||
@@ -792,7 +791,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void EncryptExeFSFilenameTable(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private void EncryptExeFSFilenameTable(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Get ExeFS offset
|
||||
uint exeFsOffset = GetExeFSOffset(index);
|
||||
@@ -830,7 +829,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private void EncryptExeFSFileEntries(int index, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private void EncryptExeFSFileEntries(int index, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Get ExeFS offset
|
||||
uint exeFsHeaderOffset = GetExeFSOffset(index);
|
||||
@@ -891,7 +890,7 @@ namespace SabreTools.Wrappers
|
||||
/// <param name="keys">Keys for the partition</param>
|
||||
/// <param name="reader">Stream representing the input</param>
|
||||
/// <param name="writer">Stream representing the output</param>
|
||||
private bool EncryptRomFS(int index, EncryptionSettings settings, PartitionKeys keys, Stream reader, Stream writer)
|
||||
private bool EncryptRomFS(int index, N3DSEncryptionSettings settings, N3DSPartitionKeys keys, Stream reader, Stream writer)
|
||||
{
|
||||
// Validate the RomFS
|
||||
uint romFsOffset = GetRomFSOffset(index);
|
||||
@@ -977,506 +976,5 @@ namespace SabreTools.Wrappers
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: Remove these when IO is updated
|
||||
#region Helper Classes
|
||||
|
||||
/// <summary>
|
||||
/// 3DS Encryption settings to be passed around during processing
|
||||
/// </summary>
|
||||
private class EncryptionSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicates if development images are expected
|
||||
/// </summary>
|
||||
public bool Development { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AES Hardware Constant
|
||||
/// </summary>
|
||||
/// TODO: Validate this value on assignment
|
||||
public byte[] AESHardwareConstant { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// KeyX 0x18 (New 3DS 9.3)
|
||||
/// </summary>
|
||||
public byte[] KeyX0x18
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateKeyX0x18(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// Dev KeyX 0x18 (New 3DS 9.3)
|
||||
/// </summary>
|
||||
public byte[] DevKeyX0x18
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateDevKeyX0x18(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// KeyX 0x1B (New 3DS 9.6)
|
||||
/// </summary>
|
||||
public byte[] KeyX0x1B
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateKeyX0x1B(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// Dev KeyX 0x1B New 3DS 9.6)
|
||||
/// </summary>
|
||||
public byte[] DevKeyX0x1B
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateDevKeyX0x1B(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// KeyX 0x25 (> 7.x)
|
||||
/// </summary>
|
||||
public byte[] KeyX0x25
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateKeyX0x25(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// Dev KeyX 0x25 (> 7.x)
|
||||
/// </summary>
|
||||
public byte[] DevKeyX0x25
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateDevKeyX0x25(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// KeyX 0x2C (< 6.x)
|
||||
/// </summary>
|
||||
public byte[] KeyX0x2C
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateKeyX0x2C(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
/// <summary>
|
||||
/// Dev KeyX 0x2C (< 6.x)
|
||||
/// </summary>
|
||||
public byte[] DevKeyX0x2C
|
||||
{
|
||||
get;
|
||||
set
|
||||
{
|
||||
if (ValidateDevKeyX0x2C(value))
|
||||
field = value;
|
||||
}
|
||||
} = [];
|
||||
|
||||
#region Internal Test Values
|
||||
|
||||
/// <summary>
|
||||
/// Initial value for key validation tests
|
||||
/// </summary>
|
||||
private static readonly byte[] TestIV =
|
||||
[
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Pattern to use for key validation tests
|
||||
/// </summary>
|
||||
private static readonly byte[] TestPattern =
|
||||
[
|
||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
|
||||
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
|
||||
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
|
||||
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08,
|
||||
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for KeyX0x18
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedKeyX0x18 =
|
||||
[
|
||||
0x06, 0xF1, 0xB2, 0x3B, 0x12, 0xAD, 0x80, 0xC1,
|
||||
0x13, 0xC6, 0x18, 0x3D, 0x27, 0xB8, 0xB9, 0x95,
|
||||
0x49, 0x73, 0x59, 0x82, 0xEF, 0xFE, 0x16, 0x48,
|
||||
0x91, 0x2A, 0x89, 0x55, 0x9A, 0xDC, 0x3C, 0xA0,
|
||||
0x84, 0x46, 0x14, 0xE0, 0x16, 0x59, 0x8E, 0x4F,
|
||||
0xC2, 0x6C, 0x52, 0xA4, 0x7D, 0xAD, 0x4F, 0x23,
|
||||
0xF1, 0xC6, 0x99, 0x44, 0x39, 0xB7, 0x42, 0xF0,
|
||||
0x1F, 0xBB, 0x02, 0xF6, 0x0A, 0x8A, 0xC2, 0x9A,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for DevKeyX0x18
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedDevKeyX0x18 =
|
||||
[
|
||||
0x99, 0x6E, 0x3C, 0x54, 0x97, 0x3C, 0xEA, 0xE8,
|
||||
0xBA, 0xAE, 0x18, 0x5C, 0x93, 0x27, 0x65, 0x50,
|
||||
0xF6, 0x6D, 0x67, 0xD7, 0xEF, 0xBD, 0x7C, 0xCB,
|
||||
0x8A, 0xC1, 0x1A, 0x54, 0xFC, 0x3B, 0x8B, 0x3A,
|
||||
0x0E, 0xE5, 0xEF, 0x27, 0x4A, 0x73, 0x7E, 0x0A,
|
||||
0x2E, 0x2E, 0x9D, 0xAF, 0x6C, 0x03, 0xF2, 0x91,
|
||||
0xC4, 0xFA, 0x73, 0xFD, 0x6B, 0xA0, 0x07, 0xD4,
|
||||
0x75, 0x5B, 0x6F, 0x2E, 0x8B, 0x68, 0x4C, 0xD1,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for KeyX0x1B
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedKeyX0x1B =
|
||||
[
|
||||
0x0A, 0xE4, 0x79, 0x02, 0x1B, 0xFA, 0x25, 0x4B,
|
||||
0x2D, 0x92, 0x4F, 0xA8, 0x41, 0x59, 0xCE, 0x10,
|
||||
0x09, 0xE6, 0x08, 0x61, 0x23, 0xC7, 0xD2, 0x30,
|
||||
0x84, 0x37, 0xD5, 0x49, 0x42, 0x94, 0xB2, 0x70,
|
||||
0x6A, 0xF3, 0x75, 0xB0, 0x1F, 0x4F, 0xA1, 0xCE,
|
||||
0x03, 0xA2, 0x6A, 0x19, 0x5D, 0x32, 0x0D, 0xB5,
|
||||
0x79, 0xCD, 0xFD, 0xF0, 0xDE, 0x49, 0x26, 0x2D,
|
||||
0x29, 0x36, 0x30, 0x69, 0x8B, 0x45, 0xE1, 0xFC,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for DevKeyX0x1B
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedDevKeyX0x1B =
|
||||
[
|
||||
0x16, 0x4F, 0xD9, 0x58, 0xC9, 0x20, 0xB3, 0xED,
|
||||
0xC4, 0xEB, 0x57, 0x39, 0x10, 0xEF, 0xA8, 0xCC,
|
||||
0xE5, 0x49, 0xBF, 0x52, 0x10, 0xA9, 0xCC, 0xE1,
|
||||
0x65, 0x3B, 0x2D, 0x51, 0x45, 0xFB, 0x60, 0x52,
|
||||
0x3E, 0x29, 0xEB, 0xEB, 0x3F, 0xF2, 0x76, 0x08,
|
||||
0x00, 0x05, 0x7F, 0x64, 0x29, 0x4A, 0x17, 0x22,
|
||||
0x56, 0x7F, 0x49, 0x94, 0x1A, 0x8C, 0x56, 0x35,
|
||||
0x38, 0xBE, 0xA4, 0x2E, 0x58, 0xD3, 0x81, 0x8C,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for KeyX0x25
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedKeyX0x25 =
|
||||
[
|
||||
0x37, 0xBC, 0x73, 0xD6, 0xEE, 0x73, 0xE0, 0x94,
|
||||
0x42, 0x84, 0x74, 0xE5, 0xD8, 0xFB, 0x5F, 0x65,
|
||||
0xF4, 0xCF, 0x2E, 0xC1, 0x43, 0x48, 0x6C, 0xAA,
|
||||
0xC8, 0xF9, 0x96, 0xE6, 0x33, 0xDD, 0xE7, 0xBF,
|
||||
0xD2, 0x21, 0x89, 0x39, 0x13, 0xD1, 0xEC, 0xCA,
|
||||
0x1D, 0x5D, 0x1F, 0x77, 0x95, 0xD2, 0x8B, 0x27,
|
||||
0x92, 0x79, 0xC5, 0x1D, 0x72, 0xA7, 0x28, 0x57,
|
||||
0x41, 0x0E, 0x46, 0xB8, 0x80, 0x7B, 0x7C, 0x0D,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for DevKeyX0x25
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedDevKeyX0x25 =
|
||||
[
|
||||
0x71, 0x65, 0x30, 0xF2, 0x68, 0xEC, 0x65, 0x0A,
|
||||
0x8C, 0x9E, 0xC5, 0x5A, 0xFA, 0x37, 0x8E, 0xDA,
|
||||
0x7B, 0x58, 0x3B, 0x66, 0x7C, 0x9D, 0x16, 0xD9,
|
||||
0x2D, 0x8F, 0xCF, 0x04, 0x66, 0x7F, 0x27, 0x41,
|
||||
0xBF, 0x5F, 0x1E, 0x11, 0x4C, 0xD6, 0xB9, 0x0A,
|
||||
0xC5, 0x42, 0xCF, 0x2B, 0x87, 0x6B, 0xD4, 0x72,
|
||||
0x4D, 0x9C, 0x29, 0x2E, 0xF8, 0xB0, 0x6F, 0x22,
|
||||
0x35, 0x5B, 0x96, 0x83, 0xD1, 0xE4, 0x5E, 0xDB,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for KeyX0x2C
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedKeyX0x2C =
|
||||
[
|
||||
0xAE, 0x44, 0x20, 0xDB, 0xA5, 0x96, 0xDC, 0xF3,
|
||||
0xD8, 0x23, 0x9E, 0x3C, 0x44, 0x73, 0x3D, 0xCD,
|
||||
0x07, 0xD5, 0xF8, 0xD0, 0xC6, 0xB3, 0x5A, 0x80,
|
||||
0xB5, 0x5A, 0x55, 0x30, 0x5D, 0x4A, 0xBE, 0x61,
|
||||
0xBF, 0xEF, 0x64, 0x17, 0x28, 0xD6, 0x26, 0x52,
|
||||
0x42, 0x4D, 0x8F, 0x1C, 0xBC, 0x63, 0xD3, 0x91,
|
||||
0x7D, 0xA6, 0x4F, 0xAF, 0x26, 0x38, 0x60, 0xEE,
|
||||
0x79, 0x92, 0x2F, 0xD8, 0xCA, 0x4E, 0xE7, 0xEC,
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Expected output value for DevKeyX0x2C
|
||||
/// </summary>
|
||||
private static readonly byte[] ExpectedDevKeyX0x2C =
|
||||
[
|
||||
0x5F, 0x73, 0xD5, 0x9A, 0x67, 0xFF, 0x8C, 0x12,
|
||||
0x31, 0x58, 0x0B, 0x58, 0x46, 0xFE, 0x05, 0x16,
|
||||
0x92, 0xE4, 0x84, 0x06, 0x18, 0x9B, 0x58, 0x91,
|
||||
0xE7, 0xF8, 0xCD, 0xA9, 0x95, 0xAC, 0x07, 0xCD,
|
||||
0x43, 0x20, 0x7A, 0x8C, 0xCC, 0xAB, 0x48, 0x50,
|
||||
0x29, 0x2F, 0x96, 0x73, 0xB0, 0xD9, 0xE5, 0xCB,
|
||||
0xE6, 0x9A, 0x0D, 0xF7, 0xD0, 0x1E, 0xC2, 0xEC,
|
||||
0xC1, 0xE2, 0x8E, 0xEE, 0x89, 0xB9, 0xB1, 0x97,
|
||||
];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Validation Methods
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible KeyX0x18 value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateKeyX0x18(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedKeyX0x18);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible DevKeyX0x18 value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateDevKeyX0x18(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedDevKeyX0x18);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible KeyX0x1B value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateKeyX0x1B(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedKeyX0x1B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible DevKeyX0x1B value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateDevKeyX0x1B(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedDevKeyX0x1B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible KeyX0x25 value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateKeyX0x25(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedKeyX0x25);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible DevKeyX0x25 value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateDevKeyX0x25(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedDevKeyX0x25);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible KeyX0x2C value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateKeyX0x2C(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedKeyX0x2C);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validate a possible DevKeyX0x2C value
|
||||
/// </summary>
|
||||
/// <param name="key">Key to test</param>
|
||||
/// <returns>True if the key was valid, false otherwise</returns>
|
||||
public bool ValidateDevKeyX0x2C(byte[]? key)
|
||||
{
|
||||
// Missing key data is considered invalid
|
||||
if (key is null || key.Length == 0)
|
||||
return false;
|
||||
|
||||
// Validate the key data
|
||||
var cipher = AESCTR.CreateEncryptionCipher(key, TestIV);
|
||||
byte[] actual = cipher.ProcessBytes(TestPattern);
|
||||
return actual.EqualsExactly(ExpectedDevKeyX0x2C);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set of all keys associated with a partition
|
||||
/// </summary>
|
||||
private class PartitionKeys
|
||||
{
|
||||
/// <summary>
|
||||
/// Primary AES-CTR encryption key
|
||||
/// </summary>
|
||||
/// <remarks>Used for both EXE-FS and ROM-FS</remarks>
|
||||
public byte[] NormalKey { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Secondary AES-CTR encryption key
|
||||
/// </summary>
|
||||
/// <remarks>Used for only EXE-FS</remarks>
|
||||
public byte[] NormalKey2C { get; }
|
||||
|
||||
/// <summary>
|
||||
/// First 16 bytes of the RSA-2048 signature
|
||||
/// </summary>
|
||||
/// <remarks>Used as an XOR value during key generation</remarks>
|
||||
private readonly byte[] KeyY;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new set of keys for a given partition
|
||||
/// </summary>
|
||||
/// <param name="signature">RSA-2048 signature from the partition</param>
|
||||
/// <param name="fixedCryptoKey">Flag indicating if the FixedCryptoKey bit mask was set</param>
|
||||
/// <param name="hardwareConstant">AES hardware constant to use</param>
|
||||
/// <param name="keyX">KeyX value to assign based on crypto method and development status</param>
|
||||
/// <param name="keyX0x2C">KeyX2C value to assign based on development status</param>
|
||||
public PartitionKeys(byte[]? signature, bool fixedCryptoKey, byte[] hardwareConstant, byte[] keyX, byte[] keyX0x2C)
|
||||
{
|
||||
// Validate inputs
|
||||
if (signature is not null && signature.Length < 16)
|
||||
throw new ArgumentOutOfRangeException(nameof(signature), $"{nameof(signature)} must be at least 16 bytes");
|
||||
|
||||
// Backup headers can't have a KeyY value set
|
||||
KeyY = new byte[16];
|
||||
if (signature is not null)
|
||||
Array.Copy(signature, KeyY, 16);
|
||||
|
||||
// Special case for zero-key
|
||||
if (fixedCryptoKey)
|
||||
{
|
||||
Console.WriteLine("Encryption Method: Zero Key");
|
||||
NormalKey = new byte[16];
|
||||
NormalKey2C = new byte[16];
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the standard normal key values
|
||||
NormalKey = ProcessKey(keyX, KeyY, hardwareConstant);
|
||||
NormalKey2C = ProcessKey(keyX0x2C, KeyY, hardwareConstant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set RomFS values based on the bit masks
|
||||
/// </summary>
|
||||
/// <param name="fixedCryptoKey">Flag indicating if the FixedCryptoKey bit mask was set</param>
|
||||
/// <param name="hardwareConstant">AES hardware constant to use</param>
|
||||
/// <param name="keyX0x2C">KeyX2C value to assign based on development status</param>
|
||||
public void SetRomFSValues(bool fixedCryptoKey, byte[] hardwareConstant, byte[] keyX0x2C)
|
||||
{
|
||||
// NormalKey has a constant value for zero-key
|
||||
if (fixedCryptoKey)
|
||||
{
|
||||
NormalKey = new byte[16];
|
||||
return;
|
||||
}
|
||||
|
||||
// Encrypting RomFS for partitions 1 and up always use Key0x2C
|
||||
NormalKey = ProcessKey(keyX0x2C, KeyY, hardwareConstant);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process a key with the standard processing steps
|
||||
/// </summary>
|
||||
private static byte[] ProcessKey(byte[] keyBase, byte[] keyY, byte[] hardwareConstant)
|
||||
{
|
||||
byte[] processed = keyBase.RotateLeft(2);
|
||||
processed = processed.Xor(keyY);
|
||||
processed = processed.Add(hardwareConstant);
|
||||
return processed.RotateLeft(87);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.N3DS;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.NCF;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.NES;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.NewExecutable;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.Nitro;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.PAK;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.PFF;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.PIC;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.PKZIP;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.PlayJ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.PlayJ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ using SabreTools.Data.Models.PortableExecutable.Resource.Entries;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Numerics.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@ using SabreTools.Data.Models.COFF;
|
||||
using SabreTools.Data.Models.PortableExecutable;
|
||||
using SabreTools.Data.Models.PortableExecutable.Resource.Entries;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SabreTools.Matching;
|
||||
using SabreTools.Numerics.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.Quantum;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.StarForce;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.SGA;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.SecuROM;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.SecuROM;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.TAR;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.BSP;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.VPK;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.WAD3;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.WiseInstaller;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.WiseInstaller;
|
||||
using SabreTools.Data.Models.WiseInstaller.Actions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
#pragma warning disable IDE0060 // Remove unused parameter
|
||||
namespace SabreTools.Wrappers
|
||||
|
||||
@@ -4,9 +4,7 @@ using System.IO;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Models.WiseInstaller;
|
||||
using SabreTools.Data.Models.WiseInstaller.Actions;
|
||||
#if NETFRAMEWORK || NETSTANDARD2_0
|
||||
using SabreTools.IO.Extensions;
|
||||
#endif
|
||||
using SabreTools.Numerics.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
using static SabreTools.Data.Models.Xbox.Constants;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
#if NET462_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
using System.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
using SharpCompress.Compressors.Xz;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.XZ;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.XZP;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Data.Models.XboxExecutable;
|
||||
using SabreTools.Text.Extensions;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Text;
|
||||
using SabreTools.Data.Extensions;
|
||||
using SabreTools.Text.Extensions;
|
||||
using static SabreTools.Data.Models.Xbox.Constants;
|
||||
|
||||
namespace SabreTools.Wrappers
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
#if NET462_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
using System.IO;
|
||||
using SabreTools.IO.Extensions;
|
||||
#endif
|
||||
using SabreTools.Matching;
|
||||
#if NET462_OR_GREATER || NETCOREAPP || NETSTANDARD2_0_OR_GREATER
|
||||
|
||||
Reference in New Issue
Block a user