System.Uri.GetEscapedParts C# (CSharp) Method

GetEscapedParts() private method

private GetEscapedParts ( UriComponents uriParts ) : string
uriParts UriComponents
return string
        private string GetEscapedParts(UriComponents uriParts)
        {
            // Which Uri parts are not escaped canonically ?
            // Notice that public UriPart and private Flags must me in Sync so below code can work
            //
            ushort nonCanonical = (ushort)(((ushort)_flags & ((ushort)Flags.CannotDisplayCanonical << 7)) >> 6);
            if (InFact(Flags.SchemeNotCanonical))
            {
                nonCanonical |= (ushort)Flags.SchemeNotCanonical;
            }

            // We keep separate flags for some of path canonicalization facts
            if ((uriParts & UriComponents.Path) != 0)
            {
                if (InFact(Flags.ShouldBeCompressed | Flags.FirstSlashAbsent | Flags.BackslashInPath))
                {
                    nonCanonical |= (ushort)Flags.PathNotCanonical;
                }
                else if (IsDosPath && _string[_info.Offset.Path + SecuredPathIndex - 1] == '|')
                {
                    // A rare case of c|\
                    nonCanonical |= (ushort)Flags.PathNotCanonical;
                }
            }

            if (((ushort)uriParts & nonCanonical) == 0)
            {
                string ret = GetUriPartsFromUserString(uriParts);
                if ((object)ret != null)
                {
                    return ret;
                }
            }

            return ReCreateParts(uriParts, nonCanonical, UriFormat.UriEscaped);
        }