public void DirectoryFound(DirectoryInfo item) { TreeNode[] foundnodes = trvDirectories.Nodes.Find(item.Parent.FullName, true); SizeGetter sg = new SizeGetter(); if (foundnodes.Length == 1) { foundnodes[0].Nodes.Add(item.FullName, item.Name + " (" + (int)sg.GetDirectorySize(item.FullName) / 1000 + "K)"); } else { trvDirectories.Nodes.Add(item.FullName, item.Name + " (" + (int)sg.GetDirectorySize(item.FullName) / 1000 + "K)"); } }
private void btnSearch_Click_1(object sender, EventArgs e) { DirectoryInfo d = new DirectoryInfo(txtDirectory.Text); SizeGetter sg1 = new SizeGetter(); TreeNode t = trvDirectories.Nodes.Add(d.FullName, d.Name + " (" + (int)sg1.GetDirectorySize(d.FullName) / 1000 + "K)"); Digger digger = new Digger(); digger.Dig(d, this); }
public void DirectoryFound(DirectoryInfo item) { int spaces; if (spacers.ContainsKey(item.Parent.FullName)) { spaces = spacers[item.Parent.FullName]; } else { spaces = 0; } SizeGetter sg = new SizeGetter(); Console.WriteLine((new String(' ', (spaces + 1) * 2)) + item.Name + " (" + (int)sg.GetDirectorySize(item.FullName) / 1000 + "K)"); if (!spacers.ContainsKey(item.FullName)) { spacers.Add(item.FullName, spaces + 1); } }