/// <summary> Get the endpoint configuration, based on the requested path </summary>
/// <param name="Paths"> Requested URL paths </param>
/// <returns> Matched endpoint configuration, otherwise NULL </returns>
public Engine_Path_Endpoint Get_Endpoint(List <string> Paths)
{
// Ensure the dictionary is built
ensure_dictionary_built();
// Find a match by path
if (rootPathsDictionary.ContainsKey(Paths[0]))
{
Engine_Path_Endpoint path = rootPathsDictionary[Paths[0]];
Paths.RemoveAt(0);
do
{
// Did we find an endpoint?
if (path.IsEndpoint)
{
return(path);
}
// Look to the next part of the path
if (Paths.Count > 0)
{
if (!path.ContainsChildKey(Paths[0]))
{
return(null);
}
path = path.GetChild(Paths[0]);
Paths.RemoveAt(0);
}
else
{
return(null);
}
} while (true);
}
return(null);
}