Пример #1
0
        /// <summary>
        /// Pendent
        /// </summary>
        /// <param name="piece">The piece.</param>
        public UrlParts AppendPath(string piece)
        {
            if (piece.Length != 1 && piece.EndsWith("/"))
            {
                piece = piece.Substring(0, piece.Length - 1);
            }

            if (nextPathBelongsToPathInfo)
            {
                PathInfo.Add(piece);
            }
            else
            {
                if (!piece.StartsWith("/") && HasLastChar && LastChar != '/')
                {
                    url.Append('/');
                }

                url.Append(piece);
            }

            if (HasLastChar && piece.IndexOf('.') != -1)             // this is fragile!
            {
                nextPathBelongsToPathInfo = true;
            }

            return(this);
        }