コード例 #1
0
        public void SaveSettings(Settings.SerializedForm serializedForm)
        {
            JsonWriter writer = new JsonWriter();

            writer.PrettyPrint = true;
            JsonMapper.ToJson(serializedForm, writer);
            string       json = writer.ToString();
            StreamWriter sr   = new StreamWriter(this.configFile);

            sr.Write(json);
            sr.Close();
        }
コード例 #2
0
        public Settings.SerializedForm LoadSettings()
        {
            if (!File.Exists(this.configFile))
            {
                return(null);
            }
            StreamReader sr = new StreamReader(this.configFile);

            Settings.SerializedForm serializedForm = JsonMapper.ToObject <Settings.SerializedForm>(sr.ReadToEnd());
            sr.Close();
            return(serializedForm);
        }