StonehearthEditor.ModuleDataManager.AppendTreeNodes C# (CSharp) Method

AppendTreeNodes() private method

private AppendTreeNodes ( TreeNode root, string rootPath ) : void
root System.Windows.Forms.TreeNode
rootPath string
return void
        private void AppendTreeNodes(TreeNode root, string rootPath)
        {
            string[] filePaths = Directory.GetFiles(rootPath);
            string[] folderPaths = Directory.GetDirectories(rootPath);

            foreach (string filePath in filePaths)
            {
                if (root.Tag == null)
                {
                    root.Tag = JsonHelper.NormalizeSystemPath(filePath);
                }
                TreeNode node = new TreeNode(System.IO.Path.GetFileName(filePath));
                node.Tag = JsonHelper.NormalizeSystemPath(filePath);
                root.Nodes.Add(node);
            }

            foreach (string folderPath in folderPaths)
            {
                TreeNode subRoot = new TreeNode(System.IO.Path.GetFileName(folderPath));
                subRoot.Tag = JsonHelper.NormalizeSystemPath(folderPath);
                AppendTreeNodes(subRoot, folderPath);
                root.Nodes.Add(subRoot);
            }
        }