@@ -31,41 +31,45 @@ public class RedumpClient
3131 /// <summary>
3232 /// Maximum retry count for any operation
3333 /// </summary>
34- public int RetryCount { get ; private set ; } = 3 ;
34+ public int RetryCount { get ; }
3535
3636 /// <summary>
37- /// Internal client for interaction
37+ /// Maximum number of seconds for a retry
3838 /// </summary>
39- #if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
40- private CookieWebClient _internalClient ;
41- #else
42- private HttpClient _internalClient ;
43- #endif
44-
45- #endregion
39+ public int TimeoutSeconds { get ; }
4640
4741 /// <summary>
48- /// Constructor
42+ /// Internal client for interaction
4943 /// </summary>
50- public RedumpClient ( )
51- {
5244#if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
53- _internalClient = new CookieWebClient ( ) ;
45+ private readonly CookieWebClient _internalClient ;
5446#else
55- _internalClient = new HttpClient ( new HttpClientHandler { UseCookies = true } ) { Timeout = TimeSpan . FromSeconds ( 30 ) } ;
47+ private readonly HttpClient _internalClient ;
5648#endif
57- }
49+
50+ #endregion
5851
5952 /// <summary>
6053 /// Constructor
6154 /// </summary>
62- public RedumpClient ( int retryCount ) : this ( )
55+ public RedumpClient ( int retryCount = 3 , int timeoutSeconds = 30 )
6356 {
6457 // Ensure there are a positive number of retries
6558 if ( retryCount <= 0 )
6659 retryCount = 3 ;
6760
61+ // Ensure a positive timespan
62+ if ( timeoutSeconds <= 0 )
63+ timeoutSeconds = 30 ;
64+
6865 RetryCount = retryCount ;
66+ TimeoutSeconds = timeoutSeconds ;
67+
68+ #if NETFRAMEWORK || NETSTANDARD2_0_OR_GREATER
69+ _internalClient = new CookieWebClient ( ) { Timeout = TimeSpan . FromSeconds ( TimeoutSeconds ) } ;
70+ #else
71+ _internalClient = new HttpClient ( new HttpClientHandler { UseCookies = true } ) { Timeout = TimeSpan . FromSeconds ( TimeoutSeconds ) } ;
72+ #endif
6973 }
7074
7175 #region Credentials
@@ -861,7 +865,7 @@ public async Task<Dictionary<RedumpSystem, byte[]>> DownloadPacks(string url, Re
861865
862866 /// <summary>
863867 /// Download a set of packs
864- /// </summary>
868+ /// </summary>
865869 /// <param name="url">Base URL to download using</param>
866870 /// <param name="systems">Systems to download packs for</param>
867871 /// <param name="title">Name of the pack that is downloading</param>
0 commit comments