public EntryNode Traverse() { EntryNode ns = null; DirectoryInfo dir = new DirectoryInfo(root.getname()); ns = WalkDirectoryTree(dir); return(ns); }
static void Main(string[] args) { #if false DirectoryInfo2 dn = new DirectoryInfo2("D:\\PRASEEDPAI\\BOOKS\\advaita"); EntryNode en = dn.Traverse(); DumpDirectory((DirectoryNode)en); Console.WriteLine(); #endif Extensions.GetAllFiles("D:\\PRASEEDPAI\\BOOKS\\advaita").FlattenPath().PrintAll(); Console.ReadLine(); }
public static void DumpDirectory(DirectoryNode ds) { Console.WriteLine("Directory ->" + ds.getname()); List <EntryNode> list = ds.GetAllFiles(); IEnumerator <EntryNode> itr = list.GetEnumerator(); while (itr.MoveNext()) { EntryNode nt = (EntryNode)itr.Current; if (nt.Isdir()) { DumpDirectory((DirectoryNode)nt); } else { Console.WriteLine(" File -> " + ((FileNode)nt).getname() + "Size ->" + ((FileNode)nt).getSize()); } } }
public void Visit(DirectoryNode dn) { Console.WriteLine("Directory -> " + dn.getname()); //Traversing list through Iterator List <EntryNode> list = dn.GetAllFiles(); IEnumerator <EntryNode> itr = list.GetEnumerator(); while (itr.MoveNext()) { EntryNode nt = (EntryNode)itr.Current; if (nt.Isdir()) { Visit((DirectoryNode)nt); } else { ((FileNode)nt).Accept(this); } } }
public void Visit(DirectoryNode dn) { // System.out.println("Directory -> " + dn.getname() ); CurrDir = dn.getname(); //Traversing list through Iterator List <EntryNode> list = dn.GetAllFiles(); IEnumerator <EntryNode> itr = list.GetEnumerator(); while (itr.MoveNext()) { EntryNode nt = (EntryNode)itr.Current; if (nt.Isdir()) { CurrDir = ((DirectoryNode)nt).getname(); ((DirectoryNode)nt).Accept(this); } else { ((FileNode)nt).Accept(this); } } }