Libraries

This change looks dramatic, but it's just separating out the already-split namespaces into separate top-level folders. In theory, every single one could be built into their own Nuget package. `SabreTools.Serialization` still builds the normal Nuget package that is used by all other projects and includes all namespaces.
This commit is contained in:
Matt Nadareski
2026-03-21 16:26:56 -04:00
parent bec0aeb04c
commit 7689c6dd07
1495 changed files with 841 additions and 338 deletions

View File

@@ -0,0 +1,32 @@
using System;
using SabreTools.IO.Extensions;
namespace SabreTools.Data.Extensions
{
public static class XboxExecutableExtensions
{
/// <summary>
/// Convert a UInt32 to a formatted XBE title ID
/// </summary>
public static string? ToFormattedXBETitleID(this uint value)
{
// Convert to a byte array
byte[] data = BitConverter.GetBytes(value);
// Create the prefix
string prefix1 = (0x41 <= data[3] && data[3] <= 0x5A) || (0x30 <= data[3] && data[3] <= 0x39)
? $"{(char)data[3]}"
: $"{data[3]:X2}";
string prefix2 = (0x41 <= data[2] && data[2] <= 0x5A) || (0x30 <= data[2] && data[2] <= 0x39)
? $"{(char)data[2]}"
: $"{data[2]:X2}";
// Create the serial
int offset = 0;
ushort serial = data.ReadUInt16LittleEndian(ref offset);
// Assemble and return
return $"{prefix1}{prefix2}-{serial:D3}";
}
}
}