Exemple #1
0
        public void Init()
        {
            string parent = @"(\{[A-Za-z0-9]+\})";
            int    index  = 0;

            if (UrlIgnoreCase)
            {
                Url     = Url.ToLower();
                Rewrite = Rewrite.ToLower();
            }
            for (int i = 0; i < Url.Length; i++)
            {
                if (Url[i] == '/')
                {
                    index = i;
                }
                else if (Url[i] == '{')
                {
                    break;
                }
            }
            Path          = Url.Substring(0, index + 1);
            Valid         = Regex.IsMatch(Url, parent);
            ID            = Path.GetHashCode();
            ReExt         = HttpParse.GetBaseUrlExt(Rewrite);
            TemplateMatch = new RouteTemplateMatch(Url, Path.Length);
        }
Exemple #2
0
        public void Init()
        {
            string parent = @"(\{[A-Za-z0-9]+\})";
            int    index  = 0;

            if (UrlIgnoreCase)
            {
                Url = Url.ToLower();
                if (!string.IsNullOrEmpty(Rewrite))
                {
                    Rewrite = Rewrite.ToLower();
                }
            }
            for (int i = 0; i < Url.Length; i++)
            {
                if (Url[i] == '/')
                {
                    index = i;
                }
                else if (Url[i] == '{')
                {
                    break;
                }
            }
            Path          = Url.Substring(0, index + 1);
            Valid         = Regex.IsMatch(Url, parent);
            ID            = GetPathID(Path);
            TemplateMatch = new RouteTemplateMatch(Url, Path.Length);
            if (!string.IsNullOrEmpty(Rewrite))
            {
                ReExt = HttpParse.GetBaseUrlExt(Rewrite);
                HasRewriteParamters = Rewrite.IndexOf("{") >= 0;
            }
        }
Exemple #3
0
        public void Init()
        {
            string parent = @"(\{[A-Za-z0-9]+\})";
            int    index  = 0;

            if (UrlIgnoreCase)
            {
                Url = Url.ToLower();
                if (!string.IsNullOrEmpty(Rewrite))
                {
                    Rewrite = Rewrite.ToLower();
                }
            }
            for (int i = 0; i < Url.Length; i++)
            {
                if (Url[i] == '/')
                {
                    index = i;
                    PathLevel++;
                }
                else if (Url[i] == '?')
                {
                    HasQueryString = true;
                    break;
                }
            }

            if (!string.IsNullOrEmpty(Host))
            {
                this.Prefix = new UrlPrefix(Host);
            }
            // if (this.Prefix == null)
            Path = $"{Url.Substring(0, index + 1)}";
            ID   = $"{Host}{Path}";
            //else
            //    Path = $"{this.Prefix.Value}{Url.Substring(0, index + 1)}";
            Valid = Regex.IsMatch(Url, parent);
            //TemplateMatch = new RouteTemplateMatch(Url, Path.Length);
            TemplateMatch = new RouteTemplateMatch(Url, 0);
            if (!string.IsNullOrEmpty(Rewrite))
            {
                ReExt = HttpParse.GetBaseUrlExt(Rewrite);
                HasRewriteParamters = Rewrite.IndexOf("{") >= 0;
            }
        }