Exemplo n.º 1
0
        public void Test()
        {
            ZKTree tree = new ZKTree();

            GetZKTree(tree);

            Debug.WriteLine(ConvertJsonString(tree));
        }
Exemplo n.º 2
0
        public void GetZKTree(ZKTree tree)
        {
            IEnumerable <string> names = zookeeper.GetChildren(tree.Path == null?"/": tree.Path, false);

            if (names != null)
            {
                tree.Children = new List <ZKTree>();
                foreach (var name in names)
                {
                    ZKTree child = new ZKTree();
                    child.Name = name;
                    child.Path = tree.Path + "/" + name;
                    child.Data = zookeeper.GetData(child.Path, false, null);
                    tree.Children.Add(child);
                    GetZKTree(child);
                }
            }
            else
            {
                return;
            }
        }