Add set download library methods

This commit is contained in:
Matt Nadareski
2026-03-01 11:37:14 -05:00
parent 02efdd4c22
commit 06e7ae184a
2 changed files with 60 additions and 3 deletions

View File

@@ -147,6 +147,35 @@ namespace SabreTools.RedumpLib.Web
return ids;
}
/// <summary>
/// Download the specified set of site disc pages
/// </summary>
/// <param name="client">RedumpClient for connectivity</param>
/// <param name="siteIds">Set of site IDs to download</param>
/// <param name="outDir">Output directory to save data to</param>
/// <param name="forceDownload">True to force all downloads, false otherwise</param>
/// <param name="forceContinue">Force continuation of download</param>
/// <returns>All disc IDs that successfully downloaded, empty on error</returns>
public static async Task<List<int>> DownloadSiteSet(this RedumpClient client,
List<int> siteIds,
string? outDir,
bool forceDownload,
bool forceContinue)
{
List<int> ids = [];
foreach (int id in siteIds)
{
bool downloaded = await client.DownloadSingleSiteID(id, outDir, rename: true, forceDownload, forceContinue);
if (downloaded)
{
ids.Add(id);
DelayHelper.DelayRandom();
}
}
return ids;
}
/// <summary>
/// Download the specified range of site disc pages
/// </summary>
@@ -156,7 +185,7 @@ namespace SabreTools.RedumpLib.Web
/// <param name="forceContinue">Force continuation of download</param>
/// <param name="minId">Starting ID for the range</param>
/// <param name="maxId">Ending ID for the range (inclusive)</param>
/// <returns>All disc IDs in last modified range, empty on error</returns>
/// <returns>All disc IDs that successfully downloaded, empty on error</returns>
public static async Task<List<int>> DownloadSiteRange(this RedumpClient client,
string? outDir,
bool forceDownload,

View File

@@ -22,6 +22,30 @@ namespace SabreTools.RedumpLib.Web
return await client.CheckSingleWIPPage(Constants.WipDumpsUrl, outDir, forceDownload, forceContinue) ?? [];
}
/// <summary>
/// Download the specified range of WIP disc pages
/// </summary>
/// <param name="client">RedumpClient for connectivity</param>
/// <param name="wipIds">Set of WIP IDs to download</param>
/// <param name="outDir">Output directory to save data to</param>
/// <param name="forceDownload">True to force all downloads, false otherwise</param>
/// <returns>All WIP IDs in last submitted range, empty on error</returns>
public static async Task<List<int>> DownloadWIPSet(this RedumpClient client, List<int> wipIds, string? outDir, bool forceDownload)
{
List<int> ids = [];
foreach (int id in wipIds)
{
bool downloaded = await client.DownloadSingleWIPID(id, outDir, rename: true, forceDownload);
if (downloaded)
{
ids.Add(id);
DelayHelper.DelayRandom();
}
}
return ids;
}
/// <summary>
/// Download the specified range of WIP disc pages
/// </summary>
@@ -30,8 +54,12 @@ namespace SabreTools.RedumpLib.Web
/// <param name="forceDownload">True to force all downloads, false otherwise</param>
/// <param name="minId">Starting ID for the range</param>
/// <param name="maxId">Ending ID for the range (inclusive)</param>
/// <returns>All disc IDs in last submitted range, empty on error</returns>
public static async Task<List<int>> DownloadWIPRange(this RedumpClient client, string? outDir, bool forceDownload, int minId = 0, int maxId = 0)
/// <returns>All WIP IDs that successfully downloaded, empty on error</returns>
public static async Task<List<int>> DownloadWIPRange(this RedumpClient client,
string? outDir,
bool forceDownload,
int minId = 0,
int maxId = 0)
{
List<int> ids = [];
for (int id = minId; id <= maxId; id++)