Changeset 1134
- Timestamp:
- 6/16/2009 5:35:55 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/eraser6/Eraser.Manager/DirectExecutor.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6/Eraser.Manager/DirectExecutor.cs
r1131 r1134 763 763 EraseFileClusterTips(files[i], method); 764 764 } 765 catch (UnauthorizedAccessException) 766 { 767 task.Log.LastSessionEntries.Add(new LogEntry(S._("{0} did not have its " + 768 "cluster tips erased because you do not have the required permissions to " + 769 "erase the file cluster tips.", files[i]), LogLevel.Error)); 770 } 765 771 catch (IOException e) 766 772 { … … 800 806 try 801 807 { 802 try 803 { 804 //Otherwise, create the stream, lengthen the file, then tell the erasure 805 //method to erase the cluster tips. 806 using (FileStream stream = streamInfo.Open(FileMode.Open, FileAccess.Write, 807 FileShare.None, FileOptions.WriteThrough)) 808 { 809 try 810 { 811 stream.SetLength(fileArea); 812 stream.Seek(fileLength, SeekOrigin.Begin); 813 814 //Erase the file 815 method.Erase(stream, long.MaxValue, PrngManager.GetInstance( 816 ManagerLibrary.Settings.ActivePrng), null); 817 } 818 finally 819 { 820 //Make sure the file length is restored! 821 stream.SetLength(fileLength); 822 } 808 //Otherwise, create the stream, lengthen the file, then tell the erasure 809 //method to erase the cluster tips. 810 using (FileStream stream = streamInfo.Open(FileMode.Open, FileAccess.Write, 811 FileShare.None, FileOptions.WriteThrough)) 812 { 813 try 814 { 815 stream.SetLength(fileArea); 816 stream.Seek(fileLength, SeekOrigin.Begin); 817 818 //Erase the file 819 method.Erase(stream, long.MaxValue, PrngManager.GetInstance( 820 ManagerLibrary.Settings.ActivePrng), null); 823 821 } 824 } 825 finally 826 { 827 //Reset the file times 828 streamInfo.LastAccessTime = lastAccess; 829 streamInfo.LastWriteTime = lastWrite; 830 streamInfo.CreationTime = created; 831 } 832 } 833 catch (UnauthorizedAccessException) 834 { 822 finally 823 { 824 //Make sure the file length is restored! 825 stream.SetLength(fileLength); 826 } 827 } 828 } 829 finally 830 { 831 //Reset the file times 832 streamInfo.LastAccessTime = lastAccess; 833 streamInfo.LastWriteTime = lastWrite; 834 streamInfo.CreationTime = created; 835 835 } 836 836 }
Note: See TracChangeset
for help on using the changeset viewer.
