internal void LoadUserSection() { try { var contentsUser = File.ReadAllText(UserStoragePath); User = JsonConvert.DeserializeObject <UserSection>(contentsUser); } catch (FileNotFoundException) { User = UserSection.GetDefault(); SaveUserSection(); } }
internal void LoadUserSection(string path = null) { if (User != null) { SaveUserSection(); } var configPath = File.Exists(path) ? path : UserStoragePath; try { var contentsUser = File.ReadAllText(UserStoragePath); User = JsonConvert.DeserializeObject <UserSection>(contentsUser); User.ConfigPath = configPath; } catch (FileNotFoundException) { User = UserSection.GetDefault(); User.ConfigPath = configPath; SaveUserSection(); } }