mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Minor tweaks
use assert instead of manual exceptions span remove some dead logic
This commit is contained in:
parent
25fa52e597
commit
74e0cba3b0
5 changed files with 6 additions and 25 deletions
|
@ -55,8 +55,8 @@ namespace PKHeX.Core
|
|||
return memory_list1;
|
||||
}
|
||||
|
||||
public string[] GetMemoryQualities() => s.memories.Slice(2, 7);
|
||||
public string[] GetMemoryFeelings(int format) => format >= 8 ? s.memories.Slice(9, 25) : s.memories.Slice(10, 24); // empty line for 0 in gen8+
|
||||
public ReadOnlySpan<string> GetMemoryQualities() => s.memories.AsSpan(2, 7);
|
||||
public ReadOnlySpan<string> GetMemoryFeelings(int format) => format >= 8 ? s.memories.AsSpan(9, 25) : s.memories.AsSpan(10, 24); // empty line for 0 in gen8+
|
||||
|
||||
public List<ComboItem> GetArgumentStrings(MemoryArgType type) => type switch
|
||||
{
|
||||
|
|
|
@ -13,11 +13,8 @@ namespace PKHeX.Core
|
|||
public static byte[][] Unpack(byte[] fileData, string identifier)
|
||||
{
|
||||
#if DEBUG
|
||||
if (fileData.Length < 4)
|
||||
throw new ArgumentException(nameof(fileData));
|
||||
|
||||
if (identifier[0] != fileData[0] || identifier[1] != fileData[1])
|
||||
throw new ArgumentException(nameof(identifier));
|
||||
System.Diagnostics.Debug.Assert(fileData.Length > 4);
|
||||
System.Diagnostics.Debug.Assert(identifier[0] == fileData[0] && identifier[1] == fileData[1]);
|
||||
#endif
|
||||
int count = BitConverter.ToUInt16(fileData, 2); int ctr = 4;
|
||||
int start = BitConverter.ToInt32(fileData, ctr); ctr += 4;
|
||||
|
|
|
@ -97,6 +97,7 @@ namespace PKHeX.Core
|
|||
set => value.SaveAll(General);
|
||||
}
|
||||
|
||||
// reverse crc32 polynomial, nice!
|
||||
private const uint MysteryGiftDPSlotActive = 0xEDB88320;
|
||||
|
||||
public bool[] GetMysteryGiftDPSlotActiveFlags()
|
||||
|
|
|
@ -801,22 +801,5 @@ namespace PKHeX.Core
|
|||
FR or LG or FRLG => new SAV3FRLG(sav.State.BAK),
|
||||
_ => throw new ArgumentException(nameof(ver))
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="PersonalTable"/> for a Gen3 save file.
|
||||
/// </summary>
|
||||
/// <param name="ver">Version to retrieve for</param>
|
||||
/// <returns>Reference to the <see cref="PersonalTable"/>.</returns>
|
||||
public static PersonalTable GetG3Personal(GameVersion ver) => ver switch
|
||||
{
|
||||
RS => PersonalTable.RS,
|
||||
E => PersonalTable.E,
|
||||
FRLG => PersonalTable.FR,
|
||||
FR => PersonalTable.FR,
|
||||
LG => PersonalTable.LG,
|
||||
R => PersonalTable.RS,
|
||||
S => PersonalTable.RS,
|
||||
_ => throw new ArgumentException(nameof(ver))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace PKHeX.WinForms
|
|||
// Cell Data @ 0x1D8C
|
||||
// Use constants 0x18C/2 = 198 thru +95
|
||||
ushort[] constants = SAV.GetEventConsts();
|
||||
ushort[] cells = constants.Slice(celloffset, CellCount);
|
||||
var cells = constants.AsSpan(celloffset, CellCount);
|
||||
|
||||
int cellCount = constants[cellstotal];
|
||||
int cellCollected = constants[cellscollected];
|
||||
|
|
Loading…
Reference in a new issue