- Timestamp:
- 2/9/2010 7:23:22 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/CodeReview/Eraser.DefaultPlugins/FileSystems/Windows.cs
r1745 r1777 155 155 156 156 public override void EraseClusterTips(VolumeInfo info, ErasureMethod method, 157 Logger log, ClusterTipsSearchProgress searchCallback, 158 ClusterTipsEraseProgress eraseCallback) 157 ClusterTipsSearchProgress searchCallback, ClusterTipsEraseProgress eraseCallback) 159 158 { 160 159 //List all the files which can be erased. … … 163 162 throw new InvalidOperationException(S._("Could not erase cluster tips in {0} " + 164 163 "as the volume is not mounted.", info.VolumeId)); 165 ListFiles(new DirectoryInfo(info.MountPoints[0]), files, log,searchCallback);164 ListFiles(new DirectoryInfo(info.MountPoints[0]), files, searchCallback); 166 165 167 166 //For every file, erase the cluster tips. … … 180 179 catch (UnauthorizedAccessException) 181 180 { 182 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have its" +183 " cluster tips erased because you do not have the required permissions to " +184 "erase the file cluster tips.", files[i]), LogLevel.Information));181 Logger.Log(S._("{0} did not have its cluster tips erased because you do not " + 182 "have the required permissions to erase the file cluster tips.", files[i]), 183 LogLevel.Information); 185 184 } 186 185 catch (IOException e) 187 186 { 188 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have its " + 189 "cluster tips erased. The error returned was: {1}", files[i], 190 e.Message), LogLevel.Error)); 187 Logger.Log(S._("{0} did not have its cluster tips erased. The error returned " + 188 "was: {1}", files[i], e.Message), LogLevel.Error); 191 189 } 192 190 finally … … 194 192 streamInfo.Attributes = fileAttr; 195 193 } 194 196 195 eraseCallback(i, files.Count, files[i]); 197 196 } 198 197 } 199 198 200 private void ListFiles(DirectoryInfo info, List<string> files, Logger log,199 private void ListFiles(DirectoryInfo info, List<string> files, 201 200 ClusterTipsSearchProgress searchCallback) 202 201 { … … 206 205 if ((info.Attributes & FileAttributes.ReparsePoint) != 0) 207 206 { 208 log.LastSessionEntries.Add(new LogEntry(S._("Files in {0} did" +209 " not have their cluster tips erased because it is a hard link or " +210 "a symbolic link.", info.FullName), LogLevel.Information));207 Logger.Log(S._("Files in {0} did not have their cluster tips erased because " + 208 "it is a hard link or a symbolic link.", info.FullName), 209 LogLevel.Information); 211 210 return; 212 211 } … … 214 213 foreach (FileInfo file in info.GetFiles()) 215 214 if (file.IsProtectedSystemFile()) 216 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have " + 217 "its cluster tips erased, because it is a system file", 218 file.FullName), LogLevel.Information)); 215 Logger.Log(S._("{0} did not have its cluster tips erased, because it is " + 216 "a system file", file.FullName), LogLevel.Information); 219 217 else if ((file.Attributes & FileAttributes.ReparsePoint) != 0) 220 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have " + 221 "its cluster tips erased because it is a hard link or a " + 222 "symbolic link.", file.FullName), LogLevel.Information)); 218 Logger.Log(S._("{0} did not have its cluster tips erased because it is a " + 219 "hard link or a symbolic link.", file.FullName), LogLevel.Information); 223 220 else if ((file.Attributes & FileAttributes.Compressed) != 0 || 224 221 (file.Attributes & FileAttributes.Encrypted) != 0 || 225 222 (file.Attributes & FileAttributes.SparseFile) != 0) 226 223 { 227 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have" +228 " its cluster tips erased because it is compressed, encrypted " +229 "or a sparse file.", file.FullName), LogLevel.Information));224 Logger.Log(S._("{0} did not have its cluster tips erased because it is " + 225 "compressed, encrypted or a sparse file.", file.FullName), 226 LogLevel.Information); 230 227 } 231 228 else … … 240 237 catch (UnauthorizedAccessException e) 241 238 { 242 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not" +243 " have its cluster tips erased because of the following " +244 "error: {1}", info.FullName, e.Message), LogLevel.Error));239 Logger.Log(S._("{0} did not have its cluster tips erased because of " + 240 "the following error: {1}", info.FullName, e.Message), 241 LogLevel.Error); 245 242 } 246 243 catch (IOException e) 247 244 { 248 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not" +249 " have its cluster tips erased because of the following " +250 "error: {1}", info.FullName, e.Message), LogLevel.Error));245 Logger.Log(S._("{0} did not have its cluster tips erased because of " + 246 "the following error: {1}", info.FullName, e.Message), 247 LogLevel.Error); 251 248 } 252 249 } … … 255 252 { 256 253 searchCallback(subDirInfo.FullName); 257 ListFiles(subDirInfo, files, log,searchCallback);254 ListFiles(subDirInfo, files, searchCallback); 258 255 } 259 256 } 260 257 catch (UnauthorizedAccessException e) 261 258 { 262 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have its " + 263 "cluster tips erased because of the following error: {1}", 264 info.FullName, e.Message), LogLevel.Error)); 259 Logger.Log(S._("{0} did not have its cluster tips erased because of the " + 260 "following error: {1}", info.FullName, e.Message), LogLevel.Error); 265 261 } 266 262 catch (IOException e) 267 263 { 268 log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have its " + 269 "cluster tips erased because of the following error: {1}", 270 info.FullName, e.Message), LogLevel.Error)); 264 Logger.Log(S._("{0} did not have its cluster tips erased because of the " + 265 "following error: {1}", info.FullName, e.Message), LogLevel.Error); 271 266 } 272 267 }
Note: See TracChangeset
for help on using the changeset viewer.
