Exemple #1
0
        public void SaveConfig(Config config)
        {
            currentCfg = config;

            using (StreamWriter sw = new StreamWriter(cfgPath))
            {
                sw.WriteAsync(SimpleJson.SimpleJson.SerializeObject(currentCfg));
            }
        }
Exemple #2
0
        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);
                }
            }
        }