コード例 #1
0
        public static List <ManagedDirEntry> GetDirectory(string strPath, string mask)
        {
            List <ManagedDirEntry> vsEntries = new List <ManagedDirEntry>();

            if (string.IsNullOrEmpty(mask))
            {
                mask = "*.*";
            }
            foreach (var entry in Directory.GetDirectories(strPath, mask, SearchOption.AllDirectories))
            {
                var dirName = new DirectoryInfo(entry).Name;
                var vsEntry = new ManagedDirEntry(dirName, entry)
                {
                    IsFolder = true
                };
                vsEntries.Add(vsEntry);
            }
            foreach (var entry in Directory.GetFiles(strPath, mask, SearchOption.AllDirectories))
            {
                ManagedDirEntry vsEntry = new ManagedDirEntry(Path.GetFileName(entry), entry)
                {
                    IsFolder = false, Size = new FileInfo(entry).Length
                };
                vsEntries.Add(vsEntry);
            }
            Logger.Log("-  Total: {0}", vsEntries.Count);
            return(vsEntries);
        }
コード例 #2
0
 public static List<ManagedDirEntry> GetDirectory(string strPath, string mask)
 {
   List<ManagedDirEntry> vsEntries = new List<ManagedDirEntry>();
   if (string.IsNullOrEmpty(mask))
     mask = "*.*";
   foreach (var entry in Directory.GetDirectories(strPath, mask, SearchOption.AllDirectories))
   {
     var dirName = new DirectoryInfo(entry).Name;
     var vsEntry = new ManagedDirEntry(dirName, entry) { IsFolder = true };
     vsEntries.Add(vsEntry);
   }
   foreach (var entry in Directory.GetFiles(strPath, mask, SearchOption.AllDirectories))
   {
     ManagedDirEntry vsEntry = new ManagedDirEntry(Path.GetFileName(entry), entry) { IsFolder = false, Size = new FileInfo(entry).Length };
     vsEntries.Add(vsEntry);
   }
   Logger.Log("-  Total: {0}", vsEntries.Count);
   return vsEntries;
 }