Esempio n. 1
0
 public static Config GetInstance()
 {
     if (instance == null)
     {
         lock (locker)
         {
             if (instance == null)
             {
                 instance = GetConfig();
             }
         }
     }
     return instance;
 }
Esempio n. 2
0
 private static Config GetConfig()
 {
     string configStr = CommonHelper.GetConfigStr(path);
     Config config = null;
     if (string.IsNullOrEmpty(configStr))
     {
         config = new Config();
         string json = JsonConvert.SerializeObject(instance, Formatting.Indented);
         CommonHelper.SaveConfig(path, json);
     }
     else
     {
         config = JsonConvert.DeserializeObject<Config>(configStr);
     }
     return config;
 }