Changeset 894


Ignore:
Timestamp:
04/27/09 12:46:42 (5 years ago)
Author:
lowjoel
Message:

-Handle files which are currently locked by another process - currently the behaviour is to log the file as unerased and flag the task as an error having occurred
-Handle sparse/compressed/encrypted files without throwing an exception because that will cause the rest of the files to remain unerased

Location:
branches/eraser6/Manager
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eraser6/Manager/DirectExecutor.cs

    r893 r894  
    10261026                task.OnProgressChanged(progress.Event); 
    10271027 
    1028                 //Make sure the file does not have any attributes which may affect 
    1029                 //the erasure process 
     1028                 
     1029                //Remove the read-only flag, if it is set. 
     1030                StreamInfo info = new StreamInfo(paths[i]); 
    10301031                bool isReadOnly = false; 
    1031                 StreamInfo info = new StreamInfo(paths[i]); 
    1032                 if ((info.Attributes & FileAttributes.Compressed) != 0 || 
    1033                     (info.Attributes & FileAttributes.Encrypted) != 0 || 
    1034                     (info.Attributes & FileAttributes.SparseFile) != 0) 
    1035                 { 
    1036                     //Log the error 
    1037                     //TODO: This would leave files after the list unerased. Log this as an error instead 
    1038                     throw new ArgumentException(S._("Compressed, encrypted, or sparse" + 
    1039                         "files cannot be erased with Eraser.")); 
    1040                 } 
    1041  
    1042                 //Remove the read-only flag, if it is set. 
    10431032                if (isReadOnly = info.IsReadOnly) 
    10441033                    info.IsReadOnly = false; 
     
    10461035                try 
    10471036                { 
     1037                    //Make sure the file does not have any attributes which may affect 
     1038                    //the erasure process 
     1039                    if ((info.Attributes & FileAttributes.Compressed) != 0 ||  
     1040                        (info.Attributes & FileAttributes.Encrypted) != 0 || 
     1041                        (info.Attributes & FileAttributes.SparseFile) != 0) 
     1042                    { 
     1043                        //Log the error 
     1044                        task.Log.Add(new LogEntry(S._("The file {0} could not be erased " + 
     1045                            "because the file was either compressed, encrypted or a sparse file.", 
     1046                            info.FullName), LogLevel.ERROR)); 
     1047                    } 
     1048 
    10481049                    //Create the file stream, and call the erasure method to write to 
    10491050                    //the stream. 
     
    10991100                        LogLevel.ERROR)); 
    11001101                } 
     1102                catch (FileLoadException) 
     1103                { 
     1104                    task.Log.Add(new LogEntry(S._("The file {0} could not be erased because the " + 
     1105                        "file is currently in use.", info.FullName), LogLevel.ERROR)); 
     1106                } 
    11011107                finally 
    11021108                { 
  • branches/eraser6/Manager/Strings.en.resx

    r808 r894  
    175175    <value>Could not erase old file system entries: Unsupported File system</value> 
    176176  </data> 
    177   <data name="Compressed, encrypted, or sparsefiles cannot be erased with Eraser." xml:space="preserve"> 
    178     <value>Compressed, encrypted, or sparsefiles cannot be erased with Eraser.</value> 
     177  <data name="The file {0} could not be erased because the file was either compressed, encrypted or a sparse file." xml:space="preserve"> 
     178    <value>The file {0} could not be erased because the file was either compressed, encrypted or a sparse file.</value> 
    179179  </data> 
    180180  <data name="The file {0} could not be erased because the file's permissions prevent access to the file." xml:space="preserve"> 
    181181    <value>The file {0} could not be erased because the file's permissions prevent access to the file.</value> 
    182182  </data> 
     183  <data name="The file {0} could not be erased because the file is currently in use." xml:space="preserve"> 
     184    <value>The file {0} could not be erased because the file is currently in use.</value> 
     185  </data> 
    183186  <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 
    184187    <value>The file {0} is currently in use and cannot be removed.</value> 
  • branches/eraser6/Manager/Strings.nl.resx

    r808 r894  
    175175    <value>(Untranslated)</value> 
    176176  </data> 
    177   <data name="Compressed, encrypted, or sparsefiles cannot be erased with Eraser." xml:space="preserve"> 
     177  <data name="The file {0} could not be erased because the file was either compressed, encrypted or a sparse file." xml:space="preserve"> 
    178178    <value>(Untranslated)</value> 
    179179  </data> 
     
    181181    <value>(Untranslated)</value> 
    182182  </data> 
     183  <data name="The file {0} could not be erased because the file is currently in use." xml:space="preserve"> 
     184    <value>(Untranslated)</value> 
     185  </data> 
    183186  <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 
    184187    <value>(Untranslated)</value> 
  • branches/eraser6/Manager/Strings.resx

    r808 r894  
    175175    <value>Could not erase old file system entries: Unsupported File system</value> 
    176176  </data> 
    177   <data name="Compressed, encrypted, or sparsefiles cannot be erased with Eraser." xml:space="preserve"> 
    178     <value>Compressed, encrypted, or sparsefiles cannot be erased with Eraser.</value> 
     177  <data name="The file {0} could not be erased because the file was either compressed, encrypted or a sparse file." xml:space="preserve"> 
     178    <value>The file {0} could not be erased because the file was either compressed, encrypted or a sparse file.</value> 
    179179  </data> 
    180180  <data name="The file {0} could not be erased because the file's permissions prevent access to the file." xml:space="preserve"> 
    181181    <value>The file {0} could not be erased because the file's permissions prevent access to the file.</value> 
    182182  </data> 
     183  <data name="The file {0} could not be erased because the file is currently in use." xml:space="preserve"> 
     184    <value>The file {0} could not be erased because the file is currently in use.</value> 
     185  </data> 
    183186  <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 
    184187    <value>The file {0} is currently in use and cannot be removed.</value> 
Note: See TracChangeset for help on using the changeset viewer.