public void Save(AuthorizedKeysConfigurationModel model) { var text = JsonConvert.SerializeObject(model, Formatting.Indented); FileWithAcl.WriteAllText(_cfgFile, text, "644", "root", "wheel"); ConsoleLogger.Log("[authorizedkeys] configuration saved"); }
public void Save(AuthorizedKeysConfigurationModel model) { var text = JsonConvert.SerializeObject(model, Formatting.Indented); if (File.Exists(_cfgFile)) { File.Copy(_cfgFile, _cfgFileBackup, true); } File.WriteAllText(_cfgFile, text); ConsoleLogger.Log("[authorizedkeys] configuration saved"); }
public AuthorizedKeysConfiguration() { IoDir.CreateDirectory(Parameter.AntdCfgServices); if (!File.Exists(_cfgFile)) { _serviceModel = new AuthorizedKeysConfigurationModel(); } else { try { var text = File.ReadAllText(_cfgFile); var obj = JsonConvert.DeserializeObject <AuthorizedKeysConfigurationModel>(text); _serviceModel = obj; } catch (Exception) { _serviceModel = new AuthorizedKeysConfigurationModel(); } } }