private TreeViewClass CreateNodeLoop(String selectedDirectory,int n) { TreeViewClass Node = new TreeViewClass(selectedDirectory); String[] subDirs = System.IO.Directory.GetDirectories(selectedDirectory,"*"); foreach (String s in subDirs) { TreeViewClass addNode = new TreeViewClass(s); String[] subDirectorys2 = System.IO.Directory.GetDirectories(s,"*"); foreach(String s2 in subDirectorys2) { addNode.AddChild(new TreeViewClass(s2)); } Node.AddChild(addNode); } return Node; }
/***************************************************************************************************************************** * 再帰を用いたNode作成 * 必要なし。でもたまに使うから取っておく * ***************************************************************************************************************************/ private TreeViewClass CreateNode(String selectedDirectory, int n) { TreeViewClass Node = new TreeViewClass(selectedDirectory); String[] subDirectorys = System.IO.Directory.GetDirectories(selectedDirectory, "*"); if (n > 5) { return Node; } foreach (String s in subDirectorys) { Node.AddChild(CreateNode(s, n + 1)); } return Node; }
public void AddChild(TreeViewClass child) { children_.Add(child); }