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