|
|
|
@ -386,17 +386,45 @@ namespace DepotDownloader
|
|
|
|
|
var details = steam3.GetPublishedFileDetails( appId, publishedFileId );
|
|
|
|
|
|
|
|
|
|
if ( !string.IsNullOrEmpty( details?.file_url ) )
|
|
|
|
|
{
|
|
|
|
|
await DownloadWebFile( appId, details.filename, details.file_url );
|
|
|
|
|
}
|
|
|
|
|
else if ( details?.hcontent_file > 0 )
|
|
|
|
|
{
|
|
|
|
|
await DownloadAppAsync( appId, new List<Tuple<uint, ulong>>() { Tuple.Create( appId, details.hcontent_file ) }, DEFAULT_BRANCH, null, null, null, false, true );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine( "Unable to locate manifest ID for published file {0}", publishedFileId );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task DownloadUGCAsync( uint appId, ulong ugcId )
|
|
|
|
|
{
|
|
|
|
|
var details = steam3.GetUGCDetails( ugcId );
|
|
|
|
|
|
|
|
|
|
if ( !string.IsNullOrEmpty( details?.URL ) )
|
|
|
|
|
{
|
|
|
|
|
await DownloadWebFile( appId, details.FileName, details.URL );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
await DownloadAppAsync( appId, new List<Tuple<uint, ulong>>() { Tuple.Create( appId, ugcId ) }, DEFAULT_BRANCH, null, null, null, false, true );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static async Task DownloadWebFile( uint appId, string fileName, string url )
|
|
|
|
|
{
|
|
|
|
|
string installDir;
|
|
|
|
|
if ( !CreateDirectories( details.consumer_appid, (uint)details.revision_change_number, out installDir ) )
|
|
|
|
|
if ( !CreateDirectories( appId, 0, out installDir ) )
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine( "Error: Unable to create install directories!" );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var stagingDir = Path.Combine( installDir, STAGING_DIR );
|
|
|
|
|
var fileStagingPath = Path.Combine( stagingDir, details.filename );
|
|
|
|
|
var fileFinalPath = Path.Combine( installDir, details.filename );
|
|
|
|
|
var fileStagingPath = Path.Combine( stagingDir, fileName );
|
|
|
|
|
var fileFinalPath = Path.Combine( installDir, fileName );
|
|
|
|
|
|
|
|
|
|
Directory.CreateDirectory( Path.GetDirectoryName( fileFinalPath ) );
|
|
|
|
|
Directory.CreateDirectory( Path.GetDirectoryName( fileStagingPath ) );
|
|
|
|
@ -404,8 +432,8 @@ namespace DepotDownloader
|
|
|
|
|
using ( var file = File.OpenWrite( fileStagingPath ) )
|
|
|
|
|
using ( var client = new HttpClient() )
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine( "Downloading {0}", details.filename );
|
|
|
|
|
var responseStream = await client.GetStreamAsync( details.file_url );
|
|
|
|
|
Console.WriteLine( "Downloading {0}", fileName );
|
|
|
|
|
var responseStream = await client.GetStreamAsync( url );
|
|
|
|
|
await responseStream.CopyToAsync( file );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -416,15 +444,6 @@ namespace DepotDownloader
|
|
|
|
|
|
|
|
|
|
File.Move( fileStagingPath, fileFinalPath );
|
|
|
|
|
}
|
|
|
|
|
else if ( details?.hcontent_file > 0 )
|
|
|
|
|
{
|
|
|
|
|
await DownloadAppAsync( appId, new List<Tuple<uint, ulong>>() { Tuple.Create( appId, details.hcontent_file ) }, DEFAULT_BRANCH, null, null, null, false, true );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine( "Unable to locate manifest ID for published file {0}", publishedFileId );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static async Task DownloadAppAsync( uint appId, List<Tuple<uint, ulong>> depotManifestIds, string branch, string os, string arch, string language, bool lv, bool isUgc )
|
|
|
|
|
{
|
|
|
|
|