better deserialization

This commit is contained in:
Nicolas Constant 2021-05-28 21:09:09 -04:00
parent 7ed993e51d
commit 0e787bbca8
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688

View file

@ -90,11 +90,18 @@ namespace BSLManager.Tools
private LocalSettingsData GetLocalSettingsFile()
{
if (!File.Exists(LocalFileName)) return null;
try
{
if (!File.Exists(LocalFileName)) return null;
var jsonContent = File.ReadAllText(LocalFileName);
var content = JsonConvert.DeserializeObject<LocalSettingsData>(jsonContent);
return content;
var jsonContent = File.ReadAllText(LocalFileName);
var content = JsonConvert.DeserializeObject<LocalSettingsData>(jsonContent);
return content;
}
catch (Exception)
{
return null;
}
}
private void SaveLocalSettings(LocalSettingsData data)