internal void ReadJson(string fileName) { /* IF WE ALREADY HAVE A GALAXY LOADED WE NEED TO CLEAR IT */ Galaxy = null; MainData.SetGalaxyMap(null); MainContainer = null; /* CLEAR ANY STUFF ON THE CANVAS IF THERE IS ANY */ if (MainData.Canvas != null) { MainData.Canvas.Children.Clear(); } /* CLEAR THE CANVAS ELEMENT LIST */ MainData.canvasElements.Clear(); _currentFileName = fileName; Galaxy = JsonConvert.DeserializeObject <Model.Json.Galaxy>(File.ReadAllText(fileName)); MainData.SetGalaxyMap(Galaxy); /*Process the loaded sectors - need to see what race owns what sector */ foreach (Cluster cluster in Galaxy.Clusters) { ClusterHelperFunctions.ChooseClusterFillColour(cluster); if (cluster.FactionStart.Faction != Faction.PLAYER) { cluster.GameStart = true; } foreach (Connection con in cluster.Connections) { MainData.GetGalaxyMap().CanvasConnections.Add(new CanvasConnection(con.TargetClusterId, cluster.Id, con.ConnectionType)); } } MainData.GenerateEmptySectors(Galaxy, 20, 20, 75); }