Example #1
0
        public static void Save(RsyncConfigurationModel model)
        {
            var text = JsonConvert.SerializeObject(model, Formatting.Indented);

            FileWithAcl.WriteAllText(CfgFile, text, "644", "root", "wheel");
            ConsoleLogger.Log("[rsync] configuration saved");
        }
Example #2
0
        public void Save(RsyncConfigurationModel model)
        {
            var text = JsonConvert.SerializeObject(model, Formatting.Indented);

            if (File.Exists(_cfgFile))
            {
                File.Copy(_cfgFile, _cfgFileBackup, true);
            }
            File.WriteAllText(_cfgFile, text);
            ConsoleLogger.Log("[rsync] configuration saved");
        }
Example #3
0
 public RsyncConfiguration()
 {
     IoDir.CreateDirectory(Parameter.AntdCfgServices);
     if (!File.Exists(_cfgFile))
     {
         _serviceModel = new RsyncConfigurationModel();
     }
     else
     {
         try {
             var text = File.ReadAllText(_cfgFile);
             var obj  = JsonConvert.DeserializeObject <RsyncConfigurationModel>(text);
             _serviceModel = obj;
         }
         catch (Exception) {
             _serviceModel = new RsyncConfigurationModel();
         }
     }
 }