mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-02-09 21:35:07 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9fbaf1a187 | ||
|
|
fe8686a2bb |
@@ -51,6 +51,11 @@ namespace SabreTools.RedumpLib
|
||||
/// </summary>
|
||||
public bool OnlyList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Don't replace forward slashes with `-` in queries
|
||||
/// </summary>
|
||||
public bool NoSlash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Force continuing downloads until user cancels or pages run out
|
||||
/// </summary>
|
||||
@@ -131,9 +136,9 @@ namespace SabreTools.RedumpLib
|
||||
break;
|
||||
case Feature.Quicksearch:
|
||||
if (OnlyList)
|
||||
await Search.ListSearchResults(_client, QueryString);
|
||||
await Search.ListSearchResults(_client, QueryString, NoSlash);
|
||||
else
|
||||
await Search.DownloadSearchResults(_client, QueryString, OutDir);
|
||||
await Search.DownloadSearchResults(_client, QueryString, OutDir, NoSlash);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.4.2</Version>
|
||||
<Version>1.4.3</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
|
||||
@@ -15,8 +15,9 @@ namespace SabreTools.RedumpLib.Web
|
||||
/// </summary>
|
||||
/// <param name="rc">RedumpClient for connectivity</param>
|
||||
/// <param name="query">Query string to attempt to search for</param>
|
||||
/// <param name="noSlash">Don't replace slashes with `-` in queries</param>
|
||||
/// <returns>All disc IDs for the given query, null on error</returns>
|
||||
public static async Task<List<int>?> ListSearchResults(RedumpClient rc, string? query)
|
||||
public static async Task<List<int>?> ListSearchResults(RedumpClient rc, string? query, bool noSlash)
|
||||
{
|
||||
// If the query is invalid
|
||||
if (string.IsNullOrEmpty(query))
|
||||
@@ -29,8 +30,9 @@ namespace SabreTools.RedumpLib.Web
|
||||
|
||||
// Special characters become dashes
|
||||
query = query.Replace(' ', '-');
|
||||
query = query.Replace('/', '-');
|
||||
query = query.Replace('\\', '/');
|
||||
query = query.Replace('\\', '-');
|
||||
if (!noSlash)
|
||||
query = query.Replace('/', '-');
|
||||
|
||||
// Lowercase is defined per language
|
||||
query = query.ToLowerInvariant();
|
||||
@@ -62,7 +64,8 @@ namespace SabreTools.RedumpLib.Web
|
||||
/// <param name="rc">RedumpClient for connectivity</param>
|
||||
/// <param name="query">Query string to attempt to search for</param>
|
||||
/// <param name="outDir">Output directory to save data to</param>
|
||||
public static async Task<bool> DownloadSearchResults(RedumpClient rc, string? query, string? outDir)
|
||||
/// <param name="noSlash">Don't replace slashes with `-` in queries</param>
|
||||
public static async Task<bool> DownloadSearchResults(RedumpClient rc, string? query, string? outDir, bool noSlash)
|
||||
{
|
||||
// If the query is invalid
|
||||
if (string.IsNullOrEmpty(query))
|
||||
@@ -73,8 +76,9 @@ namespace SabreTools.RedumpLib.Web
|
||||
|
||||
// Special characters become dashes
|
||||
query = query.Replace(' ', '-');
|
||||
query = query.Replace('/', '-');
|
||||
query = query.Replace('\\', '/');
|
||||
query = query.Replace('\\', '-');
|
||||
if (!noSlash)
|
||||
query = query.Replace('/', '-');
|
||||
|
||||
// Lowercase is defined per language
|
||||
query = query.ToLowerInvariant();
|
||||
|
||||
Reference in New Issue
Block a user