Beispiel #1
0
 private bool CalculateRoute(RoutePath path, string httpMethod, RouteBuilder route, RouteNode node)
 {
     using (path.Pin())
     using (var pin = route.Pin())
     {
         if (node.Part.AcceptPath(path, httpMethod))
         {
             route.Add(node.Part);
             
             if (node.Children.Any())
             {
                 foreach (var child in node.Children)
                 {
                     if (CalculateRoute(path, httpMethod, route, child))
                     {
                         pin.Accept();
                         return true;
                     }
                 }                    
             }
             else if (!path.Any())
             {
                 pin.Accept();
                 return true;
             }
         }
         return false;
     }
 }
Beispiel #2
0
        private IRoutePart[] CalculateRoute(string path, string httpMethod)
        {
            var routePath = new RoutePath(path);
            var route     = new RouteBuilder();

            foreach (var node in RootPaths)
            {
                if (CalculateRoute(routePath, httpMethod, route, node))
                {
                    return(route.ToArray());
                }
            }

            return(null);
        }
Beispiel #3
0
        private IRoutePart[] CalculateRoute(string path, string httpMethod)
        {
            var routePath = new RoutePath(path);
            var route = new RouteBuilder();
            
            foreach (var node in RootPaths)
            {
                if (CalculateRoute(routePath, httpMethod, route, node))
                {
                    return route.ToArray();
                }
            }

            return null;
        }
Beispiel #4
0
 public Pinned(RouteBuilder builder)
 {
     this.builder = builder;
 }
Beispiel #5
0
 public Pinned(RouteBuilder builder)
 {
     this.builder = builder;
 }