public void LoadJobSettings() { // Initialize the _jsonSettings as a new object. _jobSettings = new BardSettings { CharacterFolder = _fface.Player.Name }; // Check if the .json settings file exists. if (Utilities.IsFileValid(_jobSettings.SettingsFolder + _jobSettings.CharacterFolder + _jobSettings.FileName)) { // Get the data from the file and deserialize the data into the _jsonSettings object. _jobSettings = JsonConvert.DeserializeObject <BardSettings>(Utilities.GetFileContents(_jobSettings.SettingsFolder + _jobSettings.CharacterFolder + _jobSettings.FileName)); } // Set the character values. _jobSettings.CharacterFolder = _fface.Player.Name; _jobSettings.SelfActions.Name = _fface.Player.Name; // Loop through each row in the DataGridView. foreach (DataGridViewRow row in brdGridView.Rows) { // Get the character data from the settings. BardCharacterActions characterAction = _jobSettings.CharacterActions.SingleOrDefault(x => x.Name == row.Cells[0].Value.ToString()); // Continue the loop if the character is not found. if (characterAction == null) { continue; } // Get the haste/regen values and set their checkboxes accordingly. DataGridViewCheckBoxCell pianBalladII = (DataGridViewCheckBoxCell)row.Cells[1]; pianBalladII.Value = characterAction.PianissimoBalladII; DataGridViewCheckBoxCell pianBalladIII = (DataGridViewCheckBoxCell)row.Cells[2]; pianBalladIII.Value = characterAction.PianissimoBalladIII; } brdCbStageMode.Checked = _jobSettings.SelfActions.Perform; // Check if abilities are set. brdCbTroubadour.Checked = _jobSettings.SelfActions.Troubadour; brdCbNightingale.Checked = _jobSettings.SelfActions.Nightingale; // Check if the first song was defined, otherwise select default. brdSongOne.SelectedIndex = !string.IsNullOrEmpty(_jobSettings.Songs.BardSongOne) ? brdSongOne.Items.IndexOf(_jobSettings.Songs.BardSongOne) : 0; // Check if Marcato is set for the first song. brdCbMarcatoSongOne.Checked = _jobSettings.Songs.BardSongOneMarcato; // Check if the second song was defined, otherwise select default. brdSongTwo.SelectedIndex = !string.IsNullOrEmpty(_jobSettings.Songs.BardSongTwo) ? brdSongTwo.Items.IndexOf(_jobSettings.Songs.BardSongTwo) : 0; // Check if Marcato is set for the second song. brdCbMarcatoSongTwo.Checked = _jobSettings.Songs.BardSongTwoMarcato; }
public Bard(FFACE instance, Content content) { _content = content; _fface = instance; _settingsForm = new BardForm(instance); BardSettings = new BardSettings { CharacterFolder = _fface.Player.Name }; // Check if the .json settings file exists. if (Utilities.IsFileValid(BardSettings.SettingsFolder + BardSettings.CharacterFolder + BardSettings.FileName)) { BardSettings = JsonConvert.DeserializeObject <BardSettings>(Utilities.GetFileContents(BardSettings.SettingsFolder + BardSettings.CharacterFolder + BardSettings.FileName)); } }