Esempio n. 1
0
        internal bool RemoveServiceFromRoute(string[] route, Service service)
        {
            ChildrenContainer container = System.Threading.Volatile.Read(ref _children);

            if (route.Length == 0)
            {
                return(Services.RemoveService(service));
            }

            Node child;

            if (container.TryGetValue(route, out child))
            {
                return(child.RemoveServiceFromRoute(route.Skip(container.KeyLength).ToArray(), service));
            }
            return(false);
        }
Esempio n. 2
0
        public Service GetService(string[] route, out string matchedPath)
        {
            ChildrenContainer container = System.Threading.Volatile.Read(ref _children);

            if (route.Length == 0)
            {
                matchedPath = Path;
                return(Services.GetService());
            }

            Node child;

            if (container.TryGetValue(route, out child))
            {
                var returnService = child.GetService(route.Skip(container.KeyLength).ToArray(), out matchedPath);
                if (returnService != null)
                {
                    return(returnService);
                }
            }
            matchedPath = Path;
            return(Services.GetService());
        }