Exemplo n.º 1
0
        private void OnUpdatePath(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                _path = path;
                return;
            }

            BuildPathResolver resolver = BuildPathResolver.Resolver;

            Debug.Assert(resolver != null);

            string absolutePath = path;

            if (resolver != null)
            {
                absolutePath = resolver.ResolveAbsolute(path);
            }

            _path = absolutePath;
        }
Exemplo n.º 2
0
        /// <summary>
        /// This reads and sets its state or attributes stored in a <c>XML</c> format
        /// with the given reader.
        /// </summary>
        /// <param name="reader">
        /// The reader with which the <c>XML</c> attributes of this object are accessed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void ReadXml(XmlReader reader)
        {
            BuildExceptions.NotNull(reader, "reader");

            BuildPathResolver resolver = BuildPathResolver.Resolver;
            string            nodeName = reader.Name;

            if (String.Equals(nodeName, TagName,
                              StringComparison.OrdinalIgnoreCase))
            {
                if (reader.IsEmptyElement)
                {
                    _path = resolver.ResolveAbsolute(
                        reader.GetAttribute("value"));
                }
                else
                {
                    _path = reader.GetAttribute("value");
                    string hintPath = reader.ReadString();

                    if (String.IsNullOrEmpty(hintPath))
                    {
                        _path = resolver.ResolveAbsolute(_path);
                    }
                    else
                    {
                        base.HintPath = hintPath;
                    }
                }
            }
            else
            {
                nodeName = reader.Name;
                XmlNodeType nodeType = XmlNodeType.None;
                while (reader.Read())
                {
                    nodeType = reader.NodeType;
                    if (nodeType == XmlNodeType.Element && String.Equals(
                            nodeName, TagName, StringComparison.OrdinalIgnoreCase))
                    {
                        if (reader.IsEmptyElement)
                        {
                            _path = resolver.ResolveAbsolute(
                                reader.GetAttribute("value"));
                        }
                        else
                        {
                            _path = reader.GetAttribute("value");
                            string hintPath = reader.ReadString();

                            if (String.IsNullOrEmpty(hintPath))
                            {
                                _path = resolver.ResolveAbsolute(_path);
                            }
                            else
                            {
                                base.HintPath = hintPath;
                            }
                        }
                    }
                }
            }
        }