diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index f2691517..e7d4b4e3 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -380,13 +380,13 @@ namespace DepotDownloader steam3.Disconnect(); } - public static async Task DownloadPubfileAsync( ulong publishedFileId ) + public static async Task DownloadPubfileAsync( uint appId, ulong publishedFileId ) { - var details = steam3.GetPubfileDetails( publishedFileId ); + var details = steam3.GetPubfileItemInfo( appId, publishedFileId ); - if ( details.hcontent_file > 0 ) + if ( details?.manifest_id > 0 ) { - await DownloadAppAsync( details.consumer_appid, details.consumer_appid, details.hcontent_file, DEFAULT_BRANCH, null, null, null, false, true ); + await DownloadAppAsync( appId, appId, details.manifest_id, DEFAULT_BRANCH, null, null, null, false, true ); } else { diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index 5fb06f47..b3b9b737 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -114,6 +114,13 @@ namespace DepotDownloader #endregion + uint appId = GetParameter( args, "-app", ContentDownloader.INVALID_APP_ID ); + if ( appId == ContentDownloader.INVALID_APP_ID ) + { + Console.WriteLine( "Error: -app not specified!" ); + return 1; + } + ulong pubFile = GetParameter( args, "-pubfile", ContentDownloader.INVALID_MANIFEST_ID ); if ( pubFile != ContentDownloader.INVALID_MANIFEST_ID ) { @@ -123,7 +130,7 @@ namespace DepotDownloader { try { - await ContentDownloader.DownloadPubfileAsync( pubFile ).ConfigureAwait( false ); + await ContentDownloader.DownloadPubfileAsync( appId, pubFile ).ConfigureAwait( false ); } catch ( Exception ex ) when ( ex is ContentDownloaderException @@ -179,13 +186,6 @@ namespace DepotDownloader bool lv = HasParameter( args, "-lowviolence" ); - uint appId = GetParameter( args, "-app", ContentDownloader.INVALID_APP_ID ); - if ( appId == ContentDownloader.INVALID_APP_ID ) - { - Console.WriteLine( "Error: -app not specified!" ); - return 1; - } - uint depotId; bool isUGC = false; @@ -307,11 +307,13 @@ namespace DepotDownloader { Console.WriteLine(); Console.WriteLine( "Usage - downloading one or all depots for an app:" ); - Console.WriteLine( "\tdepotdownloader -app [-depot [-manifest ] | [-ugc ]]" ); + Console.WriteLine( "\tdepotdownloader -app [-depot [-manifest ]]" ); Console.WriteLine( "\t\t[-username [-password ]] [other options]" ); Console.WriteLine(); - Console.WriteLine( "Usage - downloading a Workshop item published via SteamUGC" ); - Console.WriteLine( "\tdepotdownloader -pubfile [-username [-password ]]" ); + Console.WriteLine("Usage - downloading a workshop item using pubfile id"); + Console.WriteLine( "\tdepotdownloader -app -pubfile [-username [-password ]]" ); + Console.WriteLine("Usage - downloading a workshop item using ugc id"); + Console.WriteLine("\tdepotdownloader -app -ugc [-username [-password ]]"); Console.WriteLine(); Console.WriteLine( "Parameters:" ); Console.WriteLine( "\t-app <#>\t\t\t\t- the AppID to download." ); diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index e6d5313b..a88944e3 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -388,21 +388,21 @@ namespace DepotDownloader }, () => { return completed; } ); } - public PublishedFileDetails GetPubfileDetails( PublishedFileID pubFile ) + public CPublishedFile_GetItemInfo_Response.WorkshopItemInfo GetPubfileItemInfo( uint appId, PublishedFileID pubFile ) { - var pubFileRequest = new CPublishedFile_GetDetails_Request(); - pubFileRequest.publishedfileids.Add( pubFile ); + var pubFileRequest = new CPublishedFile_GetItemInfo_Request() { app_id = appId }; + pubFileRequest.workshop_items.Add( new CPublishedFile_GetItemInfo_Request.WorkshopItem() { published_file_id = pubFile } ); bool completed = false; - PublishedFileDetails details = null; + CPublishedFile_GetItemInfo_Response.WorkshopItemInfo details = null; Action cbMethod = callback => { completed = true; if ( callback.Result == EResult.OK ) { - var response = callback.GetDeserializedResponse(); - details = response.publishedfiledetails[0]; + var response = callback.GetDeserializedResponse(); + details = response.workshop_items.FirstOrDefault(); } else { @@ -412,7 +412,7 @@ namespace DepotDownloader WaitUntilCallback(() => { - callbacks.Subscribe( steamPublishedFile.SendMessage( api => api.GetDetails( pubFileRequest ) ), cbMethod ); + callbacks.Subscribe( steamPublishedFile.SendMessage( api => api.GetItemInfo( pubFileRequest ) ), cbMethod ); }, () => { return completed; }); return details;