X-Git-Url: http://git.euphorik.ch/?p=crypto_lab2.git;a=blobdiff_plain;f=labo2-fsharp%2FCryptoFile%2FAPI.fs;fp=labo2-fsharp%2FCryptoFile%2FAPI.fs;h=2f80c070fec56e6683a44bb79b55ca085ad668b1;hp=886b0d927b01d332fef164c3fdc4f6d44b6cd53d;hb=a29300558755d533aff12a6fb668c7e985ca4617;hpb=95f772ef77baee15929c1feccc4de4c9a795f81d diff --git a/labo2-fsharp/CryptoFile/API.fs b/labo2-fsharp/CryptoFile/API.fs index 886b0d9..2f80c07 100644 --- a/labo2-fsharp/CryptoFile/API.fs +++ b/labo2-fsharp/CryptoFile/API.fs @@ -93,12 +93,12 @@ module API = // Decrypt metadata. inputStream.Position <- 32L + 256L + 256L use cryptoStream = Crypto.decryptAES keyAES iv inputStream - let metadata = Metadata (cryptoStream) + let metadata = Metadata cryptoStream // Create the file and write its content and metadata. let filePath = Path.Combine (targetDirPath, metadata.get MetadataKeys.filename) let modificationTime = DateTime (metadata.get MetadataKeys.modificationTime |> int64) - let fileInfo = FileInfo (filePath) + let fileInfo = FileInfo filePath using (fileInfo.Create ()) <| fun outputStream -> cryptoStream.CopyTo outputStream fileInfo.LastWriteTimeUtc <- modificationTime \ No newline at end of file