예제 #1
0
        /// <summary>
        /// Set the value to the value in the ini file, or default
        /// </summary>
        /// <returns></returns>
        public void SetValueFromProperties(IDictionary <string, string> properties)
        {
            string propertyName  = _attributes.Name;
            string propertyValue = null;

            if (properties.ContainsKey(propertyName) && properties[propertyName] != null)
            {
                propertyValue = _containingIniSection.PreCheckValue(propertyName, properties[propertyName]);
            }
            UseValueOrDefault(propertyValue);
        }
        /// <summary>
        /// Set the value to the value in the ini file, or default
        /// </summary>
        /// <returns></returns>
        public void SetValueFromProperties(Dictionary <string, string> properties)
        {
            string propertyName = attributes.Name;
            string defaultValue = attributes.DefaultValue;

            // Get the value from the ini file, if there is none take the default
            if (!properties.ContainsKey(propertyName) && defaultValue != null)
            {
                // Mark as dirty, we didn't use properties from the file (even defaults from the default file are allowed)
                containingIniSection.IsDirty = true;
                //LOG.Debug("Passing default: " + propertyName + "=" + propertyDefaultValue);
            }

            string propertyValue = null;

            if (properties.ContainsKey(propertyName) && properties[propertyName] != null)
            {
                propertyValue = containingIniSection.PreCheckValue(propertyName, properties[propertyName]);
            }
            UseValueOrDefault(propertyValue);
        }