public void AddSetting(string name, bool default_value, 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 ASLSetting(name, default_value, description, parent); Settings.Add(name, setting); OrderedSettings.Add(setting); }
/// <summary> /// Returns true only if this setting and all it's parent settings are true. /// </summary> private bool GetSettingValueRecursive(ASLSetting setting) { if (!setting.Value) { return(false); } if (setting.Parent == null) { return(setting.Value); } return(GetSettingValueRecursive(Settings[setting.Parent])); }
public void AddSetting(string name, bool default_value, 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 ASLSetting(name, default_value, description, parent); Settings.Add(name, setting); OrderedSettings.Add(setting); }
/// <summary> /// Returns true only if this setting and all it's parent settings are true. /// </summary> private bool GetSettingValueRecursive(ASLSetting setting) { if (!setting.Value) return false; if (setting.Parent == null) return setting.Value; return GetSettingValueRecursive(Settings[setting.Parent]); }