private string GenerateRandomPEFileName(){
if (this.randomNumberGenerator == null)
this.randomNumberGenerator = new RNGCryptoServiceProvider();
// Generate random bytes
byte[] data = new byte[6];
this.randomNumberGenerator.GetBytes(data);
// Turn them into a string containing only characters valid in file names
string randomString = System.Convert.ToBase64String(data);
randomString = randomString.Replace('/', '-');
randomString = randomString.Replace('+', '_');
// Use the first random filename as the engine's temp directory name
if (this.tempDirectory == null)
this.tempDirectory = System.IO.Path.GetTempPath() + randomString;
string filename = randomString + (this.PEFileKind == PEFileKinds.Dll? ".dll": ".exe");
return this.tempDirectory + Path.DirectorySeparatorChar + filename;
}