mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-30 07:50:32 +00:00
d47bb1d297
With the new version of Visual Studio bringing C# 12, we can revise our logic for better readability as well as use new methods/APIs introduced in the .NET 8.0 BCL.
22 lines
711 B
C#
22 lines
711 B
C#
using System;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
/// <summary>
|
|
/// Logic for recognizing .duc save files dumped via an ARDS.
|
|
/// </summary>
|
|
public sealed class SaveHandlerARDS : ISaveHandler
|
|
{
|
|
private const int sizeHeader = 0xA4;
|
|
private const int ExpectedSize = SaveUtil.SIZE_G4RAW + sizeHeader; // 0x800A4
|
|
|
|
public bool IsRecognized(long size) => size is ExpectedSize;
|
|
|
|
public SaveHandlerSplitResult TrySplit(ReadOnlySpan<byte> input)
|
|
{
|
|
// No authentication to see if it actually is a header; no size collisions expected.
|
|
var header = input[..sizeHeader].ToArray();
|
|
var data = input[sizeHeader..].ToArray();
|
|
return new SaveHandlerSplitResult(data, header, []);
|
|
}
|
|
}
|