Use PublishedFile.GetItemDetails when looking up pubfiles. This also requires -app to be specified with -pubfile.

pull/103/head
Ryan Kistner 6 years ago
parent 6c37e21364
commit 5423bdc759

@ -380,13 +380,13 @@ namespace DepotDownloader
steam3.Disconnect(); 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 else
{ {

@ -114,6 +114,13 @@ namespace DepotDownloader
#endregion #endregion
uint appId = GetParameter<uint>( args, "-app", ContentDownloader.INVALID_APP_ID );
if ( appId == ContentDownloader.INVALID_APP_ID )
{
Console.WriteLine( "Error: -app not specified!" );
return 1;
}
ulong pubFile = GetParameter<ulong>( args, "-pubfile", ContentDownloader.INVALID_MANIFEST_ID ); ulong pubFile = GetParameter<ulong>( args, "-pubfile", ContentDownloader.INVALID_MANIFEST_ID );
if ( pubFile != ContentDownloader.INVALID_MANIFEST_ID ) if ( pubFile != ContentDownloader.INVALID_MANIFEST_ID )
{ {
@ -123,7 +130,7 @@ namespace DepotDownloader
{ {
try try
{ {
await ContentDownloader.DownloadPubfileAsync( pubFile ).ConfigureAwait( false ); await ContentDownloader.DownloadPubfileAsync( appId, pubFile ).ConfigureAwait( false );
} }
catch ( Exception ex ) when ( catch ( Exception ex ) when (
ex is ContentDownloaderException ex is ContentDownloaderException
@ -179,13 +186,6 @@ namespace DepotDownloader
bool lv = HasParameter( args, "-lowviolence" ); bool lv = HasParameter( args, "-lowviolence" );
uint appId = GetParameter<uint>( args, "-app", ContentDownloader.INVALID_APP_ID );
if ( appId == ContentDownloader.INVALID_APP_ID )
{
Console.WriteLine( "Error: -app not specified!" );
return 1;
}
uint depotId; uint depotId;
bool isUGC = false; bool isUGC = false;
@ -307,11 +307,13 @@ namespace DepotDownloader
{ {
Console.WriteLine(); Console.WriteLine();
Console.WriteLine( "Usage - downloading one or all depots for an app:" ); Console.WriteLine( "Usage - downloading one or all depots for an app:" );
Console.WriteLine( "\tdepotdownloader -app <id> [-depot <id> [-manifest <id>] | [-ugc <id>]]" ); Console.WriteLine( "\tdepotdownloader -app <id> [-depot <id> [-manifest <id>]]" );
Console.WriteLine( "\t\t[-username <username> [-password <password>]] [other options]" ); Console.WriteLine( "\t\t[-username <username> [-password <password>]] [other options]" );
Console.WriteLine(); Console.WriteLine();
Console.WriteLine( "Usage - downloading a Workshop item published via SteamUGC" ); Console.WriteLine("Usage - downloading a workshop item using pubfile id");
Console.WriteLine( "\tdepotdownloader -pubfile <id> [-username <username> [-password <password>]]" ); Console.WriteLine( "\tdepotdownloader -app <id> -pubfile <id> [-username <username> [-password <password>]]" );
Console.WriteLine("Usage - downloading a workshop item using ugc id");
Console.WriteLine("\tdepotdownloader -app <id> -ugc <id> [-username <username> [-password <password>]]");
Console.WriteLine(); Console.WriteLine();
Console.WriteLine( "Parameters:" ); Console.WriteLine( "Parameters:" );
Console.WriteLine( "\t-app <#>\t\t\t\t- the AppID to download." ); Console.WriteLine( "\t-app <#>\t\t\t\t- the AppID to download." );

@ -388,21 +388,21 @@ namespace DepotDownloader
}, () => { return completed; } ); }, () => { return completed; } );
} }
public PublishedFileDetails GetPubfileDetails( PublishedFileID pubFile ) public CPublishedFile_GetItemInfo_Response.WorkshopItemInfo GetPubfileItemInfo( uint appId, PublishedFileID pubFile )
{ {
var pubFileRequest = new CPublishedFile_GetDetails_Request(); var pubFileRequest = new CPublishedFile_GetItemInfo_Request() { app_id = appId };
pubFileRequest.publishedfileids.Add( pubFile ); pubFileRequest.workshop_items.Add( new CPublishedFile_GetItemInfo_Request.WorkshopItem() { published_file_id = pubFile } );
bool completed = false; bool completed = false;
PublishedFileDetails details = null; CPublishedFile_GetItemInfo_Response.WorkshopItemInfo details = null;
Action<SteamUnifiedMessages.ServiceMethodResponse> cbMethod = callback => Action<SteamUnifiedMessages.ServiceMethodResponse> cbMethod = callback =>
{ {
completed = true; completed = true;
if ( callback.Result == EResult.OK ) if ( callback.Result == EResult.OK )
{ {
var response = callback.GetDeserializedResponse<CPublishedFile_GetDetails_Response>(); var response = callback.GetDeserializedResponse<CPublishedFile_GetItemInfo_Response>();
details = response.publishedfiledetails[0]; details = response.workshop_items.FirstOrDefault();
} }
else else
{ {
@ -412,7 +412,7 @@ namespace DepotDownloader
WaitUntilCallback(() => WaitUntilCallback(() =>
{ {
callbacks.Subscribe( steamPublishedFile.SendMessage( api => api.GetDetails( pubFileRequest ) ), cbMethod ); callbacks.Subscribe( steamPublishedFile.SendMessage( api => api.GetItemInfo( pubFileRequest ) ), cbMethod );
}, () => { return completed; }); }, () => { return completed; });
return details; return details;

Loading…
Cancel
Save