Changeset 198
- Timestamp:
- 3/10/2008 12:28:01 PM (5 years ago)
- Location:
- branches/eraser6/Manager
- Files:
-
- 2 edited
-
DirectExecutor.cs (modified) (4 diffs)
-
Manager.csproj (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/Manager/DirectExecutor.cs
r193 r198 5 5 using System.Threading; 6 6 using System.IO; 7 8 using Eraser.Util; 7 9 8 10 namespace Eraser.Manager … … 209 211 8, FileOptions.WriteThrough)) 210 212 { 213 //Set the end of the stream after the wrap-round the cluster size 214 uint clusterSize = Drives.GetDriveClusterSize(info.Directory.Root.FullName); 215 long roundUpFileLength = strm.Length % clusterSize; 216 if (roundUpFileLength != 0) 217 strm.SetLength(strm.Length + (clusterSize - roundUpFileLength)); 218 219 //Then erase the file. 211 220 method.Erase(strm, PRNGManager.GetInstance(Globals.Settings.ActivePRNG), 212 221 delegate(uint currentProgress, uint currentPass) … … 237 246 //detection 238 247 info.CreationTime = info.LastWriteTime = info.LastAccessTime = 239 DateTime.MinValue;248 new DateTime(1800, 1, 1, 0, 0, 0); 240 249 info.Attributes = FileAttributes.Normal; 241 250 info.Attributes = FileAttributes.NotContentIndexed; … … 245 254 { 246 255 //Get a random file name 247 PRNG prng = null;256 PRNG prng = PRNGManager.GetInstance(Globals.Settings.ActivePRNG); 248 257 byte[] newFileNameAry = new byte[info.Name.Length]; 249 258 prng.NextBytes(newFileNameAry); 250 string newFileName = (new System.Text.ASCIIEncoding()).251 GetString(newFileNameAry);252 259 253 260 //Validate the name 254 261 const string validFileNameChars = "0123456789abcdefghijklmnopqrs" + 255 262 "tuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 256 for (int j = 0, k = newFileName.Length; j < k; ++j) 257 if (!Char.IsLetterOrDigit(newFileName[j])) 258 { 259 newFileName.Insert(j, validFileNameChars[ 260 (int)newFileName[j] % validFileNameChars.Length].ToString()); 261 newFileName.Remove(j + 1, 1); 262 } 263 for (int j = 0, k = newFileNameAry.Length; j < k; ++j) 264 newFileNameAry[j] = (byte)validFileNameChars[ 265 (int)newFileNameAry[j] % validFileNameChars.Length]; 263 266 264 267 //Rename the file. 265 info.MoveTo(info.DirectoryName + Path.DirectorySeparatorChar + newFileName); 266 } 268 string newPath = info.DirectoryName + Path.DirectorySeparatorChar + 269 (new System.Text.UTF8Encoding()).GetString(newFileNameAry); 270 info.MoveTo(newPath); 271 } 272 273 //Then delete the file. 274 info.Delete(); 267 275 } 268 276 -
branches/eraser6/Manager/Manager.csproj
r190 r198 46 46 <Compile Include="Task.cs" /> 47 47 </ItemGroup> 48 <ItemGroup> 49 <ProjectReference Include="..\Util\Util.csproj"> 50 <Project>{D083E1A8-3A4C-4683-9B3F-D5FEDE61B9C9}</Project> 51 <Name>Util</Name> 52 </ProjectReference> 53 </ItemGroup> 48 54 <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> 49 55 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Note: See TracChangeset
for help on using the changeset viewer.
