private void Parse(string file) { var ini = new IniFile(file); SetValues(this, ini["Version Section"].Values); SetValues(this, ini["Signature Section"].Values); SetValues(this, ini["Schedule"].Values); var steps = new List<Step>(); foreach (var section in ini.Where(x => x.Name.IsMatch(@"^Schedule_Step\d+$"))) { var step = new Step(); step.Number = int.Parse(section.Name.Match(@"^Schedule_Step(\d+)$")); SetValues(step, section.Values); steps.Add(step); } Steps = steps.OrderBy(x => x.Number).ToList(); foreach (var section in ini.Where(x => x.Name.IsMatch(@"^Schedule_Step\d+_Limit\d+$"))) { var limit = new Limit(); limit.Number = int.Parse(section.Name.Match(@"^Schedule_Step\d+_Limit(\d+)$")); SetValues(limit, section.Values); var equationNumber = @"^Equation(\d+).*$"; foreach (var equationValues in section.Values .Where(x => x.Key.IsMatch(@"^Equation\d+.*$")) .GroupBy(x => x.Key.Match(equationNumber))) { var equation = new Equation(); equation.Number = int.Parse(equationValues.First().Key.Match(equationNumber)); SetValues(equation, equationValues.ToDictionary(x => x.Key.Match(@"^Equation\d+(.*)$"), x => x.Value)); limit.Equations = limit.Equations.Concat(equation).OrderBy(x => x.Number).ToList(); } var step = Steps[int.Parse(section.Name.Match(@"^Schedule_Step(\d+)_Limit\d+$"))]; step.Limits = step.Limits.Concat(limit).OrderBy(x => x.Number).ToList(); } }