Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        private void SaveConfigKey(ConfigKey key)
        {
            var config = PluginConfiguration.CreateForType <Config>();

            config.load();
            SaveConfigKey(key, config);
            config.save();
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
 private void AddConfigKey(PropId id, ConfigKey key)
 {
     keys.Add(key.StringKey.ToUpper(), key);
     alias.Add(key.Alias.ToUpper(), key);
     properties.Add(id, key);
 }
Esempio n. 6
0
 private void SaveConfigKey(ConfigKey key, PluginConfiguration config)
 {
     config.SetValue(key.StringKey, keys[key.StringKey.ToUpper()].Value);
 }