mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-09-22 06:54:32 +00:00
Retry count can now be set externally
This commit is contained in:
@@ -36,7 +36,12 @@ namespace SabreTools.RedumpLib.Web
|
||||
/// <summary>
|
||||
/// Maximum retry count for any operation
|
||||
/// </summary>
|
||||
public int RetryCount { get; }
|
||||
/// <remarks>Value has to be greater than 0</remarks>
|
||||
public int RetryCount
|
||||
{
|
||||
get;
|
||||
set { field = value < 0 ? 3 : value; }
|
||||
} = 3;
|
||||
|
||||
/// <summary>
|
||||
/// Internal client for interaction
|
||||
@@ -52,18 +57,12 @@ namespace SabreTools.RedumpLib.Web
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public RedumpClient(int timeoutSeconds = 30, int retryCount = 3)
|
||||
public RedumpClient(int timeoutSeconds = 30)
|
||||
{
|
||||
// Ensure there are a positive number of retries
|
||||
if (retryCount <= 0)
|
||||
retryCount = 3;
|
||||
|
||||
// Ensure a positive timespan
|
||||
if (timeoutSeconds <= 0)
|
||||
timeoutSeconds = 30;
|
||||
|
||||
RetryCount = retryCount;
|
||||
|
||||
#if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
|
||||
_internalClient = new CookieWebClient() { Timeout = TimeSpan.FromSeconds(timeoutSeconds) };
|
||||
#else
|
||||
@@ -74,18 +73,12 @@ namespace SabreTools.RedumpLib.Web
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
public RedumpClient(TimeSpan timeout, int retryCount = 3)
|
||||
public RedumpClient(TimeSpan timeout)
|
||||
{
|
||||
// Ensure there are a positive number of retries
|
||||
if (retryCount <= 0)
|
||||
retryCount = 3;
|
||||
|
||||
// Ensure a positive timespan
|
||||
if (timeout <= TimeSpan.Zero)
|
||||
timeout = TimeSpan.FromSeconds(30);
|
||||
|
||||
RetryCount = retryCount;
|
||||
|
||||
#if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
|
||||
_internalClient = new CookieWebClient() { Timeout = timeout };
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user