public void LoadSavedSettingsIfExist(MachinaFileSystem fileSystem, WindowInterface window) { try { var json = fileSystem.ReadTextAppDataThenLocal("settings.json").Result; var data = JsonConvert.DeserializeObject <GameSettings>(json); LoadFromData(data); Apply(window); } catch (Exception e) { MachinaClient.Print("Failed to load settings", e.Message); } }
private void SaveSettings(MachinaFileSystem fileSystem) { fileSystem.WriteStringToAppData(JsonConvert.SerializeObject(this), "settings.json", true); }
public void ApplyAndSave(MachinaFileSystem fileSystem, WindowInterface window) { Apply(window); SaveSettings(fileSystem); }