private static Parser <StepmaniaMeasure> Measure(StepChartType chartType) => from rowStrings in Utilities.ListOf(Parse.LetterOrDigit.Many().Text(), Parse.String("\r\n").Or(Parse.String("\n"))) let nonEmptyRows = rowStrings.Where(x => !string.IsNullOrEmpty(x)).ToArray() let rows = nonEmptyRows.Select((row, rowIndex) => ParseRow(row.Trim(), chartType, rowIndex, nonEmptyRows.Length)) select new StepmaniaMeasure(rows);
private static StepmaniaRow ParseRow(string notes, StepChartType chartType, int rowIndex, int rowCount) => new StepmaniaRow( notes.Select( (note, noteIndex) => new StepmaniaNote(DirectionLookup[chartType][noteIndex], rowCount, (double)rowIndex / rowCount, StepTypeLookup[note])).Where(x => x.Type != StepType.None));