Changeset 1864


Ignore:
Timestamp:
3/1/2010 5:58:08 AM (4 years ago)
Author:
lowjoel
Message:

Task progress should be updated within the try-catch block since getting the length of the file may cause an IOException (e.g. file already deleted, file in use etc)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/eraser6/Eraser.Manager/DirectExecutor.cs

    r1835 r1864  
    621621                    VolumeInfo.FromMountPoint(info.DirectoryName)]; 
    622622 
    623                 //Update the task progress 
    624                 ProgressManager step = new ProgressManager(); 
    625                 progress.Steps.Add(new SteppedProgressManagerStep(step, 
    626                     info.Length / (float)dataTotal, S._("Erasing files..."))); 
    627                 task.OnProgressChanged(target, 
    628                     new ProgressChangedEventArgs(step, 
    629                         new TaskProgressChangedEventArgs(paths[i], 0, method.Passes))); 
    630  
    631623                bool isReadOnly = false; 
    632                  
     624 
    633625                try 
    634626                { 
     627                    //Update the task progress 
     628                    ProgressManager step = new ProgressManager(); 
     629                    progress.Steps.Add(new SteppedProgressManagerStep(step, 
     630                        info.Length / (float)dataTotal, S._("Erasing files..."))); 
     631                    task.OnProgressChanged(target, 
     632                        new ProgressChangedEventArgs(step, 
     633                            new TaskProgressChangedEventArgs(paths[i], 0, method.Passes))); 
     634 
    635635                    //Remove the read-only flag, if it is set. 
    636636                    if (isReadOnly = info.IsReadOnly) 
     
    639639                    //Make sure the file does not have any attributes which may affect 
    640640                    //the erasure process 
    641                     if ((info.Attributes & FileAttributes.Compressed) != 0 ||  
     641                    if ((info.Attributes & FileAttributes.Compressed) != 0 || 
    642642                        (info.Attributes & FileAttributes.Encrypted) != 0 || 
    643643                        (info.Attributes & FileAttributes.SparseFile) != 0) 
Note: See TracChangeset for help on using the changeset viewer.