mirror of
https://github.com/kwsch/PKHeX
synced 2024-12-18 00:13:10 +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`
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System;
|
|
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 sealed class StringInstructionSet
|
|
{
|
|
public readonly IReadOnlyList<StringInstruction> Filters;
|
|
public readonly IReadOnlyList<StringInstruction> Instructions;
|
|
|
|
private const string SetSeparator = ";";
|
|
|
|
public StringInstructionSet(IReadOnlyList<StringInstruction> filters, IReadOnlyList<StringInstruction> instructions)
|
|
{
|
|
Filters = filters;
|
|
Instructions = instructions;
|
|
}
|
|
|
|
public StringInstructionSet(ICollection<string> set)
|
|
{
|
|
Filters = StringInstruction.GetFilters(set).ToList();
|
|
Instructions = StringInstruction.GetInstructions(set).ToList();
|
|
}
|
|
|
|
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, StringComparison.Ordinal)).ToList();
|
|
yield return new StringInstructionSet(list);
|
|
}
|
|
}
|
|
}
|