public void Delete(NoDbSetting setting) { var path = Path.Combine(_settingsFolder, setting.SettingsKey + ".json"); File.Delete(path); ReadFromSettingsFolder(); }
public void Save(NoDbSetting setting) { var json = ConversionHelper.Serialize(setting, isIndented: true); var path = Path.Combine(_settingsFolder, setting.SettingsKey + ".json"); File.WriteAllText(path, json); ReadFromSettingsFolder(); }
public void New(NoDbSetting setting) { if (string.IsNullOrWhiteSpace(setting.SettingsKey)) { throw new Exception("Empty setting key!"); } var path = Path.Combine(_settingsFolder, setting.SettingsKey + ".json"); if (File.Exists(path)) { throw new Exception("Setting key already exists!"); } Save(setting); }