예제 #1
0
        public WebIndexItem GetByPath(WebIndexItem item, string[] path)
        {
            if (path.Count() == 0)
            {
                return(item);
            }
            var fr = item.Childs.First(z => z.Name == path[0]);

            return(GetByPath(fr, path.Skip(1).ToArray()));
        }
예제 #2
0
        public void CreatePath(WebIndexItem item, string[] path)
        {
            if (path.Count() == 0)
            {
                return;
            }
            if (!item.Childs.Any(z => z.Name == path[0]))
            {
                item.Childs.Add(new WebIndexItem()
                {
                    Parent = item, Name = path[0]
                });
            }
            var fr = item.Childs.First(z => z.Name == path[0]);

            CreatePath(fr, path.Skip(1).ToArray());
        }