Skip to content

Commit

Permalink
fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snixtho committed Nov 13, 2023
1 parent ee9feb8 commit f5a9109
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/EvoSC.Manialinks/ManialinkActionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ public void RemoveRoute(string route)
}

var currentComponent = nextComponents.First();
var nextComponent = nextComponents.Skip(1).First();
var pathNode = new MlRouteNode(currentComponent)
{
Children = new Dictionary<string, IMlRouteNode>(),
Expand All @@ -360,7 +361,7 @@ public void RemoveRoute(string route)

foreach (var child in currentNode.Children.Values)
{
if (!child.IsParameter && !child.Name.Equals(currentComponent, StringComparison.Ordinal))
if (!child.IsParameter && !child.Name.Equals(nextComponent, StringComparison.Ordinal))
{
continue;
}
Expand Down Expand Up @@ -392,26 +393,14 @@ public void RemoveRoute(string route)
{
foreach (var rootComponent in _rootNode.Children.Values)
{
foreach (var child in rootComponent.Children.Values)
{
var (manialinkAction, path) = FindActionInternal(routeComponents[1..], routeComponents[0], child);

if (manialinkAction == null || path == null)
{
// action not found, try next root node
continue;
}

var pathNode = new MlRouteNode(routeComponents[0])
{
Children = new Dictionary<string, IMlRouteNode>(),
IsParameter = path.IsParameter
};

pathNode.Children.Add(path.Name, path);
var (manialinkAction, path) = FindActionInternal(routeComponents, null, rootComponent);

return (manialinkAction, pathNode);
if (manialinkAction == null || path == null)
{
continue;
}

return (manialinkAction, path);
}
}

Expand Down

0 comments on commit f5a9109

Please sign in to comment.