Esempio n. 1
0
        public static DirectoryData FromDirectory(DirectoryInfo di)
        {
            DirectoryData dd = new DirectoryData();

            dd.Name = di.Name;
            foreach (DirectoryInfo subDir in di.GetDirectories())
            {
                dd.Dirs.Add(DirectoryData.FromDirectory(subDir));
            }
            foreach (FileInfo file in di.GetFiles())
            {
                dd.Files.Add(FileData.FromFile(file));
            }
            return(dd);
        }
 public static DirectoryData FromDirectory(DirectoryInfo di)
 {
     DirectoryData dd = new DirectoryData();
     dd.Name = di.Name;
     foreach (DirectoryInfo subDir in di.GetDirectories())
     {
         dd.Dirs.Add(DirectoryData.FromDirectory(subDir));
     }
     foreach (FileInfo file in di.GetFiles())
     {
         dd.Files.Add(FileData.FromFile(file));
     }
     return dd;
 }