diff --git a/RedumpTool/Features/BaseFeature.cs b/RedumpTool/Features/BaseFeature.cs index c9bac57..1e60730 100644 --- a/RedumpTool/Features/BaseFeature.cs +++ b/RedumpTool/Features/BaseFeature.cs @@ -20,8 +20,8 @@ namespace RedumpTool.Features private const string _passwordName = "password"; internal readonly StringInput PasswordInput = new(_passwordName, ["-p", "--password"], "Redump password"); - private const string _retryCountName = "retrycount"; - internal readonly Int32Input RetryCountInput = new(_retryCountName, ["-r", "--retries"], "Number of attempts for web requests"); + private const string _attemptCountName = "attemptcount"; + internal readonly Int32Input AttemptCountInput = new(_attemptCountName, ["-a", "--attempts"], "Number of attempts for web requests"); private const string _usernameName = "username"; internal readonly StringInput UsernameInput = new(_usernameName, ["-u", "--username"], "Redump username"); diff --git a/RedumpTool/Features/PacksFeature.cs b/RedumpTool/Features/PacksFeature.cs index 5cbc7e2..05d0650 100644 --- a/RedumpTool/Features/PacksFeature.cs +++ b/RedumpTool/Features/PacksFeature.cs @@ -32,7 +32,7 @@ namespace RedumpTool.Features Add(OutputInput); Add(UsernameInput); Add(PasswordInput); - Add(RetryCountInput); + Add(AttemptCountInput); // Specific Add(SubfoldersInput); @@ -43,7 +43,7 @@ namespace RedumpTool.Features { // Get values needed more than once string? outputDirectory = OutputInput.Value; - int? retryCount = RetryCountInput.Value; + int? attemptCount = AttemptCountInput.Value; // Output directory validation if (!ValidateAndCreateOutputDirectory(outputDirectory)) @@ -55,8 +55,8 @@ namespace RedumpTool.Features // Update client properties _client.Debug = DebugInput.Value; - if (retryCount != null && retryCount > 0) - _client.RetryCount = retryCount.Value; + if (attemptCount != null && attemptCount > 0) + _client.AttemptCount = attemptCount.Value; // Start the processing var processingTask = _client.DownloadPacks(outputDirectory, SubfoldersInput.Value); diff --git a/RedumpTool/Features/QueryFeature.cs b/RedumpTool/Features/QueryFeature.cs index 2349d1c..590d0c8 100644 --- a/RedumpTool/Features/QueryFeature.cs +++ b/RedumpTool/Features/QueryFeature.cs @@ -41,7 +41,7 @@ namespace RedumpTool.Features Add(OutputInput); Add(UsernameInput); Add(PasswordInput); - Add(RetryCountInput); + Add(AttemptCountInput); // Specific Add(QueryInput); @@ -56,7 +56,7 @@ namespace RedumpTool.Features bool onlyList = ListInput.Value; string? outputDirectory = OutputInput.Value; string? queryString = QueryInput.Value; - int? retryCount = RetryCountInput.Value; + int? attemptCount = AttemptCountInput.Value; // Output directory validation if (!onlyList && !ValidateAndCreateOutputDirectory(outputDirectory)) @@ -75,8 +75,8 @@ namespace RedumpTool.Features // Update client properties _client.Debug = DebugInput.Value; - if (retryCount != null && retryCount > 0) - _client.RetryCount = retryCount.Value; + if (attemptCount != null && attemptCount > 0) + _client.AttemptCount = attemptCount.Value; // Start the processing Task> processingTask; diff --git a/RedumpTool/Features/SiteFeature.cs b/RedumpTool/Features/SiteFeature.cs index 8d203b6..c0f9bcf 100644 --- a/RedumpTool/Features/SiteFeature.cs +++ b/RedumpTool/Features/SiteFeature.cs @@ -44,7 +44,7 @@ namespace RedumpTool.Features Add(OutputInput); Add(UsernameInput); Add(PasswordInput); - Add(RetryCountInput); + Add(AttemptCountInput); // Specific Add(MinimumInput); @@ -61,7 +61,7 @@ namespace RedumpTool.Features int minId = MinimumInput.Value ?? -1; int maxId = MaximumInput.Value ?? -1; bool onlyNew = OnlyNewInput.Value; - int? retryCount = RetryCountInput.Value; + int? attemptCount = AttemptCountInput.Value; // Output directory validation if (!ValidateAndCreateOutputDirectory(outputDirectory)) @@ -80,8 +80,8 @@ namespace RedumpTool.Features // Update client properties _client.Debug = DebugInput.Value; - if (retryCount != null && retryCount > 0) - _client.RetryCount = retryCount.Value; + if (attemptCount != null && attemptCount > 0) + _client.AttemptCount = attemptCount.Value; // Start the processing Task> processingTask; diff --git a/RedumpTool/Features/UserFeature.cs b/RedumpTool/Features/UserFeature.cs index d448e71..8121036 100644 --- a/RedumpTool/Features/UserFeature.cs +++ b/RedumpTool/Features/UserFeature.cs @@ -37,7 +37,7 @@ namespace RedumpTool.Features Add(OutputInput); Add(UsernameInput); Add(PasswordInput); - Add(RetryCountInput); + Add(AttemptCountInput); // Specific Add(OnlyNewInput); @@ -50,7 +50,7 @@ namespace RedumpTool.Features // Get values needed more than once bool onlyList = ListInput.Value; string? outputDirectory = OutputInput.Value; - int? retryCount = RetryCountInput.Value; + int? attemptCount = AttemptCountInput.Value; // Output directory validation if (!onlyList && !ValidateAndCreateOutputDirectory(outputDirectory)) @@ -62,8 +62,8 @@ namespace RedumpTool.Features // Update client properties _client.Debug = DebugInput.Value; - if (retryCount != null && retryCount > 0) - _client.RetryCount = retryCount.Value; + if (attemptCount != null && attemptCount > 0) + _client.AttemptCount = attemptCount.Value; // Start the processing Task> processingTask; diff --git a/RedumpTool/Features/WIPFeature.cs b/RedumpTool/Features/WIPFeature.cs index 6b05b0e..dced8b2 100644 --- a/RedumpTool/Features/WIPFeature.cs +++ b/RedumpTool/Features/WIPFeature.cs @@ -41,7 +41,7 @@ namespace RedumpTool.Features Add(OutputInput); Add(UsernameInput); Add(PasswordInput); - Add(RetryCountInput); + Add(AttemptCountInput); // Specific Add(MinimumInput); @@ -57,7 +57,7 @@ namespace RedumpTool.Features int minId = MinimumInput.Value ?? -1; int maxId = MaximumInput.Value ?? -1; bool onlyNew = OnlyNewInput.Value; - int? retryCount = RetryCountInput.Value; + int? attemptCount = AttemptCountInput.Value; // Output directory validation if (!ValidateAndCreateOutputDirectory(outputDirectory)) @@ -76,8 +76,8 @@ namespace RedumpTool.Features // Update client properties _client.Debug = DebugInput.Value; - if (retryCount != null && retryCount > 0) - _client.RetryCount = retryCount.Value; + if (attemptCount != null && attemptCount > 0) + _client.AttemptCount = attemptCount.Value; // Start the processing Task> processingTask; diff --git a/RedumpTool/Program.cs b/RedumpTool/Program.cs index 0f8d7c0..3736db7 100644 --- a/RedumpTool/Program.cs +++ b/RedumpTool/Program.cs @@ -72,7 +72,7 @@ namespace RedumpTool Console.WriteLine(" -o , --output - Set the base output directory"); Console.WriteLine(" -u , --username - Redump username"); Console.WriteLine(" -p , --password - Redump password"); - Console.WriteLine(" -r , --retries - Number of attempts for web requests"); + Console.WriteLine(" -a , --attempts - Number of attempts for web requests"); Console.WriteLine(); Console.WriteLine("site - Download pages and related files from the main site"); Console.WriteLine(" -min , --minimum - Lower bound for page numbers (cannot be used with only new)"); diff --git a/SabreTools.RedumpLib/Web/RedumpClient.cs b/SabreTools.RedumpLib/Web/RedumpClient.cs index a2fff77..7323e98 100644 --- a/SabreTools.RedumpLib/Web/RedumpClient.cs +++ b/SabreTools.RedumpLib/Web/RedumpClient.cs @@ -34,10 +34,10 @@ namespace SabreTools.RedumpLib.Web public bool Debug { get; set; } = false; /// - /// Maximum retry count for any operation + /// Maximum attempt count for any operation /// /// Value has to be greater than 0 - public int RetryCount + public int AttemptCount { get; set { field = value < 0 ? 3 : value; } @@ -141,11 +141,11 @@ namespace SabreTools.RedumpLib.Web #endif // Attempt to login up as many times as the retry count allows - for (int i = 0; i < RetryCount; i++) + for (int i = 0; i < AttemptCount; i++) { try { - Console.WriteLine($"Login attempt {i + 1} of {RetryCount}"); + Console.WriteLine($"Login attempt {i + 1} of {AttemptCount}"); // Get the current token from the login page var loginPage = await DownloadString(Constants.LoginUrl); @@ -200,7 +200,7 @@ namespace SabreTools.RedumpLib.Web } } - Console.Error.WriteLine($"Could not login to Redump in {RetryCount} attempts, continuing without logging in..."); + Console.Error.WriteLine($"Could not login to Redump in {AttemptCount} attempts, continuing without logging in..."); return false; } @@ -216,14 +216,14 @@ namespace SabreTools.RedumpLib.Web public async Task DownloadData(string uri) { // Only retry a positive number of times - if (RetryCount <= 0) + if (AttemptCount <= 0) return null; - for (int i = 0; i < RetryCount; i++) + for (int i = 0; i < AttemptCount; i++) { try { - if (Debug) Console.WriteLine($"DEBUG: DownloadData(\"{uri}\"), Attempt {i + 1} of {RetryCount}"); + if (Debug) Console.WriteLine($"DEBUG: DownloadData(\"{uri}\"), Attempt {i + 1} of {AttemptCount}"); #if NET40 return await Task.Factory.StartNew(() => _internalClient.DownloadData(uri)); #elif NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER @@ -284,14 +284,14 @@ namespace SabreTools.RedumpLib.Web public async Task DownloadString(string uri) { // Only retry a positive number of times - if (RetryCount <= 0) + if (AttemptCount <= 0) return null; - for (int i = 0; i < RetryCount; i++) + for (int i = 0; i < AttemptCount; i++) { try { - if (Debug) Console.WriteLine($"DEBUG: DownloadString(\"{uri}\"), Attempt {i + 1} of {RetryCount}"); + if (Debug) Console.WriteLine($"DEBUG: DownloadString(\"{uri}\"), Attempt {i + 1} of {AttemptCount}"); #if NET40 return await Task.Factory.StartNew(() => _internalClient.DownloadString(uri)); #elif NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER