GetComponentsHelper() private method

private GetComponentsHelper ( UriComponents uriComponents, UriFormat uriFormat ) : string
uriComponents UriComponents
uriFormat UriFormat
return string
Example #1
0
        //
        // This method is invoked to allow a custom parser to override the
        // internal parser when serving application with Uri component strings.
        // The output format depends on the "format" parameter
        //
        // Parameters:
        //  uriComponents   - Which components are to be retrieved.
        //  uriFormat       - The requested output format.
        //
        // This method returns:
        // The final result. The base implementation could be invoked to get a suggested value
        //
        protected virtual string GetComponents(Uri uri, UriComponents components, UriFormat format)
        {
            if (((components & UriComponents.SerializationInfoString) != 0) && components != UriComponents.SerializationInfoString)
            {
                throw new ArgumentOutOfRangeException(nameof(components), components, SR.net_uri_NotJustSerialization);
            }

            if ((format & ~UriFormat.SafeUnescaped) != 0)
            {
                throw new ArgumentOutOfRangeException(nameof(format));
            }

            if (uri.UserDrivenParsing)
            {
                throw new InvalidOperationException(SR.Format(SR.net_uri_UserDrivenParsing, this.GetType()));
            }

            if (!uri.IsAbsoluteUri)
            {
                throw new InvalidOperationException(SR.net_uri_NotAbsolute);
            }

            if (uri.DisablePathAndQueryCanonicalization && (components & (UriComponents.Path | UriComponents.Query)) != 0)
            {
                throw new InvalidOperationException(SR.net_uri_GetComponentsCalledWhenCanonicalizationDisabled);
            }

            return(uri.GetComponentsHelper(components, format));
        }
 protected virtual string GetComponents(Uri uri, UriComponents components, UriFormat format)
 {
     if (((components & UriComponents.SerializationInfoString) != 0) && (components != UriComponents.SerializationInfoString))
     {
         throw new ArgumentOutOfRangeException("UriComponents.SerializationInfoString");
     }
     if ((format & ~UriFormat.SafeUnescaped) != ((UriFormat)0))
     {
         throw new ArgumentOutOfRangeException("format");
     }
     if (uri.UserDrivenParsing)
     {
         throw new InvalidOperationException(SR.GetString("net_uri_UserDrivenParsing", new object[] { base.GetType().FullName }));
     }
     if (!uri.IsAbsoluteUri)
     {
         throw new InvalidOperationException(SR.GetString("net_uri_NotAbsolute"));
     }
     return(uri.GetComponentsHelper(components, format));
 }
Example #3
0
        //
        // This method is invoked to allow a cutsom parser to override the
        // internal parser when serving application with Uri componenet strings.
        // The output format depends on the "format" parameter
        //
        // Parameters:
        //  uriComponents   - Which components are to be retrieved.
        //  uriFormat       - The requested output format.
        //
        // This method returns:
        // The final result. The base impementaion could be invoked to get a suggested value
        //
        protected virtual string GetComponents(Uri uri, UriComponents components, UriFormat format)
        {
            if (((components & UriComponents.SerializationInfoString) != 0) && components != UriComponents.SerializationInfoString)
            {
                throw new ArgumentOutOfRangeException("components", components, SR.GetString(SR.net_uri_NotJustSerialization));
            }

            if ((format & ~UriFormat.SafeUnescaped) != 0)
            {
                throw new ArgumentOutOfRangeException("format");
            }

            if (uri.UserDrivenParsing)
            {
                throw new InvalidOperationException(SR.GetString(SR.net_uri_UserDrivenParsing, this.GetType().FullName));
            }

            if (!uri.IsAbsoluteUri)
            {
                throw new InvalidOperationException(SR.GetString(SR.net_uri_NotAbsolute));
            }

            return(uri.GetComponentsHelper(components, format));
        }
Example #4
0
        //
        // This method is invoked to allow a custom parser to override the
        // internal parser when serving application with Uri component strings.
        // The output format depends on the "format" parameter
        //
        // Parameters:
        //  uriComponents   - Which components are to be retrieved.
        //  uriFormat       - The requested output format.
        //
        // This method returns:
        // The final result. The base implementation could be invoked to get a suggested value
        //
        protected virtual string GetComponents(Uri uri, UriComponents components, UriFormat format)
        {
            if (((components & UriComponents.SerializationInfoString) != 0) && components != UriComponents.SerializationInfoString)
                throw new ArgumentOutOfRangeException(nameof(components), components, SR.net_uri_NotJustSerialization);

            if ((format & ~UriFormat.SafeUnescaped) != 0)
                throw new ArgumentOutOfRangeException(nameof(format));

            if (uri.UserDrivenParsing)
                throw new InvalidOperationException(SR.Format(SR.net_uri_UserDrivenParsing, this.GetType().ToString()));

            if (!uri.IsAbsoluteUri)
                throw new InvalidOperationException(SR.net_uri_NotAbsolute);

            return uri.GetComponentsHelper(components, format);
        }
 protected virtual string GetComponents(Uri uri, UriComponents components, UriFormat format)
 {
     if (((components & UriComponents.SerializationInfoString) != 0) && (components != UriComponents.SerializationInfoString))
     {
         throw new ArgumentOutOfRangeException("UriComponents.SerializationInfoString");
     }
     if ((format & ~UriFormat.SafeUnescaped) != ((UriFormat) 0))
     {
         throw new ArgumentOutOfRangeException("format");
     }
     if (uri.UserDrivenParsing)
     {
         throw new InvalidOperationException(SR.GetString("net_uri_UserDrivenParsing", new object[] { base.GetType().FullName }));
     }
     if (!uri.IsAbsoluteUri)
     {
         throw new InvalidOperationException(SR.GetString("net_uri_NotAbsolute"));
     }
     return uri.GetComponentsHelper(components, format);
 }