/// <summary> /// Returns true only if this setting and all it's parent settings are true. /// </summary> private dynamic GetSettingValueRecursive(VASLSetting setting) { if (!setting.Value) { return(false); } if (setting.Parent == null) { return(setting.Value); } return(GetSettingValueRecursive(Settings[setting.Parent])); }
public void AddSetting(string name, dynamic defaultValue, string description, string parent) { if (description == null) { description = name; } if (parent != null && !Settings.ContainsKey(parent)) { throw new ArgumentException($"Parent for setting '{name}' is not a setting: {parent}"); } if (Settings.ContainsKey(name)) { throw new ArgumentException($"Setting '{name}' was already added"); } var setting = new VASLSetting(name, defaultValue, description, parent); Settings.Add(name, setting); OrderedSettings.Add(setting); }