Exemple #1
0
 public static void Get(Action <ClusterConfig> deliver)
 {
     try
     {
         if (File.Exists(FileName))
         {
             var data = File.ReadAllText(FileName);
             var cfg  = JsonHelper.Parse <ClusterConfig>(data);
             deliver(cfg);
         }
         else
         {
             var cfg = new ClusterConfig(true);
             Write(cfg);
             deliver(cfg);
         }
     }
     catch (Exception x)
     {
         Logger.Exception <ClusterConfigManager>(x);
     }
 }
Exemple #2
0
        public static void Write(ClusterConfig cfg)
        {
            var data = JsonHelper.ToString(cfg);

            File.WriteAllText(FileName, data);
        }