Ejemplo n.º 1
0
        public void Delete(NoDbSetting setting)
        {
            var path = Path.Combine(_settingsFolder, setting.SettingsKey + ".json");

            File.Delete(path);
            ReadFromSettingsFolder();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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);
        }