From 2abbee10320930de5ec1253e6085915c296ddec7 Mon Sep 17 00:00:00 2001 From: Stepan Goremykin Date: Thu, 30 Mar 2023 21:56:54 -0700 Subject: [PATCH] Update SixLabors.ImageSharp, MailKit, DryIoc libraries --- src/NzbDrone.Common/Sonarr.Common.csproj | 2 +- src/NzbDrone.Core/MediaCover/ImageResizer.cs | 8 ++- .../Notifications/Email/Email.cs | 53 +++++++++---------- src/NzbDrone.Core/Sonarr.Core.csproj | 4 +- src/NzbDrone.Host/Sonarr.Host.csproj | 4 +- src/NzbDrone.Update/Sonarr.Update.csproj | 4 +- src/Sonarr.sln.DotSettings | 2 + 7 files changed, 37 insertions(+), 40 deletions(-) create mode 100644 src/Sonarr.sln.DotSettings diff --git a/src/NzbDrone.Common/Sonarr.Common.csproj b/src/NzbDrone.Common/Sonarr.Common.csproj index 6c026684c..c9527d5a3 100644 --- a/src/NzbDrone.Common/Sonarr.Common.csproj +++ b/src/NzbDrone.Common/Sonarr.Common.csproj @@ -4,7 +4,7 @@ ISMUSL - + 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 59244c1c1..3adf3b703 100644 --- a/src/NzbDrone.Core/Notifications/Email/Email.cs +++ b/src/NzbDrone.Core/Notifications/Email/Email.cs @@ -8,7 +8,6 @@ using MimeKit; using NLog; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http.Dispatchers; -using NzbDrone.Core.Security; namespace NzbDrone.Core.Notifications.Email { @@ -110,47 +109,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.Core/Sonarr.Core.csproj b/src/NzbDrone.Core/Sonarr.Core.csproj index 9c71f8fdf..144fd96c5 100644 --- a/src/NzbDrone.Core/Sonarr.Core.csproj +++ b/src/NzbDrone.Core/Sonarr.Core.csproj @@ -4,7 +4,7 @@ - + @@ -15,7 +15,7 @@ - + diff --git a/src/NzbDrone.Host/Sonarr.Host.csproj b/src/NzbDrone.Host/Sonarr.Host.csproj index b8d429164..a5c2563b0 100644 --- a/src/NzbDrone.Host/Sonarr.Host.csproj +++ b/src/NzbDrone.Host/Sonarr.Host.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/src/NzbDrone.Update/Sonarr.Update.csproj b/src/NzbDrone.Update/Sonarr.Update.csproj index 8e86cce02..9ca0444c2 100644 --- a/src/NzbDrone.Update/Sonarr.Update.csproj +++ b/src/NzbDrone.Update/Sonarr.Update.csproj @@ -4,8 +4,8 @@ net6.0 - - + + diff --git a/src/Sonarr.sln.DotSettings b/src/Sonarr.sln.DotSettings new file mode 100644 index 000000000..fac9652d9 --- /dev/null +++ b/src/Sonarr.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file