From 7fd588f2beeded0a63f02d15db20313568e081bc Mon Sep 17 00:00:00 2001 From: Kees Date: Mon, 11 Sep 2023 09:47:28 +0200 Subject: [PATCH] Invert if statement --- MsgReaderCore/Mime/Message.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/MsgReaderCore/Mime/Message.cs b/MsgReaderCore/Mime/Message.cs index 024cecd5..15f96faf 100644 --- a/MsgReaderCore/Mime/Message.cs +++ b/MsgReaderCore/Mime/Message.cs @@ -452,10 +452,9 @@ private MailMessage ToMailMessage() }; attachment.Name = string.IsNullOrEmpty(attachment.Name) ? attachmentMessagePart.FileName : attachment.Name; - if (attachment.ContentDisposition != null) - attachment.ContentDisposition.FileName = string.IsNullOrEmpty(attachment.ContentDisposition.FileName) - ? attachmentMessagePart.FileName - : attachment.ContentDisposition.FileName; + attachment.ContentDisposition.FileName = string.IsNullOrEmpty(attachment.ContentDisposition.FileName) + ? attachmentMessagePart.FileName + : attachment.ContentDisposition.FileName; message.Attachments.Add(attachment); } @@ -513,13 +512,13 @@ public void Save(Stream messageStream) if (_changed) { - messageStream.Write(RawMessage, 0, RawMessage.Length); - Logger.WriteToLog("Raw EML message saved"); + ToMailMessage().WriteTo(messageStream); + Logger.WriteToLog("EML message saved as new message"); } else { - ToMailMessage().WriteTo(messageStream); - Logger.WriteToLog("EML message saved as new message"); + messageStream.Write(RawMessage, 0, RawMessage.Length); + Logger.WriteToLog("Raw EML message saved"); } } #endregion