Changeset 1860
- Timestamp:
- 3/1/2010 5:46:03 AM (3 years ago)
- File:
-
- 1 edited
-
branches/eraser6/6.0/Eraser.Manager/FileSystem.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eraser6/6.0/Eraser.Manager/FileSystem.cs
r1742 r1860 24 24 using System.Collections.Generic; 25 25 using System.Text; 26 using System.IO; 26 27 using Eraser.Util; 27 using System.IO;28 28 29 29 namespace Eraser.Manager … … 44 44 public static string GenerateRandomFileName(DirectoryInfo info, int length) 45 45 { 46 //Get a random file name 47 Prng prng = PrngManager.GetInstance(ManagerLibrary.Settings.ActivePrng); 46 //Initialise the base name, if any. 48 47 string resultPrefix = info == null ? string.Empty : info.FullName + 49 48 Path.DirectorySeparatorChar; 49 50 //Variables to store the intermediates. 50 51 byte[] resultAry = new byte[length]; 51 52 string result = string.Empty; 53 List<string> prohibitedFileNames = new List<string>(new string[] { 54 "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", 55 "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", 56 "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9" 57 }); 52 58 53 59 do … … 64 70 result = Encoding.UTF8.GetString(resultAry); 65 71 } 66 while (info != null && (Directory.Exists(resultPrefix + result) || 67 System.IO.File.Exists(resultPrefix + result))); 72 while (info != null && 73 prohibitedFileNames.IndexOf(Path.GetFileNameWithoutExtension(result)) != -1 || 74 (Directory.Exists(resultPrefix + result) || File.Exists(resultPrefix + result))); 68 75 return resultPrefix + result; 69 76 }
Note: See TracChangeset
for help on using the changeset viewer.
