SobekCM.Core.Configuration.Engine.Engine_Path_Endpoint.ContainsChildKey C# (CSharp) Method

ContainsChildKey() public method

public ContainsChildKey ( string ChildSegment ) : bool
ChildSegment string
return bool
        public bool ContainsChildKey(string ChildSegment)
        {
            // Ensure the dictionary is built correctly
            ensure_dictionary_built();

            // check dictionary for key
            return childDictionary.ContainsKey(ChildSegment);
        }

Usage Example

Esempio n. 1
0
        /// <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);
        }
All Usage Examples Of SobekCM.Core.Configuration.Engine.Engine_Path_Endpoint::ContainsChildKey