예제 #1
0
        public static SimpleSetting Read()
        {
            SimpleSetting ss = null;

            try
            {
                string json = File.ReadAllText(settingFilename);
                try
                {
                    ss = JsonConvert.DeserializeObject <SimpleSetting>(json);
                }
                catch (Exception ex)
                {
                    ss = new SimpleSetting();
                    Write(ss);
                }
            }
            catch (FileNotFoundException ex)
            {
                ss = new SimpleSetting();
                Write(ss);
            }
            return(ss);
        }
예제 #2
0
        public static void Write(SimpleSetting ss)
        {
            var json = JsonConvert.SerializeObject(ss, Formatting.Indented);

            File.WriteAllText(settingFilename, json);
        }