/// <summary> /// Loads JSON Setting file from %programfolder% /// </summary> public void LoadSettings() { SettingsStructure _settings = new SettingsStructure { //defaults Version = currentAppVersion, Language = "en", TosFolder = @"C:\Program Files (x86)\Steam\steamapps\common\TreeOfSavior\", Style = "default", DisplayUnknown = false, FirstStart = true, IsGrouped = true, LoadDates = false }; SettingsStructure _jsonSettings = JsonManager.LoadFile <SettingsStructure>("settings.json"); if (_jsonSettings == null) { //Any exception we create a new settings file if (JsonManager.CreateFile("settings.json", _settings) == false) { CauseError("There was an issue creating the settings file."); return; } } else { _settings = _jsonSettings; } InitSettings(_settings); }
/// <summary> /// Saves settings /// </summary> public void Save() { SettingsStructure _settings = new SettingsStructure { Version = currentAppVersion, Language = Language, TosFolder = TosFolder, Style = Style, DisplayUnknown = DisplayUnknown, FirstStart = FirstStart, IsGrouped = IsGrouped, LoadDates = LoadDates }; if (JsonManager.CreateFile("settings.json", _settings) == false) { CauseError("There was an issue saving settings."); } }