From 642f43864a7c0c2bb27fcf5ab9818f9c2eaa0e94 Mon Sep 17 00:00:00 2001 From: Ryan Kistner Date: Wed, 25 Mar 2020 20:27:45 -0600 Subject: [PATCH] Added -debug command line option to enable DebugLog. Report unhandled exceptions before re-throwing them. --- DepotDownloader/Program.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index 3cb9f0b..9f62f59 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -27,6 +27,15 @@ namespace DepotDownloader #region Common Options + if ( HasParameter( args, "-debug" ) ) + { + DebugLog.Enabled = true; + DebugLog.AddListener( ( category, message ) => + { + Console.WriteLine( "[{0}] {1}", category, message ); + }); + } + string username = GetParameter( args, "-username" ) ?? GetParameter( args, "-user" ); string password = GetParameter( args, "-password" ) ?? GetParameter( args, "-pass" ); ContentDownloader.Config.RememberPassword = HasParameter( args, "-remember-password" ); @@ -123,6 +132,11 @@ namespace DepotDownloader Console.WriteLine( ex.Message ); return 1; } + catch ( Exception e ) + { + Console.WriteLine( "Download failed to due to an unhandled exception: {0}", e.Message ); + throw; + } finally { ContentDownloader.ShutdownSteam3(); @@ -192,6 +206,11 @@ namespace DepotDownloader Console.WriteLine( ex.Message ); return 1; } + catch ( Exception e ) + { + Console.WriteLine( "Download failed to due to an unhandled exception: {0}", e.Message ); + throw; + } finally { ContentDownloader.ShutdownSteam3(); @@ -205,7 +224,8 @@ namespace DepotDownloader #endregion } - return 0; + + return 0; } static bool InitializeSteam( string username, string password )