public void CopyToFile(string outputFilePath)
{
string outputDirectory = Path.GetDirectoryName(outputFilePath);
if (outputDirectory.Length > 0)
{
Directory.CreateDirectory(outputDirectory);
}
using (Stream outFile = new FileStream(outputFilePath, FileMode.Create))
{
using (Stream inFile = OpenRead())
{
CopyStream(inFile, outFile);
}
}
File.SetLastWriteTime(outputFilePath, LastWriteTime);
}