mirror of
				https://github.com/JKorf/CryptoExchange.Net
				synced 2025-10-28 00:48:40 +00:00 
			
		
		
		
	Small changes for options
This commit is contained in:
		
							parent
							
								
									c792bc25b6
								
							
						
					
					
						commit
						0c6e74911d
					
				| @ -70,7 +70,7 @@ namespace CryptoExchange.Net.Authentication | |||||||
|         public virtual ApiCredentials Copy() |         public virtual ApiCredentials Copy() | ||||||
|         { |         { | ||||||
|             if (PrivateKey == null) |             if (PrivateKey == null) | ||||||
|                 return new ApiCredentials(Key!.GetString(), Secret!.GetString()); |                 return new ApiCredentials(Key!, Secret!); | ||||||
|             else |             else | ||||||
|                 return new ApiCredentials(PrivateKey!.Copy()); |                 return new ApiCredentials(PrivateKey!.Copy()); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -12,6 +12,7 @@ namespace CryptoExchange.Net | |||||||
|         private ApiCredentials? _apiCredentials; |         private ApiCredentials? _apiCredentials; | ||||||
|         private AuthenticationProvider? _authenticationProvider; |         private AuthenticationProvider? _authenticationProvider; | ||||||
|         private bool _created; |         private bool _created; | ||||||
|  |         private bool _disposing; | ||||||
| 
 | 
 | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         /// The authentication provider for this API client. (null if no credentials are set) |         /// The authentication provider for this API client. (null if no credentials are set) | ||||||
| @ -20,7 +21,7 @@ namespace CryptoExchange.Net | |||||||
|         { |         { | ||||||
|             get  |             get  | ||||||
|             { |             { | ||||||
|                 if (!_created && _apiCredentials != null) |                 if (!_created && !_disposing && _apiCredentials != null) | ||||||
|                 { |                 { | ||||||
|                     _authenticationProvider = CreateAuthenticationProvider(_apiCredentials); |                     _authenticationProvider = CreateAuthenticationProvider(_apiCredentials); | ||||||
|                     _created = true; |                     _created = true; | ||||||
| @ -62,7 +63,7 @@ namespace CryptoExchange.Net | |||||||
|         /// <inheritdoc /> |         /// <inheritdoc /> | ||||||
|         public void SetApiCredentials(ApiCredentials credentials) |         public void SetApiCredentials(ApiCredentials credentials) | ||||||
|         { |         { | ||||||
|             _apiCredentials = credentials; |             _apiCredentials = credentials?.Copy(); | ||||||
|             _created = false; |             _created = false; | ||||||
|             _authenticationProvider = null; |             _authenticationProvider = null; | ||||||
|         } |         } | ||||||
| @ -72,6 +73,8 @@ namespace CryptoExchange.Net | |||||||
|         /// </summary> |         /// </summary> | ||||||
|         public void Dispose() |         public void Dispose() | ||||||
|         { |         { | ||||||
|  |             _disposing = true; | ||||||
|  |             _apiCredentials?.Dispose(); | ||||||
|             AuthenticationProvider?.Credentials?.Dispose(); |             AuthenticationProvider?.Credentials?.Dispose(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -260,7 +260,7 @@ namespace CryptoExchange.Net.Objects | |||||||
|         /// </summary> |         /// </summary> | ||||||
|         /// <param name="baseOptions">Copy values for the provided options</param> |         /// <param name="baseOptions">Copy values for the provided options</param> | ||||||
| #pragma warning disable 8618 // Will always get filled by the provided options | #pragma warning disable 8618 // Will always get filled by the provided options | ||||||
|         public ApiClientOptions(ApiClientOptions baseOptions, RestApiClientOptions? newValues) |         public ApiClientOptions(ApiClientOptions baseOptions, ApiClientOptions? newValues) | ||||||
|         { |         { | ||||||
|             BaseAddress = newValues?.BaseAddress ?? baseOptions.BaseAddress; |             BaseAddress = newValues?.BaseAddress ?? baseOptions.BaseAddress; | ||||||
|             ApiCredentials = newValues?.ApiCredentials?.Copy() ?? baseOptions.ApiCredentials?.Copy(); |             ApiCredentials = newValues?.ApiCredentials?.Copy() ?? baseOptions.ApiCredentials?.Copy(); | ||||||
| @ -318,7 +318,7 @@ namespace CryptoExchange.Net.Objects | |||||||
|         /// ctor |         /// ctor | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         /// <param name="baseOn">Copy values for the provided options</param> |         /// <param name="baseOn">Copy values for the provided options</param> | ||||||
|         public RestApiClientOptions(RestApiClientOptions baseOn, RestApiClientOptions newValues): base(baseOn, newValues) |         public RestApiClientOptions(RestApiClientOptions baseOn, RestApiClientOptions? newValues): base(baseOn, newValues) | ||||||
|         { |         { | ||||||
|             RateLimitingBehaviour = newValues?.RateLimitingBehaviour ?? baseOn.RateLimitingBehaviour; |             RateLimitingBehaviour = newValues?.RateLimitingBehaviour ?? baseOn.RateLimitingBehaviour; | ||||||
|             AutoTimestamp = newValues?.AutoTimestamp ?? baseOn.AutoTimestamp; |             AutoTimestamp = newValues?.AutoTimestamp ?? baseOn.AutoTimestamp; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user