Пример #1
0
 public void Write <T>(string key, T value, bool save = true)
 {
     //不存在或与默认值不相同才写入
     if (UserSettings.ContainsKey(key) || JsonConvert.SerializeObject(DefaultSettings[key]) != JsonConvert.SerializeObject(value))
     {
         UserSettings[key] = value == null ? null : JToken.FromObject(value);
     }
     //立刻保存
     if (save)
     {
         Save();
     }
 }