private static void SaveBoolean(OptionName.SettingIds name, bool variableValue, WritableSettingsStore settingsStore) { if (!settingsStore.CollectionExists(defaultCollectionPath)) { settingsStore.CreateCollection(defaultCollectionPath); } settingsStore.SetBoolean(defaultCollectionPath, name.ToString(), variableValue); }
private static void Save(OptionName.SettingIds name, string variableValue, ProvideSavedSettings settingsProvider) { var variableName = OptionName.OptionNameForSave(name); if (settingsProvider.GetVariableExists(variableName)) { settingsProvider[name] = variableValue; } else { settingsProvider[name] = variableValue; settingsProvider.SetVariablePersists(variableName, true); } }
private static bool LoadBoolean(OptionName.SettingIds name, ProvideSavedSettings settingsProvider, bool defaultValue) { var variableName = OptionName.OptionNameForLoad(name); if (settingsProvider.GetVariableExists(variableName)) { bool isEnabled; var variableValue = (string)settingsProvider[name]; bool.TryParse(variableValue, out isEnabled); return(isEnabled); } return(defaultValue); }
public object this[OptionName.SettingIds name] { get { if (_globals != null) { var variableName = OptionName.OptionNameForLoad(name); return(_globals[variableName]); } return(null); } set { if (_globals != null) { var variableName = OptionName.OptionNameForSave(name); _globals[variableName] = value; } } }
private void Save(OptionName.SettingIds name, string variableValue) { if (_globals == null) { Log.Information(string.Format("globals was null trying to set {0} to {1}", name, variableValue)); return; } var variableName = OptionName.OptionNameForSave(name); Log.Information(string.Format("globals setting {0} set to {1}", variableName, variableValue)); if (_globals.VariableExists[variableName]) { _globals[variableName.ToString()] = variableValue; } else { _globals[variableName] = variableValue; Log.Information(string.Format("globals setting {0} set to persist", variableName)); _globals.VariablePersists[variableName] = true; } }
private static bool LoadBoolean(OptionName.SettingIds name, SettingsStore settingsStore, bool defaultValue) { return(settingsStore.GetBoolean(defaultCollectionPath, name.ToString(), defaultValue)); }