From ff73eab0dee939b2b17d8ca759e8d5b95eec5b4d Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 4 Jun 2023 16:05:25 -0500 Subject: [PATCH] Update SixLabors.ImageSharp, MailKit, DryIoc libraries Closes #3478 Co-Authored-By: Stepan Goremykin <25577658+goremykin@users.noreply.github.com> --- src/NzbDrone.Common/Lidarr.Common.csproj | 2 +- src/NzbDrone.Core/Lidarr.Core.csproj | 4 +- src/NzbDrone.Core/MediaCover/ImageResizer.cs | 8 ++- .../Notifications/Email/Email.cs | 52 +++++++++---------- src/NzbDrone.Host/Lidarr.Host.csproj | 4 +- src/NzbDrone.Update/Lidarr.Update.csproj | 4 +- 6 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/NzbDrone.Common/Lidarr.Common.csproj b/src/NzbDrone.Common/Lidarr.Common.csproj index 60df278b7..97c67662d 100644 --- a/src/NzbDrone.Common/Lidarr.Common.csproj +++ b/src/NzbDrone.Common/Lidarr.Common.csproj @@ -5,7 +5,7 @@ ISMUSL - + diff --git a/src/NzbDrone.Core/Lidarr.Core.csproj b/src/NzbDrone.Core/Lidarr.Core.csproj index 572803e2c..311186b4f 100644 --- a/src/NzbDrone.Core/Lidarr.Core.csproj +++ b/src/NzbDrone.Core/Lidarr.Core.csproj @@ -13,7 +13,7 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/src/NzbDrone.Core/MediaCover/ImageResizer.cs b/src/NzbDrone.Core/MediaCover/ImageResizer.cs index ec2eefa78..c2f85c209 100644 --- a/src/NzbDrone.Core/MediaCover/ImageResizer.cs +++ b/src/NzbDrone.Core/MediaCover/ImageResizer.cs @@ -42,11 +42,9 @@ namespace NzbDrone.Core.MediaCover try { - using (var image = Image.Load(source)) - { - image.Mutate(x => x.Resize(0, height)); - image.Save(destination); - } + using var image = Image.Load(source); + image.Mutate(x => x.Resize(0, height)); + image.Save(destination); } catch { diff --git a/src/NzbDrone.Core/Notifications/Email/Email.cs b/src/NzbDrone.Core/Notifications/Email/Email.cs index 15170fee2..1155b51f6 100644 --- a/src/NzbDrone.Core/Notifications/Email/Email.cs +++ b/src/NzbDrone.Core/Notifications/Email/Email.cs @@ -124,47 +124,45 @@ namespace NzbDrone.Core.Notifications.Email private void Send(MimeMessage email, EmailSettings settings) { - using (var client = new SmtpClient()) - { - client.Timeout = 10000; + using var client = new SmtpClient(); + client.Timeout = 10000; - var serverOption = SecureSocketOptions.Auto; + var serverOption = SecureSocketOptions.Auto; - if (settings.RequireEncryption) + if (settings.RequireEncryption) + { + if (settings.Port == 465) { - if (settings.Port == 465) - { - serverOption = SecureSocketOptions.SslOnConnect; - } - else - { - serverOption = SecureSocketOptions.StartTls; - } + serverOption = SecureSocketOptions.SslOnConnect; } + else + { + serverOption = SecureSocketOptions.StartTls; + } + } - client.ServerCertificateValidationCallback = _certificateValidationService.ShouldByPassValidationError; + client.ServerCertificateValidationCallback = _certificateValidationService.ShouldByPassValidationError; - _logger.Debug("Connecting to mail server"); + _logger.Debug("Connecting to mail server"); - client.Connect(settings.Server, settings.Port, serverOption); + client.Connect(settings.Server, settings.Port, serverOption); - if (!string.IsNullOrWhiteSpace(settings.Username)) - { - _logger.Debug("Authenticating to mail server"); + if (!string.IsNullOrWhiteSpace(settings.Username)) + { + _logger.Debug("Authenticating to mail server"); - client.Authenticate(settings.Username, settings.Password); - } + client.Authenticate(settings.Username, settings.Password); + } - _logger.Debug("Sending to mail server"); + _logger.Debug("Sending to mail server"); - client.Send(email); + client.Send(email); - _logger.Debug("Sent to mail server, disconnecting"); + _logger.Debug("Sent to mail server, disconnecting"); - client.Disconnect(true); + client.Disconnect(true); - _logger.Debug("Disconnecting from mail server"); - } + _logger.Debug("Disconnecting from mail server"); } public ValidationFailure Test(EmailSettings settings) diff --git a/src/NzbDrone.Host/Lidarr.Host.csproj b/src/NzbDrone.Host/Lidarr.Host.csproj index 520c1f055..ad7b17209 100644 --- a/src/NzbDrone.Host/Lidarr.Host.csproj +++ b/src/NzbDrone.Host/Lidarr.Host.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/NzbDrone.Update/Lidarr.Update.csproj b/src/NzbDrone.Update/Lidarr.Update.csproj index ce0c5acfd..685e54612 100644 --- a/src/NzbDrone.Update/Lidarr.Update.csproj +++ b/src/NzbDrone.Update/Lidarr.Update.csproj @@ -4,8 +4,8 @@ net6.0 - - + +