public void LoadUserSettingsFromFile() { var dir = Path.Combine(_appSettings.Dirs.Config, "usersettings.json"); if (File.Exists(dir)) { _userSettings = JsonConvert.DeserializeObject <UserSettings>(File.ReadAllText(dir)); OnUserSettingsChanged?.Invoke(this, new GenericEventArgs <UserSettings>(_userSettings)); } }
public async Task <UserSettings> SaveUserSettingsAsync(UserSettings userSettings, long version) { if (userSettings.MediaServer.ServerBaseUrl == "/") { userSettings.MediaServer.ServerBaseUrl = ""; } _userSettings = userSettings; _userSettings.Version = version; var strJson = JsonConvert.SerializeObject(_userSettings, Formatting.Indented); var dir = Path.Combine(_appSettings.Dirs.Config, "usersettings.json"); await File.WriteAllTextAsync(dir, strJson); CreateRollbarLogger(); OnUserSettingsChanged?.Invoke(this, new GenericEventArgs <UserSettings>(_userSettings)); return(_userSettings); }