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; } }
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); }
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; }
public Pinned(RouteBuilder builder) { this.builder = builder; }