mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-07-08 18:16:25 +00:00
Simplify web client class names
This commit is contained in:
@@ -121,14 +121,14 @@ namespace RedumpTool.Features
|
||||
/// <summary>
|
||||
/// Client to use for external connections
|
||||
/// </summary>
|
||||
protected RedumpClient _client;
|
||||
protected Client _client;
|
||||
|
||||
#endregion
|
||||
|
||||
public BaseFeature(string name, string[] flags, string description, string? detailed = null)
|
||||
: base(name, flags, description, detailed)
|
||||
{
|
||||
_client = new RedumpClient();
|
||||
_client = new Client();
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace SabreTools.RedumpLib
|
||||
/// <param name="info">Existing SubmissionInfo object to fill</param>
|
||||
/// <param name="id">Redump disc ID to retrieve</param>
|
||||
/// <param name="includeAllData">True to include all pullable information, false to do bare minimum</param>
|
||||
public static async Task<bool> FillFromId(RedumpClient client, SubmissionInfo info, int id, bool includeAllData)
|
||||
public static async Task<bool> FillFromId(Client client, SubmissionInfo info, int id, bool includeAllData)
|
||||
{
|
||||
var discData = await client.DownloadSingleSiteID(id);
|
||||
if (string.IsNullOrEmpty(discData))
|
||||
|
||||
@@ -16,7 +16,7 @@ using static SabreTools.RedumpLib.RedumpOrg.Data.Extensions;
|
||||
namespace SabreTools.RedumpLib.RedumpInfo
|
||||
{
|
||||
// TODO: Nearly every method here needs to be validated
|
||||
public class RedumpClient
|
||||
public class Client
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public RedumpClient()
|
||||
public Client()
|
||||
{
|
||||
#if NETCOREAPP
|
||||
_internalClient = new HttpClient(new HttpClientHandler { UseCookies = true });
|
||||
@@ -126,7 +126,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
return false;
|
||||
|
||||
// Try logging in with the supplied credentials otherwise
|
||||
var redumpClient = new RedumpClient();
|
||||
var redumpClient = new Client();
|
||||
return await redumpClient.Login(username, password);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
/// <param name="limit">Limit number of retrieved result pages, non-positive for unlimited</param>
|
||||
/// <param name="discSubpaths">Set of subpaths to download if available, null for all</param>
|
||||
/// <returns>All disc IDs for the given query, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadDiscsResults(this RedumpClient client,
|
||||
public static async Task<List<int>> DownloadDiscsResults(this Client client,
|
||||
string? outDir,
|
||||
string? comments,
|
||||
string? dumper = null,
|
||||
@@ -91,7 +91,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
/// <param name="maxId">Ending ID for the range (inclusive)</param>
|
||||
/// <param name="discSubpaths">Set of subpaths to download if available, null for all</param>
|
||||
/// <returns>All disc IDs that successfully downloaded, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadSiteRange(this RedumpClient client,
|
||||
public static async Task<List<int>> DownloadSiteRange(this Client client,
|
||||
string? outDir,
|
||||
int minId,
|
||||
int maxId,
|
||||
@@ -119,7 +119,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
/// <param name="discSubpaths">Set of subpaths to download if available, null for all</param>
|
||||
/// <returns>All disc IDs that successfully downloaded, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadSiteSet(this RedumpClient client,
|
||||
public static async Task<List<int>> DownloadSiteSet(this Client client,
|
||||
List<int> siteIds,
|
||||
string? outDir,
|
||||
DiscSubpath[]? discSubpaths = null)
|
||||
@@ -154,7 +154,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
/// <param name="comments">Marks search as comments field only, false to omit; incompatible with <paramref name="contents"/> or <paramref name="protection"/></param>
|
||||
/// <param name="limit">Limit number of retrieved result pages, non-positive for unlimited</param>
|
||||
/// <returns>All disc IDs for the given query, empty on error</returns>
|
||||
public static async Task<List<int>> ListDiscsResults(this RedumpClient client,
|
||||
public static async Task<List<int>> ListDiscsResults(this Client client,
|
||||
string? comments = null,
|
||||
string? dumper = null,
|
||||
string? edition = null,
|
||||
|
||||
@@ -14,7 +14,7 @@ using SabreTools.RedumpLib.Web;
|
||||
|
||||
namespace SabreTools.RedumpLib.RedumpOrg
|
||||
{
|
||||
public class RedumpClient
|
||||
public class Client
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public RedumpClient()
|
||||
public Client()
|
||||
{
|
||||
#if NETCOREAPP
|
||||
_internalClient = new HttpClient(new HttpClientHandler { UseCookies = true });
|
||||
@@ -123,7 +123,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
return false;
|
||||
|
||||
// Try logging in with the supplied credentials otherwise
|
||||
var redumpClient = new RedumpClient();
|
||||
var redumpClient = new Client();
|
||||
return await redumpClient.Login(username, password);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="limit">Limit number of retrieved result pages, non-positive for unlimited</param>
|
||||
/// <param name="discSubpaths">Set of subpaths to download if available, null for all</param>
|
||||
/// <returns>All disc IDs for the given query, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadDiscsResults(this RedumpClient client,
|
||||
public static async Task<List<int>> DownloadDiscsResults(this Client client,
|
||||
string? outDir,
|
||||
bool? antimodchip = null,
|
||||
bool barcode = false,
|
||||
@@ -136,7 +136,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="maxId">Ending ID for the range (inclusive)</param>
|
||||
/// <param name="discSubpaths">Set of subpaths to download if available, null for all</param>
|
||||
/// <returns>All disc IDs that successfully downloaded, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadSiteRange(this RedumpClient client,
|
||||
public static async Task<List<int>> DownloadSiteRange(this Client client,
|
||||
string? outDir,
|
||||
int minId,
|
||||
int maxId,
|
||||
@@ -164,7 +164,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
/// <param name="discSubpaths">Set of subpaths to download if available, null for all</param>
|
||||
/// <returns>All disc IDs that successfully downloaded, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadSiteSet(this RedumpClient client,
|
||||
public static async Task<List<int>> DownloadSiteSet(this Client client,
|
||||
List<int> siteIds,
|
||||
string? outDir,
|
||||
DiscSubpath[]? discSubpaths = null)
|
||||
@@ -213,7 +213,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="protection">Marks search as protection field only, false to omit; incompatible with <paramref name="comments"/> or <paramref name="contents"/></param>
|
||||
/// <param name="limit">Limit number of retrieved result pages, non-positive for unlimited</param>
|
||||
/// <returns>All disc IDs for the given query, empty on error</returns>
|
||||
public static async Task<List<int>> ListDiscsResults(this RedumpClient client,
|
||||
public static async Task<List<int>> ListDiscsResults(this Client client,
|
||||
bool? antimodchip = null,
|
||||
bool barcode = false,
|
||||
DiscCategory? category = null,
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="client">RedumpClient for connectivity</param>
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
/// <param name="useSubfolders">True to use named subfolders to store downloads, false to store directly in the output directory</param>
|
||||
public static async Task<bool> DownloadAllPacks(this RedumpClient client, string? outDir, bool useSubfolders)
|
||||
public static async Task<bool> DownloadAllPacks(this Client client, string? outDir, bool useSubfolders)
|
||||
{
|
||||
var systems = (RedumpSystem[])Enum.GetValues(typeof(RedumpSystem));
|
||||
return await client.DownloadPacksForSystems(systems, outDir, useSubfolders);
|
||||
@@ -28,7 +28,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="system">RedumpSystem to get all possible packs for</param>
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
/// <param name="useSubfolders">True to use named subfolders to store downloads, false to store directly in the output directory</param>
|
||||
public static async Task<bool> DownloadPacksForSystem(this RedumpClient client,
|
||||
public static async Task<bool> DownloadPacksForSystem(this Client client,
|
||||
RedumpSystem? system,
|
||||
string? outDir,
|
||||
bool useSubfolders)
|
||||
@@ -47,7 +47,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="systems">Systems to download packs for</param>
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
/// <param name="useSubfolders">True to use named subfolders to store downloads, false to store directly in the output directory</param>
|
||||
public static async Task<bool> DownloadPacksForSystems(this RedumpClient client,
|
||||
public static async Task<bool> DownloadPacksForSystems(this Client client,
|
||||
RedumpSystem[] systems,
|
||||
string? outDir,
|
||||
bool useSubfolders)
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="client">RedumpClient for connectivity</param>
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
/// <returns>All disc IDs in last submitted range, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadLastSubmitted(this RedumpClient client, string? outDir)
|
||||
public static async Task<List<int>> DownloadLastSubmitted(this Client client, string? outDir)
|
||||
{
|
||||
return await client.CheckSingleWIPPage(outDir) ?? [];
|
||||
}
|
||||
@@ -27,7 +27,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="wipIds">Set of WIP IDs to download</param>
|
||||
/// <param name="outDir">Output directory to save data to</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)
|
||||
public static async Task<List<int>> DownloadWIPSet(this Client client, List<int> wipIds, string? outDir)
|
||||
{
|
||||
List<int> ids = [];
|
||||
foreach (int id in wipIds)
|
||||
@@ -51,7 +51,7 @@ namespace SabreTools.RedumpLib.RedumpOrg
|
||||
/// <param name="minId">Starting ID for the range</param>
|
||||
/// <param name="maxId">Ending ID for the range (inclusive)</param>
|
||||
/// <returns>All WIP IDs that successfully downloaded, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadWIPRange(this RedumpClient client, string? outDir, int minId, int maxId)
|
||||
public static async Task<List<int>> DownloadWIPRange(this Client client, string? outDir, int minId, int maxId)
|
||||
{
|
||||
List<int> ids = [];
|
||||
for (int id = minId; id <= maxId; id++)
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace SabreTools.RedumpLib
|
||||
/// <param name="info">Existing SubmissionInfo object to fill</param>
|
||||
/// <param name="sha1">SHA-1 hash to check against</param>
|
||||
/// <returns>List of found values, if possible</returns>
|
||||
public static async Task<List<int>?> ValidateSingleTrack(RedumpClient client, SubmissionInfo info, string? sha1)
|
||||
public static async Task<List<int>?> ValidateSingleTrack(Client client, SubmissionInfo info, string? sha1)
|
||||
{
|
||||
// Get all matching IDs for the track
|
||||
var newIds = await client.ListDiscsResults(quicksearch: sha1);
|
||||
@@ -115,7 +115,7 @@ namespace SabreTools.RedumpLib
|
||||
/// <param name="client">RedumpClient for making the connection</param>
|
||||
/// <param name="info">Existing SubmissionInfo object to fill</param>
|
||||
/// <returns>List of found values, if possible</returns>
|
||||
public static async Task<List<int>?> ValidateUniversalHash(RedumpClient client, SubmissionInfo info)
|
||||
public static async Task<List<int>?> ValidateUniversalHash(Client client, SubmissionInfo info)
|
||||
{
|
||||
// If we don't have special fields
|
||||
if (info.CommonDiscInfo.CommentsSpecialFields is null)
|
||||
@@ -160,7 +160,7 @@ namespace SabreTools.RedumpLib
|
||||
/// <param name="id">Redump disc ID to retrieve</param>
|
||||
/// <param name="localCount">Local count of tracks for the current disc</param>
|
||||
/// <returns>True if the track count matches, false otherwise</returns>
|
||||
public static async Task<bool> ValidateTrackCount(RedumpClient client, int id, int localCount)
|
||||
public static async Task<bool> ValidateTrackCount(Client client, int id, int localCount)
|
||||
{
|
||||
// If we can't pull the remote data, we can't match
|
||||
string? discData = await client.DownloadSingleSiteID(id);
|
||||
|
||||
Reference in New Issue
Block a user