aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
diff options
context:
space:
mode:
authorConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com>2020-06-09 13:28:40 -0500
committerGitHub <noreply@github.com>2020-06-09 13:28:40 -0500
commit7d9b5524031fe6b5c23b4282cb1f9ec850b114fe (patch)
tree8e4e05dac0c1aa390e9ad9cc9c1d76be15773fab /Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
parent001c78573eb132dadad1fcd8162d2966fbf0d402 (diff)
Apply suggestions from code review
Co-authored-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs')
-rw-r--r--Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs35
1 files changed, 25 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs b/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
index 929e021a3..62b775fa6 100644
--- a/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
+++ b/Emby.Server.Implementations/QuickConnect/QuickConnectManager.cs
@@ -27,15 +27,11 @@ namespace Emby.Server.Implementations.QuickConnect
private readonly RNGCryptoServiceProvider _rng = new RNGCryptoServiceProvider();
private Dictionary<string, QuickConnectResult> _currentRequests = new Dictionary<string, QuickConnectResult>();
- private IServerConfigurationManager _config;
- private ILogger _logger;
- private IUserManager _userManager;
- private ILocalizationManager _localizationManager;
- private IJsonSerializer _jsonSerializer;
- private IAuthenticationRepository _authenticationRepository;
- private IAuthorizationContext _authContext;
- private IServerApplicationHost _appHost;
- private ITaskManager _taskManager;
+ private readonly IServerConfigurationManager _config;
+ private readonly ILogger<QuickConnectManager> _logger;
+ private readonly IAuthenticationRepository _authenticationRepository;
+ private readonly IAuthorizationContext _authContext;
+ private readonly IServerApplicationHost _appHost;
/// <summary>
/// Initializes a new instance of the <see cref="QuickConnectManager"/> class.
@@ -207,7 +203,7 @@ namespace Emby.Server.Implementations.QuickConnect
scale = BitConverter.ToUInt32(raw, 0);
}
- int code = (int)(min + (max - min) * (scale / (double)uint.MaxValue));
+ int code = (int)(min + ((max - min) * (scale / (double)uint.MaxValue)));
return code.ToString(CultureInfo.InvariantCulture);
}
@@ -272,7 +268,26 @@ namespace Emby.Server.Implementations.QuickConnect
return tokens.Count();
}
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+ /// <summary>
+ /// Dispose.
+ /// </summary>
+ /// <param name="disposing">Dispose unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ _rng?.Dispose();
+ }
+ }
private string GenerateSecureRandom(int length = 32)
{
var bytes = new byte[length];