public override bool SetSuffix(String suffixName, object value) { ConfigKey key = null; if (keys.ContainsKey(suffixName)) { key = keys[suffixName]; } else if (alias.ContainsKey(suffixName)) { key = alias[suffixName]; } if (key == null) { return(false); } if (value.GetType() == key.ValType) { key.Value = value; SaveConfigKey(key); return(true); } throw new Exception(string.Format("The value of the configuration key '{0}' has to be of type '{1}'", key.Name, key.ValType)); }
private void SaveConfigKey(ConfigKey key) { var config = PluginConfiguration.CreateForType <Config>(); config.load(); SaveConfigKey(key, config); config.save(); }
public override object GetSuffix(String suffixName) { ConfigKey key = null; if (keys.ContainsKey(suffixName)) { key = keys[suffixName]; } else if (alias.ContainsKey(suffixName)) { key = alias[suffixName]; } return(key != null ? key.Value : base.GetSuffix(suffixName)); }
public override ISuffixResult GetSuffix(string suffixName, bool failOkay = false) { ConfigKey key = null; if (keys.ContainsKey(suffixName)) { key = keys[suffixName]; } else if (alias.ContainsKey(suffixName)) { key = alias[suffixName]; } return(key != null ? new SuffixResult(FromPrimitiveWithAssert(key.Value)) : base.GetSuffix(suffixName, failOkay)); }
private void AddConfigKey(PropId id, ConfigKey key) { keys.Add(key.StringKey.ToUpper(), key); alias.Add(key.Alias.ToUpper(), key); properties.Add(id, key); }
private void SaveConfigKey(ConfigKey key, PluginConfiguration config) { config.SetValue(key.StringKey, keys[key.StringKey.ToUpper()].Value); }