EscapeString() private method

private EscapeString ( string str ) : string
str string
return string
Esempio n. 1
0
        /// <include file='doc\uribuilder.uex' path='docs/doc[@for="UriBuilder.UriBuilder5"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public UriBuilder(string scheme,
                          string host,
                          int port,
                          string pathValue
                          ) : this(scheme, host, port)
        {
            bool escaped;

            Path = Uri.EscapeString(ConvertSlashes(pathValue), false, out escaped);
        }
Esempio n. 2
0
        private string Format(string s, UriFormat format)
        {
            if (s.Length == 0)
            {
                return(String.Empty);
            }

            switch (format)
            {
            case UriFormat.UriEscaped:
                return(Uri.EscapeString(s, Uri.EscapeCommonHexBrackets));

            case UriFormat.SafeUnescaped:
                return(Uri.UnescapeDataString(s, true));

            case UriFormat.Unescaped:
                return(Uri.Unescape(s, false));

            default:
                throw new ArgumentOutOfRangeException("format");
            }
        }
Esempio n. 3
0
        private string Format(string s, UriFormat format)
        {
            if (s.Length == 0)
            {
                return(string.Empty);
            }
            switch (format)
            {
            case UriFormat.UriEscaped:
                return(Uri.EscapeString(s, escapeReserved: false, escapeHex: true, escapeBrackets: true));

            case UriFormat.SafeUnescaped:
                s = Uri.Unescape(s, excludeSpecial: false);
                return(s);

            case UriFormat.Unescaped:
                return(Uri.Unescape(s, excludeSpecial: false));

            default:
                throw new ArgumentOutOfRangeException("format");
            }
        }
Esempio n. 4
0
        private string Format(string s, UriFormat format)
        {
            if (s.Length == 0)
            {
                return(String.Empty);
            }

            switch (format)
            {
            case UriFormat.UriEscaped:
                return(Uri.EscapeString(s, false, true, true));

            case UriFormat.SafeUnescaped:
                // TODO subset of escape rules
                s = Uri.Unescape(s, false);
                return(s);                //Uri.EscapeString (s, false, true, true);

            case UriFormat.Unescaped:
                return(Uri.Unescape(s, false));

            default:
                throw new ArgumentOutOfRangeException("format");
            }
        }