public static NodeFoldersFile LoadTreeFiles(string path) { NodeFoldersFile root = new NodeFoldersFile(path); AddFilesToNode(root); return(root); }
static void AddFilesToNode(NodeFoldersFile root) { if (!root.isFolder) { return; } string[] filleList = System.IO.Directory.GetFiles(root.Name); foreach (string file in filleList) { root.Child.Add(new NodeFoldersFile(file, root, false)); } string[] dir = System.IO.Directory.GetDirectories(root.Name); foreach (string p in dir) { NodeFoldersFile dirNode = new NodeFoldersFile(p, root); AddFilesToNode(dirNode); } }
public NodeFoldersFile(string name, NodeFoldersFile prn = null, bool isFld = true) { Name = name; isFolder = isFld; parent = prn; }