Changeset 1467 for trunk/eraser6
- Timestamp:
- 1/5/2010 10:39:29 AM (3 years ago)
- Location:
- trunk/eraser6/Eraser.DefaultPlugins
- Files:
-
- 5 edited
-
FileSystems/Windows.cs (modified) (4 diffs)
-
Strings.en.resx (modified) (1 diff)
-
Strings.it.resx (modified) (1 diff)
-
Strings.nl.resx (modified) (1 diff)
-
Strings.resx (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6/Eraser.DefaultPlugins/FileSystems/Windows.cs
r1457 r1467 56 56 ++i; 57 57 } 58 catch (IOException) 59 { 60 Thread.Sleep(100); 61 62 //If after FilenameEraseTries the file is still locked, some program is 63 //definitely using the file; throw an exception. 64 if (tries > FileNameEraseTries) 65 throw new IOException(S._("The file {0} is currently in use and " + 66 "cannot be removed.", info.FullName)); 58 catch (IOException e) 59 { 60 switch (System.Runtime.InteropServices.Marshal.GetLastWin32Error()) 61 { 62 case 5: //ERROR_ACCESS_DENIED 63 throw new UnauthorizedAccessException(S._("The file {0} could not " + 64 "be erased because the file's permissions prevent access to the file.", 65 info.FullName)); 66 67 case 32: //ERROR_SHARING_VIOLATION 68 //Let the process locking the file release the lock 69 Thread.Sleep(100); 70 71 //If after FilenameEraseTries the file is still locked, some program is 72 //definitely using the file; throw an exception. 73 if (tries > FileNameEraseTries) 74 throw new IOException(S._("The file {0} is currently in use and " + 75 "cannot be removed.", info.FullName), e); 76 default: 77 throw; 78 } 67 79 } 68 80 } … … 82 94 break; 83 95 } 84 catch (IOException) 85 { 86 if (i > FileNameEraseTries) 87 throw new IOException(S._("The file {0} is currently in use and " + 88 "cannot be removed.", info.FullName)); 89 Thread.Sleep(100); 96 catch (IOException e) 97 { 98 switch (System.Runtime.InteropServices.Marshal.GetLastWin32Error()) 99 { 100 case 5: //ERROR_ACCESS_DENIED 101 throw new UnauthorizedAccessException(S._("The file {0} could not " + 102 "be erased because the file's permissions prevent access to the file.", 103 info.FullName), e); 104 105 case 32: //ERROR_SHARING_VIOLATION 106 //Let the process locking the file release the lock 107 Thread.Sleep(100); 108 109 //If after FilenameEraseTries the file is still locked, some program is 110 //definitely using the file; throw an exception. 111 if (i > FileNameEraseTries) 112 throw new IOException(S._("The file {0} is currently in use and " + 113 "cannot be removed.", info.FullName), e); 114 default: 115 throw; 116 } 90 117 } 91 118 } … … 104 131 105 132 //Then clean up this folder. 106 for (int i = 0 ; i < FileNameErasePasses; ++i)133 for (int i = 0, tries = 0; i < FileNameErasePasses; ++tries) 107 134 { 108 135 //Rename the folder. … … 114 141 { 115 142 info.MoveTo(newPath); 116 } 117 catch (IOException) 118 { 119 Thread.Sleep(100); 120 --i; 143 ++i; 144 } 145 catch (IOException e) 146 { 147 switch (System.Runtime.InteropServices.Marshal.GetLastWin32Error()) 148 { 149 case 5: //ERROR_ACCESS_DENIED 150 throw new UnauthorizedAccessException(S._("The file {0} could not " + 151 "be erased because the file's permissions prevent access to the file.", 152 info.FullName), e); 153 154 case 32: //ERROR_SHARING_VIOLATION 155 //Let the process locking the file release the lock 156 Thread.Sleep(100); 157 158 //If after FilenameEraseTries the file is still locked, some program is 159 //definitely using the file; throw an exception. 160 if (tries > FileNameEraseTries) 161 throw new IOException(S._("The file {0} is currently in use and " + 162 "cannot be removed.", info.FullName), e); 163 default: 164 throw; 165 } 121 166 } 122 167 } -
trunk/eraser6/Eraser.DefaultPlugins/Strings.en.resx
r1216 r1467 151 151 <value>An invalid erasure method was selected.</value> 152 152 </data> 153 <data name="The file {0} could not be erased because the file's permissions prevent access to the file." xml:space="preserve"> 154 <value>The file {0} could not be erased because the file's permissions prevent access to the file.</value> 155 </data> 153 156 <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 154 157 <value>The file {0} is currently in use and cannot be removed.</value> -
trunk/eraser6/Eraser.DefaultPlugins/Strings.it.resx
r1346 r1467 151 151 <value>E' stato selezionato un metodo di pulizia non valido.</value> 152 152 </data> 153 <data name="The file {0} could not be erased because the file's permissions prevent access to the file." xml:space="preserve"> 154 <value>(Untranslated)</value> 155 </data> 153 156 <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 154 157 <value>Il file {0} è attualmente in uso e non può essere rimosso.</value> -
trunk/eraser6/Eraser.DefaultPlugins/Strings.nl.resx
r1216 r1467 151 151 <value>(Untranslated)</value> 152 152 </data> 153 <data name="The file {0} could not be erased because the file's permissions prevent access to the file." xml:space="preserve"> 154 <value>(Untranslated)</value> 155 </data> 153 156 <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 154 157 <value>(Untranslated)</value> -
trunk/eraser6/Eraser.DefaultPlugins/Strings.resx
r1268 r1467 151 151 <value>An invalid erasure method was selected.</value> 152 152 </data> 153 <data name="The file {0} could not be erased because the file's permissions prevent access to the file." xml:space="preserve"> 154 <value>The file {0} could not be erased because the file's permissions prevent access to the file.</value> 155 </data> 153 156 <data name="The file {0} is currently in use and cannot be removed." xml:space="preserve"> 154 157 <value>The file {0} is currently in use and cannot be removed.</value>
Note: See TracChangeset
for help on using the changeset viewer.
