diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 967cc499..5d755b71 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -337,19 +337,54 @@ namespace DepotDownloader public static async Task DownloadPubfileAsync(uint appId, ulong publishedFileId) { - var details = await steam3.GetPublishedFileDetails(appId, publishedFileId); + List> fileUrls = new(); + List contentFileIds = new(); - if (!string.IsNullOrEmpty(details?.file_url)) + var details = await steam3.GetPublishedFileDetails(appId, publishedFileId); + if (details.file_type == (uint)EWorkshopFileType.Collection) { - await DownloadWebFile(appId, details.filename, details.file_url); + foreach (var child in details.children) + { + var childDetails = await steam3.GetPublishedFileDetails(appId, child.publishedfileid); + if (!string.IsNullOrEmpty(childDetails?.file_url)) + { + fileUrls.Add((childDetails.filename, childDetails.file_url)); + } + else if (details?.hcontent_file > 0) + { + contentFileIds.Add(childDetails.hcontent_file); + } + else + { + Console.WriteLine("Unable to locate manifest ID for published file {0} in collection {1}", childDetails.publishedfileid, publishedFileId); + } + } } - else if (details?.hcontent_file > 0) + else { - await DownloadAppAsync(appId, new List<(uint, ulong)> { (appId, details.hcontent_file) }, DEFAULT_BRANCH, null, null, null, false, true); + if (!string.IsNullOrEmpty(details?.file_url)) + { + fileUrls.Add((details.filename, details.file_url)); + } + else if (details?.hcontent_file > 0) + { + contentFileIds.Add(details.hcontent_file); + } + else + { + Console.WriteLine("Unable to locate manifest ID for published file {0}", publishedFileId); + } } - else + + foreach (var item in fileUrls) + { + await DownloadWebFile(appId, item.Item1, item.Item2); + } + + if (contentFileIds.Count > 0) { - Console.WriteLine("Unable to locate manifest ID for published file {0}", publishedFileId); + var depotManifestIds = contentFileIds.Select(id => (appId, id)).ToList(); + await DownloadAppAsync(appId, depotManifestIds, DEFAULT_BRANCH, null, null, null, false, true); } } diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index 0b9f8555..bff4f3ca 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -333,7 +333,11 @@ namespace DepotDownloader public async Task GetPublishedFileDetails(uint appId, PublishedFileID pubFile) { - var pubFileRequest = new CPublishedFile_GetDetails_Request { appid = appId }; + var pubFileRequest = new CPublishedFile_GetDetails_Request + { + appid = appId, + includechildren = true, + }; pubFileRequest.publishedfileids.Add(pubFile); var details = await steamPublishedFile.GetDetails(pubFileRequest);