/// <summary> /// Initialize <see cref="SettingModel"/> via app.config /// </summary> public void InitializeSettingConfig() { // No config file exist, return if (!Directory.Exists(settingConfigPath) || !File.Exists(settingConfigFullName)) { return; } // Read config string configInJson = string.Empty; using (StreamReader configReader = new StreamReader(settingConfigFullName)) { configInJson = configReader.ReadToEnd(); } // Init SerializableSettingModel settingModel = null; try { settingModel = JsonConvert.DeserializeObject <SerializableSettingModel>(configInJson); } catch { // Log } SettingModel.Update(settingModel); }
/// <summary> /// Reset <see cref="SettingModel"/> as default. /// </summary> public void ResetSettingConfig() { SettingModel.Update(new SerializableSettingModel()); }