diff --git a/SabreTools.RedumpLib/Web/Search.cs b/SabreTools.RedumpLib/Web/Search.cs
index fac6b9b..f8a21de 100644
--- a/SabreTools.RedumpLib/Web/Search.cs
+++ b/SabreTools.RedumpLib/Web/Search.cs
@@ -9,54 +9,6 @@ namespace SabreTools.RedumpLib.Web
///
public static class Search
{
- ///
- /// List the disc IDs associated with a given quicksearch query
- ///
- /// RedumpClient for connectivity
- /// Query string to attempt to search for
- /// Replace forward slashes with `-` in queries
- /// Limit number of retrieved result pages, non-positive for unlimited
- /// All disc IDs for the given query, empty on error
- public static async Task> ListSearchResults(this RedumpClient client,
- string? query,
- bool convertForwardSlashes,
- int limit = -1)
- {
- // If the query is invalid
- if (string.IsNullOrEmpty(query))
- return [];
-
- // Keep getting quicksearch pages until there are none left
- List ids = [];
- try
- {
- int pageNumber = 1;
- while (true)
- {
- if (limit > 0 && pageNumber >= limit)
- break;
-
- // Convert forward slashes implies a strict query
- var pageIds = convertForwardSlashes
- ? await client.CheckSingleDiscsPage(quicksearch: query, page: pageNumber++)
- : await client.CheckSingleQuicksearchPage(query!, pageNumber++);
- if (pageIds is null)
- return [];
-
- ids.AddRange(pageIds);
- if (pageIds.Count <= 1)
- break;
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine($"An exception occurred while trying to log in: {ex}");
- return [];
- }
-
- return ids;
- }
-
///
/// Download the disc pages associated with a given quicksearch query
///
@@ -106,5 +58,53 @@ namespace SabreTools.RedumpLib.Web
return ids;
}
+
+ ///
+ /// List the disc IDs associated with a given quicksearch query
+ ///
+ /// RedumpClient for connectivity
+ /// Query string to attempt to search for
+ /// Replace forward slashes with `-` in queries
+ /// Limit number of retrieved result pages, non-positive for unlimited
+ /// All disc IDs for the given query, empty on error
+ public static async Task> ListSearchResults(this RedumpClient client,
+ string? query,
+ bool convertForwardSlashes,
+ int limit = -1)
+ {
+ // If the query is invalid
+ if (string.IsNullOrEmpty(query))
+ return [];
+
+ // Keep getting quicksearch pages until there are none left
+ List ids = [];
+ try
+ {
+ int pageNumber = 1;
+ while (true)
+ {
+ if (limit > 0 && pageNumber >= limit)
+ break;
+
+ // Convert forward slashes implies a strict query
+ var pageIds = convertForwardSlashes
+ ? await client.CheckSingleDiscsPage(quicksearch: query, page: pageNumber++)
+ : await client.CheckSingleQuicksearchPage(query!, pageNumber++);
+ if (pageIds is null)
+ return [];
+
+ ids.AddRange(pageIds);
+ if (pageIds.Count <= 1)
+ break;
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"An exception occurred while trying to log in: {ex}");
+ return [];
+ }
+
+ return ids;
+ }
}
}