Changeset 1738


Ignore:
Timestamp:
2/3/2010 12:53:49 AM (5 years ago)
Author:
lowjoel
Message:
  • When passing reference variables, we don't need to use ref (unless we want to change the reference, but in this case, we aren't)
  • Just like for file system objects, when we get a file or directory from the recycle bin, ensure that it exists and that it isn't a reparse point (otherwise, we can just ignore it)
  • Split files and directory enumeration in the recycle bin targets to remove casts (which are slow)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/6.0/Eraser.Manager/Task.cs

    r1737 r1738  
    409409                    string adsPath = file + ':' + adsName; 
    410410                    list.Add(adsPath); 
    411                     Util.StreamInfo info = new Util.StreamInfo(adsPath); 
     411                    StreamInfo info = new StreamInfo(adsPath); 
    412412                    totalSize += info.Length; 
    413413                } 
     
    748748                        continue; 
    749749 
    750                     GetRecyclerFiles(dir, ref result, ref totalSize); 
     750                    GetRecyclerFiles(dir, result, ref totalSize); 
    751751                } 
    752752            } 
     
    761761        /// <param name="paths">The list of files to store path information in.</param> 
    762762        /// <param name="totalSize">Receives the total size of the files.</param> 
    763         private void GetRecyclerFiles(DirectoryInfo info, ref List<string> paths, 
     763        private void GetRecyclerFiles(DirectoryInfo info, List<string> paths, 
    764764            ref long totalSize) 
    765765        { 
    766766            try 
    767767            { 
    768                 foreach (FileSystemInfo fsInfo in info.GetFileSystemInfos()) 
     768                foreach (FileInfo fileInfo in info.GetFiles()) 
    769769                { 
    770                     FileInfo fileInfo = fsInfo as FileInfo; 
    771                     if (fileInfo != null) 
    772                     { 
    773                         totalSize += fileInfo.Length; 
    774                         GetPathADSes(paths, out totalSize, fileInfo.FullName); 
    775                         paths.Add(fileInfo.FullName); 
    776                     } 
    777                     else 
    778                         GetRecyclerFiles((DirectoryInfo)fsInfo, ref paths, ref totalSize); 
     770                    if (!fileInfo.Exists || (fileInfo.Attributes & FileAttributes.ReparsePoint) != 0) 
     771                        continue; 
     772 
     773                    totalSize += fileInfo.Length; 
     774                    GetPathADSes(paths, out totalSize, fileInfo.FullName); 
     775                    paths.Add(fileInfo.FullName); 
    779776                } 
     777 
     778                foreach (DirectoryInfo directoryInfo in info.GetDirectories()) 
     779                    if ((directoryInfo.Attributes & FileAttributes.ReparsePoint) == 0) 
     780                        GetRecyclerFiles(directoryInfo, paths, ref totalSize); 
    780781            } 
    781782            catch (UnauthorizedAccessException e) 
Note: See TracChangeset for help on using the changeset viewer.