From 429d1937f9da3f30f00525bd26af4d068ab4d7ed Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Sat, 13 Apr 2019 18:47:23 +0100 Subject: [PATCH] Apps.GetFileDetails propert async working example --- Facepunch.Steamworks/Redux/Apps.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Facepunch.Steamworks/Redux/Apps.cs b/Facepunch.Steamworks/Redux/Apps.cs index c346d5d..b5c59e7 100644 --- a/Facepunch.Steamworks/Redux/Apps.cs +++ b/Facepunch.Steamworks/Redux/Apps.cs @@ -177,7 +177,7 @@ public static string AppInstallDir( AppId appid ) public static SteamId AppOwner => steamapps.GetAppOwner().Value; /// - /// Gets the associated launch parameter if the game is run via steam://run//?param1=value1;param2=value2;param3=value3 etc. + /// Gets the associated launch parameter if the game is run via steam://run/appid/?param1=value1;param2=value2;param3=value3 etc. /// Parameter names starting with the character '@' are reserved for internal use and will always return an empty string. /// Parameter names starting with an underscore '_' are reserved for steam features -- they can be queried by the game, /// but it is advised that you not param names beginning with an underscore for your own features. @@ -213,13 +213,19 @@ public static async Task GetFileDetails( string filename ) { var call = steamapps.GetFileDetails( filename ); - while ( !Utils.IsCallComplete( call, out bool failed ) ) + while ( !call.IsComplete() ) { await Task.Delay( 1 ); } + var r = call.GetResult(); + if ( !r.HasValue ) + throw new System.Exception( "Something went wrong" ); - return new FileDetails(); + return new FileDetails + { + SizeInBytes = r.Value.FileSize + }; } }