public void SaveConfig(Config config) { currentCfg = config; using (StreamWriter sw = new StreamWriter(cfgPath)) { sw.WriteAsync(SimpleJson.SimpleJson.SerializeObject(currentCfg)); } }
private void ReLoadConfig() { if (!File.Exists(cfgPath)) { currentCfg = new Config(); SaveConfig(currentCfg); } else { using (StreamReader sr = new StreamReader(cfgPath)) { string cfg = sr.ReadToEnd(); currentCfg = SimpleJson.SimpleJson.DeserializeObject<Config>(cfg); } } }