public void Save(NetscanSettingModel model) { if (File.Exists(_filePath)) { File.Copy(_filePath, _filePathBackup, true); } File.WriteAllText(_filePath, JsonConvert.SerializeObject(model, Formatting.Indented)); }
public NetscanConfiguration() { if (!File.Exists(_filePath)) { _settings = new NetscanSettingModel { Values = Values() }; } try { _settings = JsonConvert.DeserializeObject <NetscanSettingModel>(File.ReadAllText(_filePath)); } catch (Exception) { _settings = new NetscanSettingModel { Values = Values() }; } }
public void Save(NetscanSettingModel model) { FileWithAcl.WriteAllText(_filePath, JsonConvert.SerializeObject(model, Formatting.Indented), "644", "root", "wheel"); }