当前位置: 首页>>代码示例>>C#>>正文


C# UriComponents类代码示例

本文整理汇总了C#中UriComponents的典型用法代码示例。如果您正苦于以下问题:C# UriComponents类的具体用法?C# UriComponents怎么用?C# UriComponents使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UriComponents类属于命名空间,在下文中一共展示了UriComponents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConstructorsShouldSetExpectedProperties

        public void ConstructorsShouldSetExpectedProperties( UriComponents components, UriFormat format, bool ignoreCase )
        {
            // arrange
            var target = new UriComparer( components, format, ignoreCase );

            // act
            
            // assert
            Assert.Equal( components, target.UriComponents );
            Assert.Equal( format, target.UriFormat );
            Assert.Equal( ignoreCase, target.IgnoreCase );
        }
开发者ID:WaffleSquirrel,项目名称:More,代码行数:12,代码来源:UriComparerTest.cs

示例2: GetUriComponents

        private static string GetUriComponents(Uri uri, UriComponents components)
        {
            if (uri != null && String.IsNullOrEmpty(uri.OriginalString))
            {
                return String.Empty;
            }

            if (uri != null && uri.OriginalString.StartsWith(PathSeparator, StringComparison.Ordinal))
            {
                components |= UriComponents.KeepDelimiter;
            }

            return MakeAbsolute(uri).GetComponents(components, UriFormat.SafeUnescaped);
        }
开发者ID:kvervo,项目名称:HorizontalLoopingSelector,代码行数:14,代码来源:UriParsingHelper.cs

示例3: GetUrlKeyString

		public static string GetUrlKeyString(this Uri uri, UriComponents uriSensitivity)
		{
			// Get complete url
			string completeUrl = uri.ToString().ToUpperInvariant();

			// Get sensitive part
			string sensitiveUrlPart = uri.GetComponents(uriSensitivity, UriFormat.Unescaped);

			if (sensitiveUrlPart.IsNullOrEmpty())
			{
				return completeUrl;
			}

			return completeUrl.Replace(sensitiveUrlPart.ToUpperInvariant(), sensitiveUrlPart);
		}
开发者ID:GBmono,项目名称:GBmonoV1.0,代码行数:15,代码来源:UriExtensions.cs

示例4: GetComponents

		// protected methods
		protected internal virtual string GetComponents (Uri uri, UriComponents components, UriFormat format)
		{
			if ((format < UriFormat.UriEscaped) || (format > UriFormat.SafeUnescaped))
				throw new ArgumentOutOfRangeException ("format");

			if ((components & UriComponents.SerializationInfoString) != 0) {
				if (components != UriComponents.SerializationInfoString)
					throw new ArgumentOutOfRangeException ("components", "UriComponents.SerializationInfoString must not be combined with other UriComponents.");

				if (!uri.IsAbsoluteUri)
					return UriHelper.FormatRelative (uri.OriginalString, "", format);

				components |= UriComponents.AbsoluteUri;
			}

			return GetComponentsHelper (uri, components, format);
		}
开发者ID:nlhepler,项目名称:mono,代码行数:18,代码来源:UriParser.cs

