System.IO.Compression.ZipArchiveFile.CopyToFile C# (CSharp) Method

CopyToFile() public method

Copy the data in from the 'this' ZipArchiveFile to the archive textStream named 'outputFilePath' in to the file system at 'outputFilePath'.
public CopyToFile ( string outputFilePath ) : void
outputFilePath string The output file path.
return void
        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);
        }