public EntryNode Traverse()
        {
            EntryNode ns = null;

            DirectoryInfo dir = new DirectoryInfo(root.getname());



            ns = WalkDirectoryTree(dir);

            return(ns);
        }
示例#2
0
        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();
        }
示例#3
0
        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());
                }
            }
        }
示例#4
0
        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);
                }
            }
        }
示例#5
0
        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);
                }
            }
        }