public void Run(string path, IReaderConfig config) { var parser = new Parser(); var statLines = parser.Parse(path, config); var smallestSpread = statLines.OrderBy(e => e.Delta).First(); Console.WriteLine($"{config.ObjectName} {smallestSpread.Identity} has the smallest spread with {smallestSpread.Delta}"); Console.WriteLine("Press any key"); Console.ReadKey(); }
public IEnumerable <StatLine> Parse(string filePath, IReaderConfig config) { var lines = File.ReadLines(filePath); foreach (var line in lines) { if (config.IsMeaningfulLine(line)) { yield return(new StatLine { Identity = line.Substring(config.IdentityStart, config.IdentityLen).Trim(), Min = int.Parse(line.Substring(config.AStart, 2)), Max = int.Parse(line.Substring(config.BStart, 2)) }); } } }