Esempio n. 1
0
 void ClearSegment()
 {
     type           = UriSegmentType.None;
     segment        = string.Empty;
     segmentStartAt = 0;
     segmentLength  = 0;
 }
Esempio n. 2
0
 private void ClearSegment()
 {
     _type           = UriSegmentType.None;
     _segment        = string.Empty;
     _segmentStartAt = 0;
     _segmentLength  = 0;
 }
 private void ClearSegment()
 {
     this.type           = UriSegmentType <TItem> .None;
     this.segment        = string.Empty;
     this.segmentStartAt = 0;
     this.segmentLength  = 0;
 }
 internal UriSegmentEnum(Uri uri)
 {
     this.uri            = uri;
     this.type           = UriSegmentType <TItem> .Unknown;
     this.segment        = null;
     this.segmentStartAt = 0;
     this.segmentLength  = 0;
 }
Esempio n. 5
0
 internal UriSegmentEnum(Uri uri)
 {
     Fx.Assert(null != uri, "UreSegmentEnum: null uri");
     this.uri       = uri;
     type           = UriSegmentType.Unknown;
     segment        = null;
     segmentStartAt = 0;
     segmentLength  = 0;
 }
Esempio n. 6
0
                public bool Next()
                {
                    while (true)
                    {
                        switch (type)
                        {
                        case UriSegmentType.Unknown:
                            type = UriSegmentType.Scheme;
                            SetSegment(uri.Scheme);
                            return(true);

                        case UriSegmentType.Scheme:
                            type = UriSegmentType.Host;
                            string host = uri.Host;
                            // The userName+password also accompany...
                            string userInfo = uri.UserInfo;
                            if (null != userInfo && userInfo.Length > 0)
                            {
                                host = userInfo + '@' + host;
                            }
                            SetSegment(host);
                            return(true);

                        case UriSegmentType.Host:
                            type = UriSegmentType.Port;
                            int port = uri.Port;
                            SetSegment(port.ToString(CultureInfo.InvariantCulture));
                            return(true);

                        case UriSegmentType.Port:
                            type = UriSegmentType.Path;
                            string absPath = uri.AbsolutePath;
                            Fx.Assert(null != absPath, "Next: nill absPath");
                            if (0 == absPath.Length)
                            {
                                ClearSegment();
                                return(false);
                            }
                            segment        = absPath;
                            segmentStartAt = 0;
                            segmentLength  = 0;
                            return(NextPathSegment());

                        case UriSegmentType.Path:
                            return(NextPathSegment());

                        case UriSegmentType.None:
                            return(false);

                        default:
                            Fx.Assert("Next: unknown enum value");
                            return(false);
                        }
                    }
                }
                public bool Next()
                {
                    switch (this.type)
                    {
                    case UriSegmentType <TItem> .Unknown:
                        this.type = UriSegmentType <TItem> .Scheme;
                        this.SetSegment(this.uri.Scheme);
                        return(true);

                    case UriSegmentType <TItem> .Scheme:
                    {
                        this.type = UriSegmentType <TItem> .Host;
                        string host     = this.uri.Host;
                        string userInfo = this.uri.UserInfo;
                        if ((userInfo != null) && (userInfo.Length > 0))
                        {
                            host = userInfo + '@' + host;
                        }
                        this.SetSegment(host);
                        return(true);
                    }

                    case UriSegmentType <TItem> .Host:
                        this.type = UriSegmentType <TItem> .Port;
                        this.SetSegment(this.uri.Port.ToString(CultureInfo.InvariantCulture));
                        return(true);

                    case UriSegmentType <TItem> .Port:
                    {
                        this.type = UriSegmentType <TItem> .Path;
                        string absolutePath = this.uri.AbsolutePath;
                        if (absolutePath.Length != 0)
                        {
                            this.segment        = absolutePath;
                            this.segmentStartAt = 0;
                            this.segmentLength  = 0;
                            return(this.NextPathSegment());
                        }
                        this.ClearSegment();
                        return(false);
                    }

                    case UriSegmentType <TItem> .Path:
                        return(this.NextPathSegment());

                    case UriSegmentType <TItem> .None:
                        return(false);
                    }
                    return(false);
                }