Beispiel #1
0
        public void RefreshBrowserWithPhysFS()
        {
            if (Client != null)
            {
                string rootPath = "/";

                var rootProgress = new DirectoryTreeProgress("/", rootPath, Client.GetResources(rootPath));

                Stack <DirectoryTreeProgress> stack = new Stack <DirectoryTreeProgress>();
                stack.Push(rootProgress);

                while (stack.Count > 0)
                {
                    var progress = stack.Pop();

                    for (; progress.i < progress.resources.Count; ++progress.i)
                    {
                        if (progress.resources[progress.i].Directory)
                        {
                            string path = progress.resources[progress.i].Path;

                            string title;
                            title = GetLastPathElement(path);

                            var childProgress = new DirectoryTreeProgress(title, path, Client.GetResources(path));
                            progress.node.Nodes.Add(childProgress.node);

                            ++progress.i;
                            stack.Push(progress);

                            progress = childProgress;
                        }
                    }
                }

                directoryTreeView.Invoke(BeginUpdateDirectoryTree);
                directoryTreeView.Invoke(ClearDirectoryTree);
                directoryTreeView.Invoke(AddToDirectoryTree, rootProgress.node);
                directoryTreeView.Invoke(RedrawDirectoryTree);
                directoryTreeView.Invoke(EndUpdateDirectoryTree);
            }
        }
Beispiel #2
0
        public void RefreshBrowserWithPhysFS()
        {
            if (Client != null)
            {
                string rootPath = "/";

                var rootProgress = new DirectoryTreeProgress("/", rootPath, Client.GetResources(rootPath));

                Stack<DirectoryTreeProgress> stack = new Stack<DirectoryTreeProgress>();
                stack.Push(rootProgress);

                while (stack.Count > 0)
                {
                    var progress = stack.Pop();

                    for (; progress.i < progress.resources.Count; ++progress.i)
                    {
                        if (progress.resources[progress.i].Directory)
                        {
                            string path = progress.resources[progress.i].Path;

                            string title;
                            title = GetLastPathElement(path);

                            var childProgress = new DirectoryTreeProgress(title, path, Client.GetResources(path));
                            progress.node.Nodes.Add(childProgress.node);

                            ++progress.i;
                            stack.Push(progress);

                            progress = childProgress;
                        }
                    }
                }

                directoryTreeView.Invoke(BeginUpdateDirectoryTree);
                directoryTreeView.Invoke(ClearDirectoryTree);
                directoryTreeView.Invoke(AddToDirectoryTree, rootProgress.node);
                directoryTreeView.Invoke(RedrawDirectoryTree);
                directoryTreeView.Invoke(EndUpdateDirectoryTree);
            }
        }