Beispiel #1
0
        public string GetValue(string section, string key, bool isPath)
        {
            if (String.IsNullOrEmpty(section))
            {
                throw new ArgumentException("TODO: CommonResources.Argument_Cannot_Be_Null_Or_Empty", nameof(section));
            }

            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentException("TODO: CommonResources.Argument_Cannot_Be_Null_Or_Empty", nameof(key));
            }

            XElement element = null;
            string   ret     = null;

            if (_redirect != null)
            {
                element = _redirect.GetValueInternal(section, key, curr: null);
                if (element != null)
                {
                    return(ElementToValue(element, isPath));
                }
            }

            var curr = this;

            while (curr != null)
            {
                XElement newElement = curr.GetValueInternal(section, key, element);
                if (!object.ReferenceEquals(element, newElement))
                {
                    element = newElement;

                    // we need to evaluate using current Settings in case value needs path transformation
                    ret = curr.ElementToValue(element, isPath);
                }
                curr = curr._next;
            }

            return(ret);
        }