public static void ReadMapFile(string filename, MapView Map) { MapView view = MapView.FromJSON(File.ReadAllText(filename)); byte[] bytes = File.ReadAllBytes(filename); bPosition = 0; Dictionary <long, bool> DoneOffsets = new Dictionary <long, bool>(); for (int x = 0; x < MapView.SIZEX; x++) { for (int y = 0; y < MapView.SIZEY; y++) { if (view.HasTile(x, y) && !Map.HasTile(x, y)) { // Ensure the Map dictionary has this index. Map.AddMapTile(x, y, view.GetTile(x, y)); } } } }