using System; using System.IO; using System.Collections.Generic; using System.Linq; namespace codehunt.datarelease { public class Data { private IReadOnlyDictionary levels; private IReadOnlyDictionary users; public Data(DirectoryInfo directory) { levels = Level.EnumerateAll(directory).ToDictionary(l => l.LevelName); users = User.EnumerateAll(directory).ToDictionary(u => u.Num); } public IReadOnlyDictionary LevelsByName { get { return levels; } } public IReadOnlyDictionary UsersByNumber { get { return users; } } public IEnumerable Levels { get { return levels.Values.OrderBy(l => l.LevelName); } } public IEnumerable Users { get { return users.Values.OrderBy(u => u.Num); } } } }