mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-25 03:43:16 +00:00
fc754b346b
[Language Reference](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-10.0/file-scoped-namespaces) Updates all the files, one less level of indentation. Some small changes were made to API surfaces, renaming `PKM pkm` -> `PKM pk`, and `LegalityAnalysis.pkm` -> `LegalityAnalysis.Entity`
29 lines
1,001 B
C#
29 lines
1,001 B
C#
using System;
|
|
using static System.Buffers.Binary.BinaryPrimitives;
|
|
|
|
namespace PKHeX.Core;
|
|
|
|
public sealed class PWTBlock5 : SaveBlock<SAV5B2W2>
|
|
{
|
|
public PWTBlock5(SAV5B2W2 sav, int offset) : base(sav) => Offset = offset;
|
|
|
|
public ushort GetPWTRecord(int id) => GetPWTRecord((PWTRecordID)id);
|
|
|
|
public ushort GetPWTRecord(PWTRecordID id)
|
|
{
|
|
if (id is < PWTRecordID.Normal or > PWTRecordID.MixMaster)
|
|
throw new ArgumentOutOfRangeException(nameof(id));
|
|
int ofs = Offset + 0x5C + ((int)id * 2);
|
|
return ReadUInt16LittleEndian(Data.AsSpan(ofs));
|
|
}
|
|
|
|
public void SetPWTRecord(int id, ushort value) => SetPWTRecord((PWTRecordID)id, value);
|
|
|
|
public void SetPWTRecord(PWTRecordID id, ushort value)
|
|
{
|
|
if (id is < PWTRecordID.Normal or > PWTRecordID.MixMaster)
|
|
throw new ArgumentOutOfRangeException(nameof(id));
|
|
int ofs = Offset + 0x5C + ((int)id * 2);
|
|
WriteUInt16LittleEndian(Data.AsSpan(ofs), value);
|
|
}
|
|
}
|