namespace OSMServer; public class RegionManager { private Dictionary regions; public RegionManager() { this.regions = new Dictionary(); } public Region GetRegion(Coordinates coordinates) { if(this.regions.ContainsKey(coordinates.GetRegionHash())) return this.regions[coordinates.GetRegionHash()]; else { Region newRegion = new Region(coordinates.GetRegionHash()); this.regions.Add(newRegion.regionHash, newRegion); return newRegion; } } public Region[] GetAllRegions() { return this.regions.Values.ToArray(); } }