From 7676ff1cefe48bf9909626cde1997a06dc03f546 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 27 Nov 2012 13:56:26 -0500 Subject: [PATCH] DepotDownloader: switch to DownloadFileToStream for grabbing Steam2 content to reduce memory usage. --- DepotDownloader/ContentDownloader.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 0dc9e3f2..04cd81d8 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -984,9 +984,11 @@ namespace DepotDownloader float perc = ( ( float )x / ( float )depot.NodesToDownload.Count ) * 100.0f; Console.WriteLine("{0,6:#00.00}%\t{1}", perc, downloadPath); - - var file = session.DownloadFile( dirEntry, ContentServerClient.StorageSession.DownloadPriority.High, depot.cryptKey ); - File.WriteAllBytes( downloadPath, file ); + + using (var fs = new FileStream(downloadPath, FileMode.Create)) + { + session.DownloadFileToStream(dirEntry, fs, ContentServerClient.StorageSession.DownloadPriority.High, depot.cryptKey); + } } } csClient.Disconnect();