mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-27 22:40:22 +00:00
30e36579be
add more xmldoc revise some comments for clarity redo a little bit of logic for perf rename some methods for better description
37 lines
No EOL
1.1 KiB
C#
37 lines
No EOL
1.1 KiB
C#
using System;
|
|
using System.IO;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Level Up Learn Movepool Information
|
|
/// </summary>
|
|
public sealed class Learnset6 : Learnset
|
|
{
|
|
private Learnset6(byte[] data)
|
|
{
|
|
if (data.Length < 4 || data.Length % 4 != 0)
|
|
{ Count = 0; Levels = Moves = Array.Empty<int>(); return; }
|
|
Count = (data.Length / 4) - 1;
|
|
Moves = new int[Count];
|
|
Levels = new int[Count];
|
|
using (var ms = new MemoryStream(data))
|
|
using (var br = new BinaryReader(ms))
|
|
{
|
|
for (int i = 0; i < Count; i++)
|
|
{
|
|
Moves[i] = br.ReadInt16();
|
|
Levels[i] = br.ReadInt16();
|
|
}
|
|
}
|
|
}
|
|
|
|
public static Learnset[] GetArray(byte[][] entries)
|
|
{
|
|
Learnset[] data = new Learnset[entries.Length];
|
|
for (int i = 0; i < data.Length; i++)
|
|
data[i] = new Learnset6(entries[i]);
|
|
return data;
|
|
}
|
|
}
|
|
} |