From 14f2b6e39da2df3a9eb41a54dfd2509fc7626159 Mon Sep 17 00:00:00 2001 From: Ryan Stecker Date: Sat, 19 Mar 2011 10:09:53 +0000 Subject: [PATCH] Don't download files that have already been downloaded. --HG-- extra : convert_revision : svn%3A946a0da7-ebce-4904-9acb-2f1e67aed693%40214 --- DepotDownloader/ContentDownloader.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 77bba751..68288df8 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -75,14 +75,23 @@ namespace DepotDownloader if ( dirEntry.FileID == -1 ) { - // this is a directory, so lets just create it - Directory.CreateDirectory( downloadPath ); + if ( !Directory.Exists( downloadPath ) ) + { + // this is a directory, so lets just create it + Directory.CreateDirectory( downloadPath ); + } + continue; } float perc = ( ( float )x / ( float )manifest.DirEntries.Count ) * 100.0f; Console.WriteLine( " {0:0.00}%\t{1}", perc, dirEntry.FullName ); + FileInfo fi = new FileInfo( downloadPath ); + + if ( fi.Exists && fi.Length == dirEntry.ItemSize ) + continue; + ContentServerClient.File file = csClient.DownloadFile( storageId, dirEntry.FileID ); if ( file.FileMode == 1 )