mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-19 00:43:14 +00:00
a608e0b252
Remove some unnecessary properties from SaveFile Enumerate checksum flag results for GC memcard checking Remove unnecessary checks on savefile type Add some documentation Decapitalize some method parameters
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Processes input of strings into a list of valid Filters and Instructions.
|
|
/// </summary>
|
|
public class StringInstructionSet
|
|
{
|
|
public IList<StringInstruction> Filters { get; private set; }
|
|
public IList<StringInstruction> Instructions { get; private set; }
|
|
|
|
private const string SetSeparator = ";";
|
|
|
|
public static IEnumerable<StringInstructionSet> GetBatchSets(IList<string> lines)
|
|
{
|
|
int start = 0;
|
|
while (start < lines.Count)
|
|
{
|
|
var list = lines.Skip(start).TakeWhile(_ => !lines[start++].StartsWith(SetSeparator)).ToList();
|
|
yield return GetBatchSet(list);
|
|
}
|
|
}
|
|
|
|
private static StringInstructionSet GetBatchSet(ICollection<string> set)
|
|
{
|
|
return new StringInstructionSet
|
|
{
|
|
Filters = StringInstruction.GetFilters(set).ToList(),
|
|
Instructions = StringInstruction.GetInstructions(set).ToList(),
|
|
};
|
|
}
|
|
}
|
|
}
|