public SaveEditor(string jsonFile) { InitializeComponent(); Savegame = Savegame.GetSavegameFromJson(jsonFile); // make a copy of players EditingPlayers = Savegame.Players.Select(a => a?.DeepClone()).ToArray(); foreach (var p in Savegame.Players) { PlayerSelectionComboBox.Items.Add(p.Name); } PlayerSelectionComboBox.SelectedIndex = 0; }
public SaveEditor(string jsonFile) { InitializeComponent(); Savegame = Savegame.GetSavegameFromJson(jsonFile); // make a copy of players try { EditingPlayers = Savegame.Players.Select(a => a?.DeepClone()).ToArray(); } catch (Exception ex) { var er = new ErrorReporting($"Fail to clone players.\n\n{ex}", null); er.ShowDialog(); throw; } foreach (var p in Savegame.Players) { PlayerSelectionComboBox.Items.Add(p.Name); } PlayerSelectionComboBox.SelectedIndex = 0; }