示例5: CheckIsReserved

 //
 // Check reserved chars according to RFC 3987 in a specific component
 //
 internal static bool CheckIsReserved(char ch, UriComponents component)
 {
     if ((component != UriComponents.Scheme) &&
             (component != UriComponents.UserInfo) &&
             (component != UriComponents.Host) &&
             (component != UriComponents.Port) &&
             (component != UriComponents.Path) &&
             (component != UriComponents.Query) &&
             (component != UriComponents.Fragment)
         )
     {
         return (component == (UriComponents)0) ? UriHelper.IsGenDelim(ch) : false;
     }
     else
     {
         switch (component)
         {
             // Reserved chars according to RFC 3987
             case UriComponents.UserInfo:
                 if (ch == '/' || ch == '?' || ch == '#' || ch == '[' || ch == ']' || ch == '@')
                     return true;
                 break;
             case UriComponents.Host:
                 if (ch == ':' || ch == '/' || ch == '?' || ch == '#' || ch == '[' || ch == ']' || ch == '@')
                     return true;
                 break;
             case UriComponents.Path:
                 if (ch == '/' || ch == '?' || ch == '#' || ch == '[' || ch == ']')
                     return true;
                 break;
             case UriComponents.Query:
                 if (ch == '#' || ch == '[' || ch == ']')
                     return true;
                 break;
             case UriComponents.Fragment:
                 if (ch == '#' || ch == '[' || ch == ']')
                     return true;
                 break;
             default:
                 break;
         }
         return false;
     }
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:47,代码来源:IriHelper.cs

示例6: UrlCfgDlg

        public UrlCfgDlg(bool jumpToChooser = false)
            : base("TXT_SPECIFYURL")
        {
            InitializeComponent();

            _jumpToChooser = jumpToChooser;
            if (jumpToChooser)
            {
                this.ShowChooserButton = true;
            }
            else
            {
                this.ShowChooserButton = false;
            }

            this.RequiredUriParts = UriComponents.HostAndPort;

            this.Load += new EventHandler(TcpIpCfgDlg_Load);
        }
开发者ID:rraguso,项目名称:protone-suite,代码行数:19,代码来源:UrlCfgDlg.cs

示例7: GetComponentsHelper

        internal string GetComponentsHelper(Uri uri, UriComponents components, UriFormat format)
        {
            UriElements elements = UriParseComponents.ParseComponents(uri.OriginalString.Trim(), UriKind.Absolute);

            string scheme = scheme_name;
            int dp = default_port;

            if ((scheme == null) || (scheme == "*"))
            {
                scheme = elements.scheme;
                dp = Uri.GetDefaultPort(scheme);
            }
            else if (String.Compare(scheme.ToLower(), elements.scheme.ToLower()) != 0)
            {
                throw new SystemException("URI Parser: scheme mismatch: " + scheme + " vs. " + elements.scheme);
            }

            var formatFlags = UriHelper.FormatFlags.None;
            if (UriHelper.HasCharactersToNormalize(uri.OriginalString))
                formatFlags |= UriHelper.FormatFlags.HasUriCharactersToNormalize;

            if (uri.UserEscaped)
                formatFlags |= UriHelper.FormatFlags.UserEscaped;

            if (!StringUtilities.IsNullOrEmpty(elements.host))
                formatFlags |= UriHelper.FormatFlags.HasHost;

            // it's easier to answer some case directly (as the output isn't identical
            // when mixed with others components, e.g. leading slash, # ...)
            switch (components)
            {
                case UriComponents.Scheme:
                    return scheme;
                case UriComponents.UserInfo:
                    return elements.user ?? "";
                case UriComponents.Host:
                    return elements.host;
                case UriComponents.Port:
                    {
                        int p = elements.port;
                        if (p >= 0 && p != dp)
                            return p.ToString();
                        return String.Empty;
                    }
                case UriComponents.Path:
                    var path = elements.path;
                    if (scheme != Uri.UriSchemeMailto && scheme != Uri.UriSchemeNews)
                        path = IgnoreFirstCharIf(elements.path, '/');
                    return UriHelper.FormatAbsolute(path, scheme, UriComponents.Path, format, formatFlags);
                case UriComponents.Query:
                    return UriHelper.FormatAbsolute(elements.query, scheme, UriComponents.Query, format, formatFlags);
                case UriComponents.Fragment:
                    return UriHelper.FormatAbsolute(elements.fragment, scheme, UriComponents.Fragment, format, formatFlags);
                case UriComponents.StrongPort:
                    {
                        return elements.port >= 0
                        ? elements.port.ToString()
                        : dp.ToString();
                    }
                case UriComponents.SerializationInfoString:
                    components = UriComponents.AbsoluteUri;
                    break;
            }

            // now we deal with multiple flags...

            StringBuilder sb = new StringBuilder();

            if ((components & UriComponents.Scheme) != 0)
            {
                sb.Append(scheme);
                sb.Append(elements.delimiter);
            }

            if ((components & UriComponents.UserInfo) != 0)
            {
                string userinfo = elements.user;
                if (userinfo != null)
                {
                    sb.Append(elements.user);
                    sb.Append('@');
                }
            }

            if ((components & UriComponents.Host) != 0)
                sb.Append(elements.host);

            // for StrongPort always show port - even if -1
            // otherwise only display if ut's not the default port
            if ((components & UriComponents.StrongPort) != 0)
            {
                sb.Append(":");
                if (elements.port >= 0)
                {
                    sb.Append(elements.port);
                }
                else
                {
                    sb.Append(dp);
                }
//.........这里部分代码省略.........
开发者ID:T-REX-XP,项目名称:serialwifi,代码行数:101,代码来源:UriParser.cs

示例8: GetComponents

		public string GetComponents (UriComponents components, UriFormat format)
		{
			return Parser.GetComponents (this, components, format);
		}
开发者ID:rmartinho,项目名称:mono,代码行数:4,代码来源:Uri.cs

示例9: EscapeUnescapeIri

        //
        // See above explanation
        //
        internal unsafe string EscapeUnescapeIri(char* pInput, int start, int end, UriComponents component)
        {

            char [] dest = new char[ end - start ];
            byte[] bytes = null;

            // Pin the array to do pointer accesses
            GCHandle destHandle = GCHandle.Alloc(dest, GCHandleType.Pinned);
            char* pDest = (char*)destHandle.AddrOfPinnedObject();

            int escapedReallocations = 0;
            const int bufferCapacityIncrease = 30;

            int next = start;
            int destOffset = 0;
            char ch;
            bool escape = false;
            bool surrogatePair = false;
            bool isUnicode = false;

            for (;next < end; ++next)
            {
                escape = false;
                surrogatePair = false;
                isUnicode = false;

                if ((ch = pInput[next]) == '%'){
                    if (next + 2 < end){
                        ch = UriHelper.EscapedAscii(pInput[next + 1], pInput[next + 2]);
                        // Do not unescape a reserved char
                        if (ch == c_DummyChar || ch == '%' || CheckIsReserved(ch, component) || UriHelper.IsNotSafeForUnescape(ch)){
                            // keep as is
                            pDest[destOffset++] = pInput[next++];
                            pDest[destOffset++] = pInput[next++];
                            pDest[destOffset++] = pInput[next];
                            continue;
                        }
                        else if (ch <= '\x7F'){
                            //ASCII
                            pDest[destOffset++] = ch;
                            next += 2;
                            continue;
                        }else{
                            // possibly utf8 encoded sequence of unicode

                            // check if safe to unescape according to Iri rules

                            int startSeq = next;
                            int byteCount = 1;
                            // lazy initialization of max size, will reuse the array for next sequences
                            if ((object)bytes == null)
                                bytes = new byte[end - next];

                            bytes[0] = (byte)ch;
                            next += 3;
                            while (next < end)
                            {
                                // Check on exit criterion
                                if ((ch = pInput[next]) != '%' || next + 2 >= end)
                                    break;

                                // already made sure we have 3 characters in str
                                ch = UriHelper.EscapedAscii(pInput[next + 1], pInput[next + 2]);

                                //invalid hex sequence ?
                                if (ch == c_DummyChar)
                                    break;
                                // character is not part of a UTF-8 sequence ?
                                else if (ch < '\x80')
                                    break;
                                else
                                {
                                    //a UTF-8 sequence
                                    bytes[byteCount++] = (byte)ch;
                                    next += 3;
                                }
                            }
                            next--; // for loop will increment

                            Encoding noFallbackCharUTF8 = (Encoding)Encoding.UTF8.Clone();
                            noFallbackCharUTF8.EncoderFallback = new EncoderReplacementFallback("");
                            noFallbackCharUTF8.DecoderFallback = new DecoderReplacementFallback("");

                            char[] unescapedChars = new char[bytes.Length];
                            int charCount = noFallbackCharUTF8.GetChars(bytes, 0, byteCount, unescapedChars, 0);

 
                            if (charCount != 0){
                                
                                // need to check for invalid utf sequences that may not have given any chars
                                
                                // check if unicode value is allowed
                                UriHelper.MatchUTF8Sequence(  pDest, dest, ref destOffset, unescapedChars, charCount, bytes, 
                                    byteCount, component == UriComponents.Query, true);
                            }
                            else
                            {
//.........这里部分代码省略.........
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:101,代码来源:UriExt.cs

示例10: Compare

        //
        //
        // This is for languages that do not support == != operators overloading
        //
        // Note that Uri.Equals will get an optimized path but is limited to true/fasle result only
        //
        public static int Compare(Uri uri1, Uri uri2, UriComponents partsToCompare, UriFormat compareFormat, 
            StringComparison comparisonType)
        {

            if ((object) uri1 == null)
            {
                if (uri2 == null)
                    return 0; // Equal
                return -1;    // null < non-null
            }
            if ((object) uri2 == null)
                return 1;     // non-null > null

            // a relative uri is always less than an absolute one
            if (!uri1.IsAbsoluteUri || !uri2.IsAbsoluteUri)
                return uri1.IsAbsoluteUri? 1: uri2.IsAbsoluteUri? -1: string.Compare(uri1.OriginalString, 
                    uri2.OriginalString, comparisonType);

            return string.Compare(
                                    uri1.GetParts(partsToCompare, compareFormat),
                                    uri2.GetParts(partsToCompare, compareFormat),
                                    comparisonType
                                  );
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:30,代码来源:UriExt.cs

示例11: GetComponentsHelper

        //
        // UriParser helpers methods
        //
        internal string GetComponentsHelper(UriComponents uriComponents, UriFormat uriFormat)
        {
            if (uriComponents == UriComponents.Scheme)
                return m_Syntax.SchemeName;

            // A serialzation info is "almost" the same as AbsoluteUri except for IPv6 + ScopeID hostname case
            if ((uriComponents & UriComponents.SerializationInfoString) != 0)
                uriComponents |= UriComponents.AbsoluteUri;

            //This will get all the offsets, HostString will be created below if needed
            EnsureParseRemaining();

            if ((uriComponents & UriComponents.NormalizedHost) != 0)
            {
                // Down the path we rely on Host to be ON for NormalizedHost
                uriComponents |= UriComponents.Host;
            }

            //Check to see if we need the host/authotity string
            if ((uriComponents & UriComponents.Host) != 0)
                EnsureHostString(true);

            //This, single Port request is always processed here
            if (uriComponents == UriComponents.Port || uriComponents == UriComponents.StrongPort)
            {
                if (((m_Flags & Flags.NotDefaultPort) != 0) || (uriComponents == UriComponents.StrongPort 
                    && m_Syntax.DefaultPort != UriParser.NoDefaultPort))
                {
                    // recreate string from the port value
                    return m_Info.Offset.PortValue.ToString(CultureInfo.InvariantCulture);
                }
                return string.Empty;
            }

            if ((uriComponents & UriComponents.StrongPort) != 0)
            {
                // Down the path we rely on Port to be ON for StrongPort
                uriComponents |= UriComponents.Port;
            }

            //This request sometime is faster to process here
            if (uriComponents == UriComponents.Host && (uriFormat == UriFormat.UriEscaped 
                || (( m_Flags & (Flags.HostNotCanonical | Flags.E_HostNotCanonical)) == 0)))
            {
                EnsureHostString(false);
                return m_Info.Host;
            }

            switch (uriFormat)
            {
                case UriFormat.UriEscaped:
                    return GetEscapedParts(uriComponents);

                case V1ToStringUnescape:
                case UriFormat.SafeUnescaped:
                case UriFormat.Unescaped:
                    return GetUnescapedParts(uriComponents, uriFormat);

                default:
                    throw new ArgumentOutOfRangeException("uriFormat");
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:65,代码来源:UriExt.cs

示例12: GetComponents

        //
        // 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);
        }
开发者ID:Corillian,项目名称:corefx,代码行数:28,代码来源:UriScheme.cs

示例13: Compare

 public static int Compare(Uri uri1, Uri uri2, UriComponents partsToCompare, UriFormat compareFormat, StringComparison comparisonType)
 {
     if (uri1 == null)
     {
         if (uri2 == null)
         {
             return 0;
         }
         return -1;
     }
     if (uri2 == null)
     {
         return 1;
     }
     if (uri1.IsAbsoluteUri && uri2.IsAbsoluteUri)
     {
         return string.Compare(uri1.GetParts(partsToCompare, compareFormat), uri2.GetParts(partsToCompare, compareFormat), comparisonType);
     }
     if (uri1.IsAbsoluteUri)
     {
         return 1;
     }
     if (!uri2.IsAbsoluteUri)
     {
         return string.Compare(uri1.OriginalString, uri2.OriginalString, comparisonType);
     }
     return -1;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:Uri.cs

示例14: EscapeUnescapeTestComponent

        private string EscapeUnescapeTestComponent(string uriInput, UriComponents component)
        {
            string ret = null;
            string uriString = null;

            switch (component)
            {
                case UriComponents.Fragment:
                    uriString = String.Format(
                        "http://[email protected]:80/path/resource.ext?query=qvalue#{0}",
                        uriInput);
                    break;
                case UriComponents.Host:
                    uriString = String.Format(
                        "http://[email protected]{0}:80/path/resource.ext?query=qvalue#fragment",
                        uriInput);
                    break;
                case UriComponents.Path:
                    uriString = String.Format(
                        "http://[email protected]:80/{0}/{0}/resource.ext?query=qvalue#fragment",
                        uriInput);
                    break;
                case UriComponents.Port:
                    uriString = String.Format(
                        "http://[email protected]:{0}/path/resource.ext?query=qvalue#fragment",
                        uriInput);
                    break;
                case UriComponents.Query:
                    uriString = String.Format(
                        "http://[email protected]:80/path/resource.ext?query{0}=qvalue{0}#fragment",
                        uriInput);
                    break;
                case UriComponents.Scheme:
                    uriString = String.Format(
                        "{0}://[email protected]:80/path/resource.ext?query=qvalue#fragment",
                        uriInput);
                    break;
                case UriComponents.UserInfo:
                    uriString = String.Format(
                        "http://{0}@server:80/path/resource.ext?query=qvalue#fragment",
                        uriInput);
                    break;
                default:
                    Assert.False(true, "Unknown Uri component: " + component.ToString());
                    break;
            }

            try
            {
                Uri u = new Uri(uriString);
                ret = u.AbsoluteUri;
            }
            catch (ArgumentNullException)
            {
                ret = "";
            }
            catch (FormatException)
            {
                ret = "";
            }

            return ret;
        }
开发者ID:Corillian,项目名称:corefx,代码行数:63,代码来源:IriTest.cs

示例15: ReCreateParts

        private string ReCreateParts(UriComponents parts, ushort nonCanonical, UriFormat formatAs)
        {
            ushort num3;
            this.EnsureHostString(false);
            string input = ((parts & UriComponents.Host) == 0) ? string.Empty : this.m_Info.Host;
            int destinationIndex = (this.m_Info.Offset.End - this.m_Info.Offset.User) * ((formatAs == UriFormat.UriEscaped) ? 12 : 1);
            char[] destination = new char[(((input.Length + destinationIndex) + this.m_Syntax.SchemeName.Length) + 3) + 1];
            destinationIndex = 0;
            if ((parts & UriComponents.Scheme) != 0)
            {
                this.m_Syntax.SchemeName.CopyTo(0, destination, destinationIndex, this.m_Syntax.SchemeName.Length);
                destinationIndex += this.m_Syntax.SchemeName.Length;
                if (parts != UriComponents.Scheme)
                {
                    destination[destinationIndex++] = ':';
                    if (this.InFact(Flags.AuthorityFound))
                    {
                        destination[destinationIndex++] = '/';
                        destination[destinationIndex++] = '/';
                    }
                }
            }
            if (((parts & UriComponents.UserInfo) != 0) && this.InFact(Flags.HasUserInfo))
            {
                if ((nonCanonical & 2) == 0)
                {
                    UnescapeString(this.m_String, this.m_Info.Offset.User, this.m_Info.Offset.Host, destination, ref destinationIndex, 0xffff, 0xffff, 0xffff, UnescapeMode.CopyOnly, this.m_Syntax, false, false);
                }
                else
                {
                    switch (formatAs)
                    {
                        case UriFormat.UriEscaped:
                            if (!this.NotAny(Flags.HostNotParsed | Flags.UserEscaped))
                            {
                                this.InFact(Flags.E_UserNotCanonical);
                                this.m_String.CopyTo(this.m_Info.Offset.User, destination, destinationIndex, this.m_Info.Offset.Host - this.m_Info.Offset.User);
                                destinationIndex += this.m_Info.Offset.Host - this.m_Info.Offset.User;
                                break;
                            }
                            destination = EscapeString(this.m_String, this.m_Info.Offset.User, this.m_Info.Offset.Host, destination, ref destinationIndex, true, '?', '#', '%');
                            break;

                        case UriFormat.Unescaped:
                            destination = UnescapeString(this.m_String, this.m_Info.Offset.User, this.m_Info.Offset.Host, destination, ref destinationIndex, 0xffff, 0xffff, 0xffff, UnescapeMode.UnescapeAll | UnescapeMode.Unescape, this.m_Syntax, false, false);
                            break;

                        case UriFormat.SafeUnescaped:
                            destination = UnescapeString(this.m_String, this.m_Info.Offset.User, this.m_Info.Offset.Host - 1, destination, ref destinationIndex, '@', '/', '\\', this.InFact(Flags.HostNotParsed | Flags.UserEscaped) ? UnescapeMode.Unescape : UnescapeMode.EscapeUnescape, this.m_Syntax, false, false);
                            destination[destinationIndex++] = '@';
                            break;

                        default:
                            destination = UnescapeString(this.m_String, this.m_Info.Offset.User, this.m_Info.Offset.Host, destination, ref destinationIndex, 0xffff, 0xffff, 0xffff, UnescapeMode.CopyOnly, this.m_Syntax, false, false);
                            break;
                    }
                }
                if (parts == UriComponents.UserInfo)
                {
                    destinationIndex--;
                }
            }
            if (((parts & UriComponents.Host) != 0) && (input.Length != 0))
            {
                UnescapeMode copyOnly;
                if (((formatAs != UriFormat.UriEscaped) && (this.HostType == Flags.BasicHostType)) && ((nonCanonical & 4) != 0))
                {
                    copyOnly = (formatAs == UriFormat.Unescaped) ? (UnescapeMode.UnescapeAll | UnescapeMode.Unescape) : (this.InFact(Flags.HostNotParsed | Flags.UserEscaped) ? UnescapeMode.Unescape : UnescapeMode.EscapeUnescape);
                }
                else
                {
                    copyOnly = UnescapeMode.CopyOnly;
                }
                destination = UnescapeString(input, 0, input.Length, destination, ref destinationIndex, '/', '?', '#', copyOnly, this.m_Syntax, false, false);
                if ((((parts & UriComponents.SerializationInfoString) != 0) && (this.HostType == (Flags.HostNotParsed | Flags.IPv6HostType))) && (this.m_Info.ScopeId != null))
                {
                    this.m_Info.ScopeId.CopyTo(0, destination, destinationIndex - 1, this.m_Info.ScopeId.Length);
                    destinationIndex += this.m_Info.ScopeId.Length;
                    destination[destinationIndex - 1] = ']';
                }
            }
            if ((parts & UriComponents.Port) != 0)
            {
                if ((nonCanonical & 8) == 0)
                {
                    if (this.InFact(Flags.HostNotParsed | Flags.NotDefaultPort))
                    {
                        ushort path = this.m_Info.Offset.Path;
                        while (this.m_String[path = (ushort) (path - 1)] != ':')
                        {
                        }
                        this.m_String.CopyTo(path, destination, destinationIndex, this.m_Info.Offset.Path - path);
                        destinationIndex += this.m_Info.Offset.Path - path;
                    }
                    else if (((parts & UriComponents.StrongPort) != 0) && (this.m_Syntax.DefaultPort != -1))
                    {
                        destination[destinationIndex++] = ':';
                        input = this.m_Info.Offset.PortValue.ToString(CultureInfo.InvariantCulture);
                        input.CopyTo(0, destination, destinationIndex, input.Length);
                        destinationIndex += input.Length;
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:Uri.cs


注:本文中的UriComponents类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。