Compare commits

...

2 Commits
1.4.2 ... 1.4.3

Author SHA1 Message Date
Matt Nadareski
9fbaf1a187 Bump version 2024-10-04 01:42:58 -04:00
Matt Nadareski
fe8686a2bb Allow forward slashes in queries sometimes 2024-10-04 01:41:05 -04:00
3 changed files with 18 additions and 9 deletions

View File

@@ -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;

View File

@@ -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>

View File

@@ -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();