Cosmetic changes
authorThomas
Fri, 14 Dec 2018 13:27:10 +0100
changeset 250769af585f9277
parent 2506 4b7924035021
child 2508 2d6974a9c66c
child 2509 24395aeaba47
Cosmetic changes
AdapterCallbacks.cs
CryptableMailItem.cs
DecryptionStack.cs
Extensions/AccountExtensions.cs
Extensions/MailItemExtensions.cs
FPPMessage.cs
Globals.cs
MsgProcessor.cs
PEPAttachment.cs
PEPDatabase.cs
PEPIdentity.cs
PEPMessage.cs
PEPSettings.cs
ThisAddIn.cs
UI/FormControlCrashReport.xaml.cs
UI/FormRegionPreviewUnencrypted.cs
UI/KeySyncWizard.xaml.cs
UI/RibbonCustomizations.cs
Wrappers/WatchedExplorer.cs
Wrappers/WatchedWindow.cs
     1.1 --- a/AdapterCallbacks.cs	Fri Dec 14 11:19:41 2018 +0100
     1.2 +++ b/AdapterCallbacks.cs	Fri Dec 14 13:27:10 2018 +0100
     1.3 @@ -211,8 +211,6 @@
     1.4          /// <param name="msg">The message to send.</param>
     1.5          public void MessageToSend(ref TextMessage msg)
     1.6          {
     1.7 -            PEPMessage newMessage;
     1.8 -
     1.9              Log.Verbose("MessageToSend: Started");
    1.10              try
    1.11              {
    1.12 @@ -220,7 +218,7 @@
    1.13              }
    1.14              catch { }         
    1.15  
    1.16 -            var result = PEPMessage.Create(msg, out newMessage);
    1.17 +            var result = PEPMessage.Create(msg, out PEPMessage newMessage);
    1.18              if (result != Globals.ReturnStatus.Success)
    1.19              {
    1.20                  // no need to log here, as PEPMessage.Create already logs the failure.
    1.21 @@ -266,8 +264,10 @@
    1.22  
    1.23                  try
    1.24                  {
    1.25 -                    timer = new Timer();
    1.26 -                    timer.Interval = FAST_POLLING_INTERVAL;
    1.27 +                    timer = new Timer
    1.28 +                    {
    1.29 +                        Interval = FAST_POLLING_INTERVAL
    1.30 +                    };
    1.31                      timer.Tick += (s, e) =>
    1.32                      {
    1.33                          if (counter++ < MAX_POLLING_COUNT)
     2.1 --- a/CryptableMailItem.cs	Fri Dec 14 11:19:41 2018 +0100
     2.2 +++ b/CryptableMailItem.cs	Fri Dec 14 13:27:10 2018 +0100
     2.3 @@ -176,14 +176,18 @@
     2.4              this._LastProcessedStatus = Globals.ReturnStatus.Success;
     2.5  
     2.6              // Setup the message processor background worker
     2.7 -            this.processor = new BackgroundWorker();
     2.8 -            this.processor.WorkerSupportsCancellation = false;
     2.9 +            this.processor = new BackgroundWorker
    2.10 +            {
    2.11 +                WorkerSupportsCancellation = false,
    2.12 +            };
    2.13              this.processor.RunWorkerCompleted += Processor_RunWorkerCompleted;
    2.14              this.processor.DoWork += Processor_DoWork;
    2.15  
    2.16              // Setup the mirror locator background worker
    2.17 -            this.mirrorLocator = new BackgroundWorker();
    2.18 -            this.mirrorLocator.WorkerSupportsCancellation = false;
    2.19 +            this.mirrorLocator = new BackgroundWorker
    2.20 +            {
    2.21 +                WorkerSupportsCancellation = false
    2.22 +            };
    2.23              this.mirrorLocator.RunWorkerCompleted += MirrorLocator_RunWorkerCompleted;
    2.24              this.mirrorLocator.DoWork += MirrorLocator_DoWork;
    2.25          }
    2.26 @@ -504,8 +508,7 @@
    2.27                                  items = null;
    2.28                              }
    2.29  
    2.30 -                            PEPMessage createdMessage = null;
    2.31 -                            if (PEPMessage.Create(this.internalMailItem, out createdMessage) == Globals.ReturnStatus.Success)
    2.32 +                            if (PEPMessage.Create(this.internalMailItem, out PEPMessage createdMessage) == Globals.ReturnStatus.Success)
    2.33                              {
    2.34                                  if (draft == null)
    2.35                                  {
    2.36 @@ -700,9 +703,11 @@
    2.37                          var result = System.Windows.MessageBox.Show(Properties.Resources.DraftProtection_Warning, Properties.Resources.DraftProtection_Title, System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Exclamation);
    2.38                          if (result == System.Windows.MessageBoxResult.Yes)
    2.39                          {
    2.40 -                            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
    2.41 -                            sfd.Filter = Properties.Resources.DraftProtection_MSG_Format + " (*.msg)|*.msg";
    2.42 -                            sfd.FilterIndex = 1;
    2.43 +                            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog
    2.44 +                            {
    2.45 +                                Filter = Properties.Resources.DraftProtection_MSG_Format + " (*.msg)|*.msg",
    2.46 +                                FilterIndex = 1
    2.47 +                            };
    2.48                              if (string.IsNullOrEmpty(this.internalMailItem.Subject) == false)
    2.49                                  sfd.FileName = this.internalMailItem.Subject;
    2.50                              var r = sfd.ShowDialog();
    2.51 @@ -892,8 +897,7 @@
    2.52          {
    2.53              get
    2.54              {
    2.55 -                object version;
    2.56 -                MailItemExtensions.GetPEPProperty(internalMailItem, MailItemExtensions.PEPProperty.PEPProtocolVersion, out version);
    2.57 +                MailItemExtensions.GetPEPProperty(internalMailItem, MailItemExtensions.PEPProperty.PEPProtocolVersion, out object version);
    2.58                  return version != null;
    2.59              }
    2.60          }
    2.61 @@ -1008,8 +1012,6 @@
    2.62                  Outlook.MailItem mirrorMailItem = null;
    2.63                  PEPMessage message = null;
    2.64                  PEPMessage mirror = null;
    2.65 -                PEPMessage processedMessage;
    2.66 -                pEpRating processedRating;
    2.67                  pEpDecryptFlags decryptionFlags;
    2.68                  MsgProcessor msgProcessor = new MsgProcessor();
    2.69                  Globals.ReturnStatus sts1;
    2.70 @@ -1220,8 +1222,8 @@
    2.71                                                           this.internalMailItem.GetIsInSentFolder(),
    2.72                                                           isDraft,
    2.73                                                           out mirror,
    2.74 -                                                         out processedMessage,
    2.75 -                                                         out processedRating,
    2.76 +                                                         out PEPMessage processedMessage,
    2.77 +                                                         out pEpRating processedRating,
    2.78                                                           ref decryptionFlags);
    2.79  
    2.80                      if (status == Globals.ReturnStatus.Success)
    2.81 @@ -1341,7 +1343,7 @@
    2.82                                  }
    2.83                              }
    2.84                          }
    2.85 -                    }                    
    2.86 +                    }
    2.87  
    2.88                      // Remove the pEp Processing category if needed
    2.89                      if (this.internalMailItem.RemovePEPProcessingCategory())
    2.90 @@ -1367,7 +1369,7 @@
    2.91                          if (saveError)
    2.92                          {
    2.93                              try
    2.94 -                            {                               
    2.95 +                            {
    2.96                                  int sts = Mapi.Save(this.internalMailItem, Mapi.SaveOption.KEEP_OPEN_READWRITE);
    2.97                                  Log.Verbose("ProcessAndGetRating: Saving using backup method. Return status is " + sts.ToString("X"));
    2.98  
     3.1 --- a/DecryptionStack.cs	Fri Dec 14 11:19:41 2018 +0100
     3.2 +++ b/DecryptionStack.cs	Fri Dec 14 13:27:10 2018 +0100
     3.3 @@ -24,8 +24,10 @@
     3.4          /// </summary>
     3.5          public DecryptionStack()
     3.6          {
     3.7 -            this.decryptionTimer = new System.Windows.Forms.Timer();
     3.8 -            this.decryptionTimer.Interval = DECRYPTION_INTERVAL;
     3.9 +            this.decryptionTimer = new System.Windows.Forms.Timer
    3.10 +            {
    3.11 +                Interval = DECRYPTION_INTERVAL
    3.12 +            };
    3.13              this.decryptionTimer.Tick += this.DecryptionTimer_Tick;
    3.14          }
    3.15  
    3.16 @@ -217,7 +219,6 @@
    3.17          {
    3.18              Outlook.MailItem omi = null;
    3.19              Outlook.MailItem omiCopy = null;
    3.20 -            string entryId = null;
    3.21              CryptableMailItem cmi = null;
    3.22  
    3.23              // Try to increment the decryption counter
    3.24 @@ -228,7 +229,7 @@
    3.25              }
    3.26  
    3.27              // Pop item from the decryption stack
    3.28 -            if (this.TryPop(out entryId))
    3.29 +            if (this.TryPop(out string entryId))
    3.30              {
    3.31                  // Get mail item and set process flag to true
    3.32                  try
    3.33 @@ -264,7 +265,7 @@
    3.34                              omiCopy.UnRead = false;
    3.35                              omiCopy.SetPEPProperty(MailItemExtensions.PEPProperty.AutoConsume, "yes");
    3.36                              omiCopy.SetPEPProperty(MailItemExtensions.PEPProperty.KeyImport, omi.GetKeyImportId());
    3.37 -                            omiCopy.SetPEPProperty(MailItemExtensions.PEPProperty.ForceProtection, omi.GetForceProtectionId());                            
    3.38 +                            omiCopy.SetPEPProperty(MailItemExtensions.PEPProperty.ForceProtection, omi.GetForceProtectionId());
    3.39                              copiedItemsList.Add(omi.EntryID);
    3.40                              copiedItemsList.Add(omiCopy.EntryID);
    3.41                              omiCopy.Save();
     4.1 --- a/Extensions/AccountExtensions.cs	Fri Dec 14 11:19:41 2018 +0100
     4.2 +++ b/Extensions/AccountExtensions.cs	Fri Dec 14 13:27:10 2018 +0100
     4.3 @@ -212,8 +212,7 @@
     4.4              {
     4.5                  // Get the server address of the account's address. If server address 
     4.6                  // couldn't be retrieved, use SMTP address for check.
     4.7 -                string address = null;
     4.8 -                if (account.TryGetMailServerAddressFromRegistry(out address) == false)
     4.9 +                if (account.TryGetMailServerAddressFromRegistry(out string address) == false)
    4.10                  {
    4.11                      address = account.SmtpAddress;
    4.12                  }
     5.1 --- a/Extensions/MailItemExtensions.cs	Fri Dec 14 11:19:41 2018 +0100
     5.2 +++ b/Extensions/MailItemExtensions.cs	Fri Dec 14 13:27:10 2018 +0100
     5.3 @@ -784,8 +784,7 @@
     5.4              {
     5.5                  try
     5.6                  {
     5.7 -                    object propValue = null;
     5.8 -                    if (omi.GetPEPProperty(PEPProperty.Rating, out propValue))
     5.9 +                    if (omi.GetPEPProperty(PEPProperty.Rating, out object propValue))
    5.10                      {
    5.11                          rating = (pEpRating)propValue;
    5.12                      }
    5.13 @@ -1014,8 +1013,7 @@
    5.14                      if ((result == false) &&
    5.15                          (PEPAttachment.AttachedMailsCache.Count > 0))
    5.16                      {
    5.17 -                        string messageId;
    5.18 -                        result = omi.GetIsAttachedMail(out messageId);
    5.19 +                        result = omi.GetIsAttachedMail(out string messageId);
    5.20                      }
    5.21                  }
    5.22              }
    5.23 @@ -1610,14 +1608,13 @@
    5.24          /// <returns>The Outlook folder to store the mirror of the mail item.</returns>
    5.25          public static Outlook.Folder GetMirrorFolder(this Outlook.MailItem omi)
    5.26          {
    5.27 -            string userName;
    5.28              string[] specialChars;
    5.29              Outlook.Folder folder;
    5.30              Outlook.Folders folders = Globals.ThisAddIn.PEPStoreRootFolder.Folders;
    5.31              Globals.ReturnStatus sts;
    5.32              StringBuilder strBuilder = new StringBuilder();
    5.33  
    5.34 -            sts = PEPIdentity.GetFromUserName(omi, out userName);
    5.35 +            sts = PEPIdentity.GetFromUserName(omi, out string userName);
    5.36  
    5.37              if (sts == Globals.ReturnStatus.Success)
    5.38              {
    5.39 @@ -1675,14 +1672,12 @@
    5.40          /// <returns>The myself identity or null if an error occured.</returns>
    5.41          public static PEPIdentity GetMyselfIdentity(this Outlook.MailItem omi)
    5.42          {
    5.43 -            PEPIdentity identity = null;
    5.44 -
    5.45 -            if (PEPIdentity.GetOwnIdentity(omi, out identity) != Globals.ReturnStatus.Success)
    5.46 +            if (PEPIdentity.GetOwnIdentity(omi, out PEPIdentity identity) != Globals.ReturnStatus.Success)
    5.47              {
    5.48                  identity = null;
    5.49              }
    5.50  
    5.51 -            return (identity);
    5.52 +            return identity;
    5.53          }
    5.54  
    5.55          /// <summary>
    5.56 @@ -2079,7 +2074,6 @@
    5.57          /// <returns>The new message container, otherwise null.</returns>
    5.58          public static MsgContainer ToMsgContainer(this Outlook.MailItem omi)
    5.59          {
    5.60 -            PEPMessage newMessage;
    5.61              MsgContainer msgCont = new MsgContainer();
    5.62              Globals.ReturnStatus sts;
    5.63              Outlook.Folder folder = null;
    5.64 @@ -2091,7 +2085,7 @@
    5.65              try
    5.66              {
    5.67                  // Create Message
    5.68 -                sts = PEPMessage.Create(omi, out newMessage);
    5.69 +                sts = PEPMessage.Create(omi, out PEPMessage newMessage);
    5.70                  msgCont.Message = newMessage;
    5.71                  msgCont.MessageCreationStatus = sts;
    5.72  
    5.73 @@ -2226,13 +2220,11 @@
    5.74          {
    5.75              MimeMessage mimeMessage = null;
    5.76              BodyBuilder bodyBuilder = new BodyBuilder();
    5.77 -            PEPMessage pEpMessage = null;
    5.78  
    5.79              // Create a PEPMessage
    5.80 -            if (PEPMessage.Create(omi, out pEpMessage) == Globals.ReturnStatus.Success)
    5.81 +            if (PEPMessage.Create(omi, out PEPMessage pEpMessage) == Globals.ReturnStatus.Success)
    5.82              {
    5.83 -                MimeMessage message;
    5.84 -                if (PEPMessage.ToMIMEMessage(pEpMessage, out message) == Globals.ReturnStatus.Success)
    5.85 +                if (PEPMessage.ToMIMEMessage(pEpMessage, out MimeMessage message) == Globals.ReturnStatus.Success)
    5.86                  {
    5.87                      mimeMessage = message;
    5.88                  }
    5.89 @@ -2478,8 +2470,7 @@
    5.90              }
    5.91  
    5.92              // Else calculate it
    5.93 -            PEPMessage message;
    5.94 -            if (PEPMessage.Create(omi, out message, true, false) == Globals.ReturnStatus.Success)
    5.95 +            if (PEPMessage.Create(omi, out PEPMessage message, true, false) == Globals.ReturnStatus.Success)
    5.96              {
    5.97                  rating = message?.GetOutgoingRating(ignoreOptions, previewOnly) ?? pEpRating.pEpRatingUndefined;
    5.98              }
    5.99 @@ -2604,11 +2595,10 @@
   5.100                                            out object value)
   5.101          {
   5.102              bool success;
   5.103 -            object outValue;
   5.104              object defaultValue;
   5.105  
   5.106              defaultValue = MailItemExtensions.GetPEPPropertyDefault(property);
   5.107 -            success = omi.GetPEPProperty(property, out outValue, defaultValue, null);
   5.108 +            success = omi.GetPEPProperty(property, out object outValue, defaultValue, null);
   5.109  
   5.110              value = outValue;
   5.111              return (success);
     6.1 --- a/FPPMessage.cs	Fri Dec 14 11:19:41 2018 +0100
     6.2 +++ b/FPPMessage.cs	Fri Dec 14 13:27:10 2018 +0100
     6.3 @@ -75,17 +75,14 @@
     6.4          /// <param name="omi">The Outlook mail item which serves as base for this FPP message.</param>
     6.5          public FPPMessage(Outlook.MailItem omi)
     6.6          {
     6.7 -            PEPMessage message;
     6.8 -            PEPIdentity identity;
     6.9 -
    6.10              this.CurrentEntryId = omi.EntryID;
    6.11  
    6.12 -            if (PEPMessage.Create(omi, out message) == Globals.ReturnStatus.Success)
    6.13 +            if (PEPMessage.Create(omi, out PEPMessage message) == Globals.ReturnStatus.Success)
    6.14              {
    6.15                  this.CurrentMessage = message;
    6.16              }
    6.17  
    6.18 -            if (PEPIdentity.GetOwnIdentity(omi, out identity) == Globals.ReturnStatus.Success)
    6.19 +            if (PEPIdentity.GetOwnIdentity(omi, out PEPIdentity identity) == Globals.ReturnStatus.Success)
    6.20              {
    6.21                  this.ReceivedBy = identity;
    6.22              }
    6.23 @@ -101,11 +98,10 @@
    6.24  
    6.25              for (int i = 0; i < this.CurrentMessage?.Attachments?.Count; i++)
    6.26              {
    6.27 -                MessageType type;
    6.28                  PEPAttachment attachment = this.CurrentMessage.Attachments[i];
    6.29  
    6.30                  // Check attachments for message type identifier
    6.31 -                if (attachment.IsFPPAttachment(out type))
    6.32 +                if (attachment.IsFPPAttachment(out MessageType type))
    6.33                  {
    6.34                      msgType = type;
    6.35                      break;
    6.36 @@ -159,9 +155,8 @@
    6.37          public void ProcessIncoming(bool manuallyTriggered = false)
    6.38          {
    6.39              // Prevent multiple processing of the same automatic mail
    6.40 -            DateTime lastProcessed;
    6.41              if ((processedMessages.ContainsKey(new KeyValuePair<string, MessageType>(this.CurrentMessage.ForceProtectionId, this.GetMessageType() ?? MessageType.InitialMessage)) &&
    6.42 -                (processedMessages.TryGetValue(new KeyValuePair<string, MessageType>(this.CurrentMessage.ForceProtectionId, this.GetMessageType() ?? MessageType.InitialMessage), out lastProcessed) &&
    6.43 +                (processedMessages.TryGetValue(new KeyValuePair<string, MessageType>(this.CurrentMessage.ForceProtectionId, this.GetMessageType() ?? MessageType.InitialMessage), out DateTime lastProcessed) &&
    6.44                  (DateTime.UtcNow.Subtract(lastProcessed).TotalSeconds < 10))))
    6.45              {
    6.46                  Log.Verbose("FPPMessage.ProcessIncoming: Message has already been processed. Won't process again.");
    6.47 @@ -186,15 +181,12 @@
    6.48              // Create task to decrypt message and continue processing
    6.49              Task.Factory.StartNew<Globals.ReturnStatus>(() =>
    6.50              {
    6.51 -                PEPMessage processedMessage;
    6.52 -                pEpRating processedRating;
    6.53 -                string[] keyList;
    6.54                  pEpDecryptFlags flags = pEpDecryptFlags.pEpDecryptFlagsNone;
    6.55  
    6.56                  // Decrypt incoming message
    6.57                  MsgProcessor msgProcessor = new MsgProcessor();
    6.58                  PEPMessage message = this.CurrentMessage;
    6.59 -                if (msgProcessor.Decrypt(ref message, out processedMessage, out keyList, ref flags, out processedRating) == false)
    6.60 +                if (msgProcessor.Decrypt(ref message, out PEPMessage processedMessage, out string[] keyList, ref flags, out pEpRating processedRating) == false)
    6.61                  {
    6.62                      Log.Error("FPPMessage.ProcessIncoming: Error decrypting incoming message.");
    6.63                      return Globals.ReturnStatus.Failure;
    6.64 @@ -536,9 +528,11 @@
    6.65                  PEPAttachment attachment = null;
    6.66                  if (nextMessageType == MessageType.AnswerMessage)
    6.67                  {
    6.68 -                    attachment = new PEPAttachment();
    6.69 -                    attachment.FileName = PEP_FPP_ATTACHMENT_FILE_NAME;
    6.70 -                    attachment.MimeType = PEP_FPP_ATTACHMENT_MIME_TYPE;
    6.71 +                    attachment = new PEPAttachment
    6.72 +                    {
    6.73 +                        FileName = PEP_FPP_ATTACHMENT_FILE_NAME,
    6.74 +                        MimeType = PEP_FPP_ATTACHMENT_MIME_TYPE
    6.75 +                    };
    6.76                      Log.Verbose("CreateAndSendNextFPPMessage: Answer Message created.");
    6.77                  }
    6.78                  else if (nextMessageType == MessageType.KeyTransportMessage)
    6.79 @@ -565,10 +559,12 @@
    6.80                      if (password != null)
    6.81                      {
    6.82                          // Attach password
    6.83 -                        attachment = new PEPAttachment();
    6.84 -                        attachment.Data = Encoding.UTF8.GetBytes(password);
    6.85 -                        attachment.FileName = PEP_FPP_ATTACHMENT_FILE_NAME;
    6.86 -                        attachment.MimeType = PEP_FPP_ATTACHMENT_MIME_TYPE;
    6.87 +                        attachment = new PEPAttachment
    6.88 +                        {
    6.89 +                            Data = Encoding.UTF8.GetBytes(password),
    6.90 +                            FileName = PEP_FPP_ATTACHMENT_FILE_NAME,
    6.91 +                            MimeType = PEP_FPP_ATTACHMENT_MIME_TYPE
    6.92 +                        };
    6.93                          Log.Verbose("CreateAndSendNextFPPMessage: Key Transport Message created.");
    6.94                      }
    6.95                      else
    6.96 @@ -1030,8 +1026,7 @@
    6.97                  {
    6.98                      attachment = attachments[i];
    6.99                      PEPAttachment attach = new PEPAttachment(attachment);
   6.100 -                    MessageType type;
   6.101 -                    if (attach.IsFPPAttachment(out type))
   6.102 +                    if (attach.IsFPPAttachment(out MessageType type))
   6.103                      {
   6.104                          convertMessage = false;
   6.105                          break;
     7.1 --- a/Globals.cs	Fri Dec 14 11:19:41 2018 +0100
     7.2 +++ b/Globals.cs	Fri Dec 14 13:27:10 2018 +0100
     7.3 @@ -143,8 +143,10 @@
     7.4                  if (_ResourceDict == null)
     7.5                  {
     7.6                      // Load resource dictionary
     7.7 -                    _ResourceDict = new ResourceDictionary();
     7.8 -                    _ResourceDict.Source = new Uri("pack://application:,,,/pEp;component/Resources/Dictionary.xaml", UriKind.RelativeOrAbsolute);
     7.9 +                    _ResourceDict = new ResourceDictionary
    7.10 +                    {
    7.11 +                        Source = new Uri("pack://application:,,,/pEp;component/Resources/Dictionary.xaml", UriKind.RelativeOrAbsolute)
    7.12 +                    };
    7.13  
    7.14                      return (_ResourceDict);
    7.15                  }
    7.16 @@ -188,9 +190,11 @@
    7.17              // Show the report before sending
    7.18              if (continueSend)
    7.19              {
    7.20 -                stateIn = new FormControlCrashReport.State();
    7.21 -                stateIn.AddressTo = Globals.ThisAddIn.Settings?.CrashReportSendAddress ?? PEPSettings.CRASH_REPORT_SEND_ADDRESS_DEFAULT;
    7.22 -                stateIn.AddressFrom = null; // A message can be sent without a "from" address
    7.23 +                stateIn = new FormControlCrashReport.State
    7.24 +                {
    7.25 +                    AddressTo = Globals.ThisAddIn.Settings?.CrashReportSendAddress ?? PEPSettings.CRASH_REPORT_SEND_ADDRESS_DEFAULT,
    7.26 +                    AddressFrom = null // A message can be sent without a "from" address
    7.27 +                };
    7.28  
    7.29                  // Get log
    7.30                  try
    7.31 @@ -250,9 +254,11 @@
    7.32  
    7.33                  if (Globals.ThisAddIn.Settings?.IsCrashReportVisible ?? true)
    7.34                  {
    7.35 -                    form = new FormCrashReport();
    7.36 -                    form.StartPosition = FormStartPosition.CenterParent;
    7.37 -                    form.DisplayState = stateIn;
    7.38 +                    form = new FormCrashReport
    7.39 +                    {
    7.40 +                        StartPosition = FormStartPosition.CenterParent,
    7.41 +                        DisplayState = stateIn
    7.42 +                    };
    7.43                      result = form.ShowDialog();
    7.44  
    7.45                      if (result != DialogResult.OK)
    7.46 @@ -265,8 +271,10 @@
    7.47              // Build and send message
    7.48              if (continueSend)
    7.49              {
    7.50 -                newMessage = new PEPMessage();
    7.51 -                newMessage.ShortMsg = "Crash Report";
    7.52 +                newMessage = new PEPMessage
    7.53 +                {
    7.54 +                    ShortMsg = "Crash Report"
    7.55 +                };
    7.56                  newMessage.To.Add(new PEPIdentity(stateIn.AddressTo));
    7.57                  newMessage.LongMsg = stateIn.ReportText;
    7.58                  newMessage.Direction = pEpCOMServerAdapterLib.pEpMsgDirection.pEpDirOutgoing;
    7.59 @@ -274,17 +282,21 @@
    7.60                  // Add logs as attachments
    7.61                  if (string.IsNullOrEmpty(log) == false)
    7.62                  {
    7.63 -                    attachment = new PEPAttachment();
    7.64 -                    attachment.Data = Encoding.UTF8.GetBytes(log);
    7.65 -                    attachment.FileName = "pEp Log.txt";
    7.66 +                    attachment = new PEPAttachment
    7.67 +                    {
    7.68 +                        Data = Encoding.UTF8.GetBytes(log),
    7.69 +                        FileName = "pEp Log.txt"
    7.70 +                    };
    7.71                      newMessage.Attachments.Add(attachment);
    7.72                  }
    7.73  
    7.74                  if (string.IsNullOrEmpty(engineLog) == false)
    7.75                  {
    7.76 -                    attachment = new PEPAttachment();
    7.77 -                    attachment.Data = Encoding.UTF8.GetBytes(engineLog);
    7.78 -                    attachment.FileName = "pEp Engine Log.txt";
    7.79 +                    attachment = new PEPAttachment
    7.80 +                    {
    7.81 +                        Data = Encoding.UTF8.GetBytes(engineLog),
    7.82 +                        FileName = "pEp Engine Log.txt"
    7.83 +                    };
    7.84                      newMessage.Attachments.Add(attachment);
    7.85                  }
    7.86  
    7.87 @@ -357,7 +369,6 @@
    7.88                  if (Globals._OutlookVersion == Version.Undefined)
    7.89                  {
    7.90                      var version = Version.Undefined;
    7.91 -                    int versionNumberInt = 0;
    7.92                      string versionNumber = string.Empty;
    7.93  
    7.94                      try
    7.95 @@ -370,7 +381,7 @@
    7.96                          Log.Error("GetOutlookVersion: Error getting version. " + ex.ToString());
    7.97                      }
    7.98  
    7.99 -                    if (int.TryParse(versionNumber, out versionNumberInt))
   7.100 +                    if (int.TryParse(versionNumber, out int versionNumberInt))
   7.101                      {
   7.102                          try
   7.103                          {
   7.104 @@ -466,12 +477,12 @@
   7.105  
   7.106                  // Use only the first 10-digits which is the serial itself
   7.107                  serial = Properties.Settings.Default.Serial;
   7.108 -                serial = (serial != null ? serial : "");
   7.109 +                serial = (serial ?? "");
   7.110                  serial = (serial.Length > 10) ? serial.Substring(0, 10) : serial;
   7.111  
   7.112                  systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_Serial, (Globals.RELEASE_MODE == Globals.ReleaseMode.Reader ? Properties.Resources.SystemInfo_Reader : serial)));
   7.113 -                systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_PEPForOutlookVersion, (version != null ? version : "-")));
   7.114 -                systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_PEPEngineVersion, (engineVersion != null ? engineVersion : "-")));
   7.115 +                systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_PEPForOutlookVersion, (version ?? "-")));
   7.116 +                systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_PEPEngineVersion, (engineVersion ?? "-")));
   7.117                  systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_OutlookVersion, Globals.ThisAddIn.Application.Version));
   7.118                  systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_OSVersion, Environment.OSVersion.VersionString));
   7.119                  systemInfo.Add(new KVPair<string, string>(Properties.Resources.SystemInfo_64BitOS, Environment.Is64BitOperatingSystem.ToString()));
     8.1 --- a/MsgProcessor.cs	Fri Dec 14 11:19:41 2018 +0100
     8.2 +++ b/MsgProcessor.cs	Fri Dec 14 13:27:10 2018 +0100
     8.3 @@ -307,9 +307,8 @@
     8.4                                   * message and to remove public keys attached to the message.
     8.5                                   * The processed message itself can be ignored.
     8.6                                  */
     8.7 -                                PEPMessage outMessage;
     8.8                                  this.Decrypt(ref message,
     8.9 -                                             out outMessage,
    8.10 +                                             out _,
    8.11                                               out decryptionKeyList,
    8.12                                               ref decryptionFlags);
    8.13                              }
    8.14 @@ -508,9 +507,8 @@
    8.15          /// <returns>True if decryption was considered successful, otherwise false.</returns>
    8.16          public bool Decrypt(PEPMessage sourceMessage)
    8.17          {
    8.18 -            PEPMessage outMessage;
    8.19  
    8.20 -            return this.Decrypt(sourceMessage, out outMessage);
    8.21 +            return this.Decrypt(sourceMessage, out _);
    8.22          }
    8.23  
    8.24          /// <summary>
    8.25 @@ -524,11 +522,8 @@
    8.26          public bool Decrypt(PEPMessage sourceMessage,
    8.27                              out PEPMessage decryptedMessage)
    8.28          {
    8.29 -            string[] keyList;
    8.30              pEpDecryptFlags flags = pEpDecryptFlags.pEpDecryptFlagsNone;
    8.31 -            pEpRating rating;
    8.32 -
    8.33 -            return this.Decrypt(ref sourceMessage, out decryptedMessage, out keyList, ref flags, out rating);
    8.34 +            return this.Decrypt(ref sourceMessage, out decryptedMessage, out _, ref flags, out _);
    8.35          }
    8.36  
    8.37          /// <summary>
    8.38 @@ -637,8 +632,7 @@
    8.39                  // Replace original if needed
    8.40                  if (flags.HasFlag(pEpDecryptFlags.pEpDecryptFlagSrcModified))
    8.41                  {
    8.42 -                    PEPMessage reencryptedMessage;
    8.43 -                    sts = PEPMessage.Create(src, out reencryptedMessage);
    8.44 +                    sts = PEPMessage.Create(src, out PEPMessage reencryptedMessage);
    8.45                      reencryptedMessage.SetNonEnginePropertiesFrom(sourceMessage);
    8.46                      sourceMessage = reencryptedMessage;
    8.47                  }
     9.1 --- a/PEPAttachment.cs	Fri Dec 14 11:19:41 2018 +0100
     9.2 +++ b/PEPAttachment.cs	Fri Dec 14 13:27:10 2018 +0100
     9.3 @@ -509,8 +509,10 @@
     9.4          /// <returns>A pEp engine blob.</returns>
     9.5          public Blob ToCOMType()
     9.6          {
     9.7 -            Blob b = new Blob();
     9.8 -            b.Value = (this._Data != null ? this._Data : new byte[0]);
     9.9 +            Blob b = new Blob
    9.10 +            {
    9.11 +                Value = this._Data ?? (new byte[0])
    9.12 +            };
    9.13  
    9.14              /* If attachment has content id (= is embedded), assign this content id
    9.15               * to the blob's Filename property and add the content id prefix so that 
    9.16 @@ -638,9 +640,10 @@
    9.17          public PEPAttachment Copy()
    9.18          {
    9.19              byte[] dataCopy;
    9.20 -            PEPAttachment copy = new PEPAttachment();
    9.21 -
    9.22 -            copy.ContentId = (this._ContentId == null ? null : string.Copy(this._ContentId));
    9.23 +            PEPAttachment copy = new PEPAttachment
    9.24 +            {
    9.25 +                ContentId = (this._ContentId == null ? null : string.Copy(this._ContentId))
    9.26 +            };
    9.27  
    9.28              // Copy data
    9.29              dataCopy = null;
    9.30 @@ -787,7 +790,7 @@
    9.31              if (attachments != null)
    9.32              {
    9.33                  // Validate data
    9.34 -                data = (this._Data != null ? this._Data : new byte[0]);
    9.35 +                data = this._Data ?? (new byte[0]);
    9.36  
    9.37                  // Create temp directory for attachments
    9.38                  tempFileName = Path.GetTempFileName();
    9.39 @@ -978,8 +981,7 @@
    9.40                           * is secure and has the same subject on the envelope and the attached message. Note
    9.41                           * that the subject comparison is done in CryptableMailItem.ProcessAndGetRating().                        
    9.42                           */
    9.43 -                        PEPMessage pEpMessage;
    9.44 -                        if (((PEPMessage.Create(message, out pEpMessage) == Globals.ReturnStatus.Success) &&
    9.45 +                        if (((PEPMessage.Create(message, out PEPMessage pEpMessage) == Globals.ReturnStatus.Success) &&
    9.46                              (pEpMessage.IsSecure)))
    9.47                          {
    9.48                              this.AttachedDisclaimerMessage = pEpMessage;
    10.1 --- a/PEPDatabase.cs	Fri Dec 14 11:19:41 2018 +0100
    10.2 +++ b/PEPDatabase.cs	Fri Dec 14 13:27:10 2018 +0100
    10.3 @@ -120,8 +120,7 @@
    10.4              }
    10.5              else
    10.6              {
    10.7 -                string ratingString;
    10.8 -                if (PEPDatabase.GetValueFromDb(DatabaseTable.Ratings, entryId, out ratingString) == Globals.ReturnStatus.Success)
    10.9 +                if (PEPDatabase.GetValueFromDb(DatabaseTable.Ratings, entryId, out string ratingString) == Globals.ReturnStatus.Success)
   10.10                  {
   10.11                      rating = AdapterExtensions.ParseRatingString(ratingString);
   10.12                  }
    11.1 --- a/PEPIdentity.cs	Fri Dec 14 11:19:41 2018 +0100
    11.2 +++ b/PEPIdentity.cs	Fri Dec 14 13:27:10 2018 +0100
    11.3 @@ -54,8 +54,10 @@
    11.4          /// <param name="address">The address of the identity to build with.</param>
    11.5          public PEPIdentity(string address)
    11.6          {
    11.7 -            this.internalIdentity = new pEpIdentity();
    11.8 -            this.internalIdentity.Address = address;
    11.9 +            this.internalIdentity = new pEpIdentity
   11.10 +            {
   11.11 +                Address = address
   11.12 +            };
   11.13              this._IsForceUnencrypted = null;
   11.14              this._IsSmartAddressEnabled = true;
   11.15              this._Members = new List<PEPIdentity>();
   11.16 @@ -461,15 +463,16 @@
   11.17          /// <returns>A pEp engine identity.</returns>
   11.18          public pEpIdentity ToCOMType()
   11.19          {
   11.20 -            pEpIdentity newIdent = new pEpIdentity();
   11.21 -
   11.22 -            newIdent.Address = this.GetSmartAddress();
   11.23 -            newIdent.CommType = this.internalIdentity.CommType;
   11.24 -            newIdent.fpr = this.internalIdentity.fpr;
   11.25 -            newIdent.Flags = this.internalIdentity.Flags;
   11.26 -            newIdent.lang = this.internalIdentity.lang;
   11.27 -            newIdent.UserId = this.internalIdentity.UserId;
   11.28 -            newIdent.UserName = this.internalIdentity.UserName;
   11.29 +            pEpIdentity newIdent = new pEpIdentity
   11.30 +            {
   11.31 +                Address = this.GetSmartAddress(),
   11.32 +                CommType = this.internalIdentity.CommType,
   11.33 +                fpr = this.internalIdentity.fpr,
   11.34 +                Flags = this.internalIdentity.Flags,
   11.35 +                lang = this.internalIdentity.lang,
   11.36 +                UserId = this.internalIdentity.UserId,
   11.37 +                UserName = this.internalIdentity.UserName
   11.38 +            };
   11.39  
   11.40              return (newIdent);
   11.41          }
   11.42 @@ -534,17 +537,18 @@
   11.43          /// <returns>The deep copy of the object.</returns>
   11.44          public PEPIdentity Copy()
   11.45          {
   11.46 -            PEPIdentity copy = new PEPIdentity();
   11.47 -
   11.48 -            copy.Address = (this.internalIdentity.Address == null ? null : string.Copy(this.internalIdentity.Address));
   11.49 -            copy.CommunicationType = this.internalIdentity.CommType;
   11.50 -            copy.Fingerprint = (this.internalIdentity.fpr == null ? null : string.Copy(this.internalIdentity.fpr));
   11.51 -            copy.IsInDeviceGroup = this.internalIdentity.GetIsInDeviceGroup();
   11.52 -            copy.IsList = this.internalIdentity.GetIsList();
   11.53 -            copy.IsSyncEnabled = this.internalIdentity.GetIsSyncEnabled();
   11.54 -            copy.Language = (this.internalIdentity.lang == null ? null : string.Copy(this.internalIdentity.lang));
   11.55 -            copy.UserId = (this.internalIdentity.UserId == null ? null : string.Copy(this.internalIdentity.UserId));
   11.56 -            copy.UserName = (this.internalIdentity.UserName == null ? null : string.Copy(this.internalIdentity.UserName));
   11.57 +            PEPIdentity copy = new PEPIdentity
   11.58 +            {
   11.59 +                Address = (this.internalIdentity.Address == null ? null : string.Copy(this.internalIdentity.Address)),
   11.60 +                CommunicationType = this.internalIdentity.CommType,
   11.61 +                Fingerprint = (this.internalIdentity.fpr == null ? null : string.Copy(this.internalIdentity.fpr)),
   11.62 +                IsInDeviceGroup = this.internalIdentity.GetIsInDeviceGroup(),
   11.63 +                IsList = this.internalIdentity.GetIsList(),
   11.64 +                IsSyncEnabled = this.internalIdentity.GetIsSyncEnabled(),
   11.65 +                Language = (this.internalIdentity.lang == null ? null : string.Copy(this.internalIdentity.lang)),
   11.66 +                UserId = (this.internalIdentity.UserId == null ? null : string.Copy(this.internalIdentity.UserId)),
   11.67 +                UserName = (this.internalIdentity.UserName == null ? null : string.Copy(this.internalIdentity.UserName))
   11.68 +            };
   11.69  
   11.70              // IsForceUnencrypted
   11.71              if (this._IsForceUnencrypted != null)
   11.72 @@ -781,14 +785,18 @@
   11.73                      if (PEPIdentity.GetIsAddressValid(workingStr))
   11.74                      {
   11.75                          // Only address
   11.76 -                        result = new PEPIdentity();
   11.77 -                        result.Address = workingStr;
   11.78 +                        result = new PEPIdentity
   11.79 +                        {
   11.80 +                            Address = workingStr
   11.81 +                        };
   11.82                      }
   11.83                      else
   11.84                      {
   11.85                          // Only user name
   11.86 -                        result = new PEPIdentity();
   11.87 -                        result.UserName = workingStr;
   11.88 +                        result = new PEPIdentity
   11.89 +                        {
   11.90 +                            UserName = workingStr
   11.91 +                        };
   11.92                      }
   11.93                  }
   11.94                  else if ((addressStartSymbol >= 0) &&
   11.95 @@ -808,9 +816,11 @@
   11.96                          if ((string.IsNullOrWhiteSpace(userName) == false) &&
   11.97                              (PEPIdentity.GetIsAddressValid(address)))
   11.98                          {
   11.99 -                            result = new PEPIdentity();
  11.100 -                            result.UserName = userName;
  11.101 -                            result.Address = address;
  11.102 +                            result = new PEPIdentity
  11.103 +                            {
  11.104 +                                UserName = userName,
  11.105 +                                Address = address
  11.106 +                            };
  11.107                          }
  11.108                      }
  11.109                  }
  11.110 @@ -1068,9 +1078,11 @@
  11.111  
  11.112                          if (string.IsNullOrEmpty(address) == false)
  11.113                          {
  11.114 -                            own = new PEPIdentity();
  11.115 -                            own.Address = address;
  11.116 -                            own.UserName = userName;
  11.117 +                            own = new PEPIdentity
  11.118 +                            {
  11.119 +                                Address = address,
  11.120 +                                UserName = userName
  11.121 +                            };
  11.122                              own.UserId = PEPIdentity.GetUserId(own.Address); // Not using 'myself ID'
  11.123  
  11.124                              // Update the identity in the pEp engine (and get fingerprint)
  11.125 @@ -1473,9 +1485,11 @@
  11.126                                  exchSender = sender.GetExchangeUser();
  11.127                                  if (exchSender != null)
  11.128                                  {
  11.129 -                                    from = new PEPIdentity();
  11.130 -                                    from.Address = exchSender.PrimarySmtpAddress;
  11.131 -                                    from.UserName = exchSender.Name;
  11.132 +                                    from = new PEPIdentity
  11.133 +                                    {
  11.134 +                                        Address = exchSender.PrimarySmtpAddress,
  11.135 +                                        UserName = exchSender.Name
  11.136 +                                    };
  11.137  
  11.138                                      // Add the contact if necessary
  11.139                                      try
  11.140 @@ -2009,7 +2023,6 @@
  11.141              string tempUserName;
  11.142              PEPIdentity newIdent = new PEPIdentity();
  11.143              PEPIdentity newIdent2;
  11.144 -            PEPIdentity member;
  11.145              Outlook.OlAddressEntryUserType? dlType = null;
  11.146              Outlook.AddressEntry currAddressEntry = null;
  11.147              Outlook.AddressEntry currentMember = null;
  11.148 @@ -2095,7 +2108,7 @@
  11.149  
  11.150                              if (currentMember != null)
  11.151                              {
  11.152 -                                sts = PEPIdentity.Create(currentMember, out member, addContact);
  11.153 +                                sts = PEPIdentity.Create(currentMember, out PEPIdentity member, addContact);
  11.154                                  newIdent.Members.Add(member);
  11.155  
  11.156                                  // Marshal.ReleaseComObject(currentMember);
  11.157 @@ -2160,10 +2173,12 @@
  11.158                      exchDLMembers = exchDL.GetExchangeDistributionListMembers();
  11.159  
  11.160                      // Add group
  11.161 -                    newIdent = new PEPIdentity();
  11.162 -                    newIdent.Address = null;
  11.163 -                    newIdent.UserName = exchDL.Name;
  11.164 -                    newIdent.UserId = null;
  11.165 +                    newIdent = new PEPIdentity
  11.166 +                    {
  11.167 +                        Address = null,
  11.168 +                        UserName = exchDL.Name,
  11.169 +                        UserId = null
  11.170 +                    };
  11.171  
  11.172                      // Add members
  11.173                      if (exchDLMembers != null)
  11.174 @@ -2177,9 +2192,11 @@
  11.175  
  11.176                                  if (exchUser != null)
  11.177                                  {
  11.178 -                                    newIdent2 = new PEPIdentity();
  11.179 -                                    newIdent2.Address = exchUser.PrimarySmtpAddress;
  11.180 -                                    newIdent2.UserName = exchUser.Name;
  11.181 +                                    newIdent2 = new PEPIdentity
  11.182 +                                    {
  11.183 +                                        Address = exchUser.PrimarySmtpAddress,
  11.184 +                                        UserName = exchUser.Name
  11.185 +                                    };
  11.186  
  11.187                                      // Add the contact force unencrypted property
  11.188                                      currContact = null;
  11.189 @@ -2237,8 +2254,10 @@
  11.190                  exchUser = null;
  11.191                  tempAddress = null;
  11.192                  tempUserName = null;
  11.193 -                newIdent = new PEPIdentity();
  11.194 -                newIdent.IsForceUnencrypted = forceUnencryptedProperty;
  11.195 +                newIdent = new PEPIdentity
  11.196 +                {
  11.197 +                    IsForceUnencrypted = forceUnencryptedProperty
  11.198 +                };
  11.199  
  11.200                  // Handle any exchange users first
  11.201                  try
    12.1 --- a/PEPMessage.cs	Fri Dec 14 11:19:41 2018 +0100
    12.2 +++ b/PEPMessage.cs	Fri Dec 14 13:27:10 2018 +0100
    12.3 @@ -733,63 +733,77 @@
    12.4              if ((alwaysAddOptFields) ||
    12.5                  (string.IsNullOrEmpty(this._AutoConsume) == false))
    12.6              {
    12.7 -                field = new StringPair();
    12.8 -                field.Name = PEPMessage.PR_PEP_AUTO_CONSUME_NAME;
    12.9 -                field.Value = this._AutoConsume;
   12.10 +                field = new StringPair
   12.11 +                {
   12.12 +                    Name = PEPMessage.PR_PEP_AUTO_CONSUME_NAME,
   12.13 +                    Value = this._AutoConsume
   12.14 +                };
   12.15                  optionalFields.Add(field);
   12.16              }
   12.17  
   12.18              if ((alwaysAddOptFields) ||
   12.19                  (string.IsNullOrEmpty(this._ForceProtectionId) == false))
   12.20              {
   12.21 -                field = new StringPair();
   12.22 -                field.Name = PEPMessage.PR_PEP_FORCE_PROTECTION_NAME;
   12.23 -                field.Value = this._ForceProtectionId;
   12.24 +                field = new StringPair
   12.25 +                {
   12.26 +                    Name = PEPMessage.PR_PEP_FORCE_PROTECTION_NAME,
   12.27 +                    Value = this._ForceProtectionId
   12.28 +                };
   12.29                  optionalFields.Add(field);
   12.30              }
   12.31  
   12.32              if ((alwaysAddOptFields) ||
   12.33                  (string.IsNullOrEmpty(this._KeyImport) == false))
   12.34              {
   12.35 -                field = new StringPair();
   12.36 -                field.Name = PEPMessage.PR_PEP_KEY_IMPORT_NAME;
   12.37 -                field.Value = this._KeyImport;
   12.38 +                field = new StringPair
   12.39 +                {
   12.40 +                    Name = PEPMessage.PR_PEP_KEY_IMPORT_NAME,
   12.41 +                    Value = this._KeyImport
   12.42 +                };
   12.43                  optionalFields.Add(field);
   12.44              }
   12.45  
   12.46              if ((alwaysAddOptFields) ||
   12.47                  (string.IsNullOrEmpty(this._KeyList) == false))
   12.48              {
   12.49 -                field = new StringPair();
   12.50 -                field.Name = PEPMessage.PR_KEY_LIST_NAME;
   12.51 -                field.Value = this._KeyList;
   12.52 +                field = new StringPair
   12.53 +                {
   12.54 +                    Name = PEPMessage.PR_KEY_LIST_NAME,
   12.55 +                    Value = this._KeyList
   12.56 +                };
   12.57                  optionalFields.Add(field);
   12.58              }
   12.59  
   12.60              if ((alwaysAddOptFields) ||
   12.61                  (this._NeverUnsecure == true))
   12.62              {
   12.63 -                field = new StringPair();
   12.64 -                field.Name = PEPMessage.PR_PEP_NEVER_UNSECURE_NAME;
   12.65 -                field.Value = PEPMessage.PR_PEP_NEVER_UNSECURE_VALUE;
   12.66 +                field = new StringPair
   12.67 +                {
   12.68 +                    Name = PEPMessage.PR_PEP_NEVER_UNSECURE_NAME,
   12.69 +                    Value = PEPMessage.PR_PEP_NEVER_UNSECURE_VALUE
   12.70 +                };
   12.71                  optionalFields.Add(field);
   12.72              }
   12.73  
   12.74              if ((alwaysAddOptFields) ||
   12.75                  (string.IsNullOrEmpty(this._PEPProtocolVersion) == false))
   12.76              {
   12.77 -                field = new StringPair();
   12.78 -                field.Name = PEPMessage.PR_PEP_PROTOCOL_VERSION_NAME;
   12.79 -                field.Value = this._PEPProtocolVersion;
   12.80 +                field = new StringPair
   12.81 +                {
   12.82 +                    Name = PEPMessage.PR_PEP_PROTOCOL_VERSION_NAME,
   12.83 +                    Value = this._PEPProtocolVersion
   12.84 +                };
   12.85                  optionalFields.Add(field);
   12.86              }
   12.87  
   12.88              if ((alwaysAddOptFields) ||
   12.89                  (this._Rating != pEpRating.pEpRatingUndefined))
   12.90              {
   12.91 -                field = new StringPair();
   12.92 -                field.Name = PEPMessage.PR_ENC_STATUS_NAME;
   12.93 -                field.Value = this._Rating.ToEngineString();
   12.94 +                field = new StringPair
   12.95 +                {
   12.96 +                    Name = PEPMessage.PR_ENC_STATUS_NAME,
   12.97 +                    Value = this._Rating.ToEngineString()
   12.98 +                };
   12.99                  optionalFields.Add(field);
  12.100              }
  12.101  
  12.102 @@ -917,10 +931,9 @@
  12.103              // BCC
  12.104              for (int i = 0; i < pEpMessage.Bcc?.Count; i++)
  12.105              {
  12.106 -                InternetAddress address;
  12.107                  try
  12.108                  {
  12.109 -                    if (InternetAddress.TryParse(pEpMessage.Bcc[i].Address, out address))
  12.110 +                    if (InternetAddress.TryParse(pEpMessage.Bcc[i].Address, out InternetAddress address))
  12.111                      {
  12.112                          address.Name = pEpMessage.Bcc[i].UserName;
  12.113                          message.Bcc.Add(address);
  12.114 @@ -936,10 +949,9 @@
  12.115              // CC
  12.116              for (int i = 0; i < pEpMessage.Cc?.Count; i++)
  12.117              {
  12.118 -                InternetAddress address;
  12.119                  try
  12.120                  {
  12.121 -                    if (InternetAddress.TryParse(pEpMessage.Cc[i].Address, out address))
  12.122 +                    if (InternetAddress.TryParse(pEpMessage.Cc[i].Address, out InternetAddress address))
  12.123                      {
  12.124                          address.Name = pEpMessage.Cc[i].UserName;
  12.125                          message.Cc.Add(address);
  12.126 @@ -955,10 +967,9 @@
  12.127              // To
  12.128              for (int i = 0; i < pEpMessage.To?.Count; i++)
  12.129              {
  12.130 -                InternetAddress address;
  12.131                  try
  12.132                  {
  12.133 -                    if (InternetAddress.TryParse(pEpMessage.To[i].Address, out address))
  12.134 +                    if (InternetAddress.TryParse(pEpMessage.To[i].Address, out InternetAddress address))
  12.135                      {
  12.136                          address.Name = pEpMessage.To[i].UserName;
  12.137                          message.To.Add(address);
  12.138 @@ -972,10 +983,9 @@
  12.139              }
  12.140  
  12.141              // From
  12.142 -            InternetAddress from;
  12.143              try
  12.144              {
  12.145 -                if (InternetAddress.TryParse(pEpMessage.From.Address, out from))
  12.146 +                if (InternetAddress.TryParse(pEpMessage.From.Address, out InternetAddress from))
  12.147                  {
  12.148                      from.Name = pEpMessage.From.UserName;
  12.149                      message.From.Add(from);
  12.150 @@ -1284,7 +1294,7 @@
  12.151              copy.EnableProtection = this._EnableProtection;
  12.152              copy.ForceProtectionId = (this._ForceProtectionId == null ? null : string.Copy(this._ForceProtectionId));
  12.153              copy.ForceUnencrypted = this._ForceUnencrypted;
  12.154 -            copy.From = (this._From == null ? null : this._From.Copy());
  12.155 +            copy.From = this._From?.Copy();
  12.156              copy.Id = (this._Id == null ? null : string.Copy(this._Id));
  12.157              copy.KeyImport = (this._KeyImport == null ? null : string.Copy(this._KeyImport));
  12.158              copy.KeyList = (this._KeyList == null ? null : string.Copy(this._KeyList));
  12.159 @@ -1607,7 +1617,6 @@
  12.160              Outlook.Accounts accounts = null;
  12.161              Outlook.Recipient fromRecipient = null;
  12.162              Outlook.NameSpace ns = null;
  12.163 -            PEPIdentity ident;
  12.164              Globals.ReturnStatus status = Globals.ReturnStatus.Success;
  12.165  
  12.166              try
  12.167 @@ -1743,7 +1752,7 @@
  12.168                          for (int i = 1; i <= accounts.Count; i++)
  12.169                          {
  12.170                              currAccount = accounts[i];
  12.171 -                            var sts = PEPIdentity.GetOwnIdentity(currAccount, out ident);
  12.172 +                            var sts = PEPIdentity.GetOwnIdentity(currAccount, out PEPIdentity ident);
  12.173  
  12.174                              if ((ident != null) &&
  12.175                                  (ident.EqualsByAddress(this._From)))
  12.176 @@ -2033,8 +2042,7 @@
  12.177                      omi.SetPEPProperty(MailItemExtensions.PEPProperty.KeyImport, this._KeyImport);
  12.178  
  12.179                      // Only store rating once and never change it
  12.180 -                    object storedRating = null;
  12.181 -                    omi.GetPEPProperty(MailItemExtensions.PEPProperty.Rating, out storedRating);
  12.182 +                    omi.GetPEPProperty(MailItemExtensions.PEPProperty.Rating, out object storedRating);
  12.183                      if ((pEpRating)storedRating == pEpRating.pEpRatingUndefined)
  12.184                      {
  12.185                          omi.SetPEPProperty(MailItemExtensions.PEPProperty.Rating, this._Rating);
  12.186 @@ -2289,8 +2297,10 @@
  12.187                          // Add to Rtf
  12.188                          if (string.IsNullOrEmpty(this._LongMsgFormattedRtf) == false)
  12.189                          {
  12.190 -                            System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox();
  12.191 -                            rtb.Text = this._LongMsgFormattedRtf;
  12.192 +                            System.Windows.Forms.RichTextBox rtb = new System.Windows.Forms.RichTextBox
  12.193 +                            {
  12.194 +                                Text = this._LongMsgFormattedRtf
  12.195 +                            };
  12.196                              rtb.AppendText(Environment.NewLine +
  12.197                                             Environment.NewLine +
  12.198                                             accountSettings.DisclaimerText);
  12.199 @@ -2876,11 +2886,12 @@
  12.200                              continue;
  12.201                          }
  12.202  
  12.203 -                        PEPAttachment pEpAttachment = new PEPAttachment();
  12.204 -
  12.205 -                        // Assign content type
  12.206 -                        pEpAttachment.MimeType = currentAttachment.ContentType?.MimeType;
  12.207 -                        pEpAttachment.FileName = currentAttachment.FileName;
  12.208 +                        PEPAttachment pEpAttachment = new PEPAttachment
  12.209 +                        {
  12.210 +                            // Assign content type
  12.211 +                            MimeType = currentAttachment.ContentType?.MimeType,
  12.212 +                            FileName = currentAttachment.FileName
  12.213 +                        };
  12.214  
  12.215                          // Decode content object and copy to data property
  12.216                          using (var memStream = new MemoryStream())
  12.217 @@ -2929,9 +2940,11 @@
  12.218                  // BCC
  12.219                  for (int i = 0; i < mimeMessage.Bcc?.Count; i++)
  12.220                  {
  12.221 -                    PEPIdentity ident = new PEPIdentity();
  12.222 -                    ident.Address = (mimeMessage.Bcc[i] as MailboxAddress)?.Address;
  12.223 -                    ident.UserName = (mimeMessage.Bcc[i] as MailboxAddress)?.Name;
  12.224 +                    PEPIdentity ident = new PEPIdentity
  12.225 +                    {
  12.226 +                        Address = (mimeMessage.Bcc[i] as MailboxAddress)?.Address,
  12.227 +                        UserName = (mimeMessage.Bcc[i] as MailboxAddress)?.Name
  12.228 +                    };
  12.229  
  12.230                      pEpMessage.Bcc.Add(ident);
  12.231                  }
  12.232 @@ -2939,9 +2952,11 @@
  12.233                  // CC
  12.234                  for (int i = 0; i < mimeMessage.Cc?.Count; i++)
  12.235                  {
  12.236 -                    PEPIdentity ident = new PEPIdentity();
  12.237 -                    ident.Address = (mimeMessage.Cc[i] as MailboxAddress)?.Address;
  12.238 -                    ident.UserName = (mimeMessage.Cc[i] as MailboxAddress)?.Name;
  12.239 +                    PEPIdentity ident = new PEPIdentity
  12.240 +                    {
  12.241 +                        Address = (mimeMessage.Cc[i] as MailboxAddress)?.Address,
  12.242 +                        UserName = (mimeMessage.Cc[i] as MailboxAddress)?.Name
  12.243 +                    };
  12.244  
  12.245                      pEpMessage.Cc.Add(ident);
  12.246                  }
  12.247 @@ -2949,9 +2964,11 @@
  12.248                  // To
  12.249                  for (int i = 0; i < mimeMessage.To?.Count; i++)
  12.250                  {
  12.251 -                    PEPIdentity ident = new PEPIdentity();
  12.252 -                    ident.Address = (mimeMessage.To[i] as MailboxAddress)?.Address;
  12.253 -                    ident.UserName = (mimeMessage.To[i] as MailboxAddress)?.Name;
  12.254 +                    PEPIdentity ident = new PEPIdentity
  12.255 +                    {
  12.256 +                        Address = (mimeMessage.To[i] as MailboxAddress)?.Address,
  12.257 +                        UserName = (mimeMessage.To[i] as MailboxAddress)?.Name
  12.258 +                    };
  12.259  
  12.260                      pEpMessage.To.Add(ident);
  12.261                  }
  12.262 @@ -2959,17 +2976,21 @@
  12.263                  // From
  12.264                  if (mimeMessage.Sender != null)
  12.265                  {
  12.266 -                    PEPIdentity ident = new PEPIdentity();
  12.267 -                    ident.Address = mimeMessage.Sender?.Address;
  12.268 -                    ident.UserName = mimeMessage.Sender?.Name;
  12.269 +                    PEPIdentity ident = new PEPIdentity
  12.270 +                    {
  12.271 +                        Address = mimeMessage.Sender?.Address,
  12.272 +                        UserName = mimeMessage.Sender?.Name
  12.273 +                    };
  12.274  
  12.275                      pEpMessage.From = ident;
  12.276                  }
  12.277                  else if (mimeMessage.From?.Count == 1)
  12.278                  {
  12.279 -                    PEPIdentity ident = new PEPIdentity();
  12.280 -                    ident.Address = (mimeMessage.From[0] as MailboxAddress)?.Address;
  12.281 -                    ident.UserName = (mimeMessage.From[0] as MailboxAddress)?.Name;
  12.282 +                    PEPIdentity ident = new PEPIdentity
  12.283 +                    {
  12.284 +                        Address = (mimeMessage.From[0] as MailboxAddress)?.Address,
  12.285 +                        UserName = (mimeMessage.From[0] as MailboxAddress)?.Name
  12.286 +                    };
  12.287  
  12.288                      pEpMessage.From = ident;
  12.289                  }
    13.1 --- a/PEPSettings.cs	Fri Dec 14 11:19:41 2018 +0100
    13.2 +++ b/PEPSettings.cs	Fri Dec 14 13:27:10 2018 +0100
    13.3 @@ -1177,9 +1177,11 @@
    13.4  
    13.5                              if (existingAcctSettings == null)
    13.6                              {
    13.7 -                                acctSettings = new PEPAccountSettings();
    13.8 -                                acctSettings.SmtpAddress = entry.Key;
    13.9 -                                acctSettings.IsSecureStorageEnabled = entry.Value;
   13.10 +                                acctSettings = new PEPAccountSettings
   13.11 +                                {
   13.12 +                                    SmtpAddress = entry.Key,
   13.13 +                                    IsSecureStorageEnabled = entry.Value
   13.14 +                                };
   13.15  
   13.16                                  this._AccountSettingsList.Add(acctSettings);
   13.17                              }
   13.18 @@ -2150,20 +2152,19 @@
   13.19              /// <returns>The deep copy of the object.</returns>
   13.20              public PEPAccountSettings Copy()
   13.21              {
   13.22 -                PEPAccountSettings copy = new PEPAccountSettings();
   13.23 -
   13.24 -                copy.AddDisclaimer = this._AddDisclaimer;
   13.25 -                copy.DisclaimerText = this._DisclaimerText;
   13.26 -                copy.IsDecryptAlwaysEnabled = this._IsDecryptAlwaysEnabled;
   13.27 -                copy.IsPEPEnabled = this._IsPEPEnabled;
   13.28 -                copy.IsSecureStorageEnabled = this._IsSecureStorageEnabled;
   13.29 -                copy.IsSyncEnabled = this._IsSyncEnabled;
   13.30 -                copy.SentFolderEntryId = this._SentFolderEntryId;
   13.31 -                copy.SmtpAddress = this._SmtpAddress;
   13.32 -                copy.Type = this._Type;
   13.33 -                copy.UserName = this._UserName;
   13.34 -
   13.35 -                return (copy);
   13.36 +                return new PEPAccountSettings
   13.37 +                {
   13.38 +                    AddDisclaimer = this._AddDisclaimer,
   13.39 +                    DisclaimerText = this._DisclaimerText,
   13.40 +                    IsDecryptAlwaysEnabled = this._IsDecryptAlwaysEnabled,
   13.41 +                    IsPEPEnabled = this._IsPEPEnabled,
   13.42 +                    IsSecureStorageEnabled = this._IsSecureStorageEnabled,
   13.43 +                    IsSyncEnabled = this._IsSyncEnabled,
   13.44 +                    SentFolderEntryId = this._SentFolderEntryId,
   13.45 +                    SmtpAddress = this._SmtpAddress,
   13.46 +                    Type = this._Type,
   13.47 +                    UserName = this._UserName
   13.48 +                };
   13.49              }
   13.50  
   13.51              /// <summary>
    14.1 --- a/ThisAddIn.cs	Fri Dec 14 11:19:41 2018 +0100
    14.2 +++ b/ThisAddIn.cs	Fri Dec 14 13:27:10 2018 +0100
    14.3 @@ -1370,8 +1370,10 @@
    14.4  
    14.5                      if (exists == false)
    14.6                      {
    14.7 -                        newIdent = new PEPIdentity();
    14.8 -                        newIdent.Fingerprint = this.ToQuadruple(fpr1, false);
    14.9 +                        newIdent = new PEPIdentity
   14.10 +                        {
   14.11 +                            Fingerprint = this.ToQuadruple(fpr1, false)
   14.12 +                        };
   14.13  
   14.14                          // Always put at the beginning so it's easier for the user to find
   14.15                          state.Blacklist.Insert(0, new KVPair<PEPIdentity, bool>(newIdent, true));
   14.16 @@ -2878,8 +2880,10 @@
   14.17                  (inboxCleaner == null))
   14.18              {
   14.19                  // Only enable if not yet enabled
   14.20 -                inboxCleaner = new System.Windows.Forms.Timer();
   14.21 -                inboxCleaner.Interval = Globals.TIMEOUT_SYNC_MESSAGE;
   14.22 +                inboxCleaner = new System.Windows.Forms.Timer
   14.23 +                {
   14.24 +                    Interval = Globals.TIMEOUT_SYNC_MESSAGE
   14.25 +                };
   14.26                  inboxCleaner.Tick += InboxCleaner_Tick;
   14.27                  inboxCleaner.Start();
   14.28                  Log.Verbose("ToggleInboxCleaning: Automatic inbox cleaning enabled");
   14.29 @@ -2940,8 +2944,7 @@
   14.30  
   14.31                          if (folder != null)
   14.32                          {
   14.33 -                            int foundMessages, deletedMessages;
   14.34 -                            this.CleanFolder(store, folder, out foundMessages, out deletedMessages);
   14.35 +                            this.CleanFolder(store, folder, out int foundMessages, out int deletedMessages);
   14.36                              messagesCounter += foundMessages;
   14.37                              deletedMessagesCounter += deletedMessages;
   14.38                          }
   14.39 @@ -2963,8 +2966,7 @@
   14.40  
   14.41                          if (folder != null)
   14.42                          {
   14.43 -                            int foundMessages, deletedMessages;
   14.44 -                            this.CleanFolder(store, folder, out foundMessages, out deletedMessages);
   14.45 +                            this.CleanFolder(store, folder, out int foundMessages, out int deletedMessages);
   14.46                              messagesCounter += foundMessages;
   14.47                              deletedMessagesCounter += deletedMessages;
   14.48                          }
   14.49 @@ -3137,8 +3139,10 @@
   14.50              if ((Globals.RELEASE_MODE == Globals.ReleaseMode.Reader) &&
   14.51                  (this._Settings.IsReaderSplashEnabled == true))
   14.52              {
   14.53 -                System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
   14.54 -                timer.Interval = 6000; // Interval to ensure Outlook loads
   14.55 +                System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer
   14.56 +                {
   14.57 +                    Interval = 6000 // Interval to ensure Outlook loads
   14.58 +                };
   14.59                  timer.Tick += (s, ev) =>
   14.60                  {
   14.61                      var splashScreen = new FormReaderSplash();
   14.62 @@ -3317,7 +3321,6 @@
   14.63                          string sendUnencryptedWarning = Properties.Resources.Message_SendError + Environment.NewLine + Environment.NewLine + Properties.Resources.Message_SendUnencryptedConfirmation;
   14.64                          DialogResult result;
   14.65                          MsgProcessor processor;
   14.66 -                        PEPMessage message;
   14.67                          Globals.ReturnStatus status;
   14.68                          cmi = new CryptableMailItem(omi);
   14.69  
   14.70 @@ -3325,12 +3328,11 @@
   14.71                          {
   14.72                              Log.Verbose("Application_ItemSend: Starting encryption and message processing.");
   14.73  
   14.74 -                            status = PEPMessage.Create(omi, out message);
   14.75 +                            status = PEPMessage.Create(omi, out PEPMessage message);
   14.76                              if (status == Globals.ReturnStatus.Success)
   14.77                              {
   14.78 -                                PEPMessage processedMessage;
   14.79                                  processor = new MsgProcessor();
   14.80 -                                if (processor.ProcessSentMessage(message, Globals.ThisAddIn.Settings.ExtraKeys, out processedMessage) != Globals.ReturnStatus.Success)
   14.81 +                                if (processor.ProcessSentMessage(message, Globals.ThisAddIn.Settings.ExtraKeys, out PEPMessage processedMessage) != Globals.ReturnStatus.Success)
   14.82                                  {
   14.83                                      throw new Exception("Error processing message.");
   14.84                                  }
    15.1 --- a/UI/FormControlCrashReport.xaml.cs	Fri Dec 14 11:19:41 2018 +0100
    15.2 +++ b/UI/FormControlCrashReport.xaml.cs	Fri Dec 14 13:27:10 2018 +0100
    15.3 @@ -250,13 +250,12 @@
    15.4              /// <returns>The deep copy of the object.</returns>
    15.5              public State Copy()
    15.6              {
    15.7 -                State copy = new State();
    15.8 -
    15.9 -                copy.AddressTo = this._AddressTo;
   15.10 -                copy.AddressFrom = this._AddressFrom;
   15.11 -                copy.ReportText = this._ReportText;
   15.12 -
   15.13 -                return (copy);
   15.14 +                return new State
   15.15 +                {
   15.16 +                    AddressTo = this._AddressTo,
   15.17 +                    AddressFrom = this._AddressFrom,
   15.18 +                    ReportText = this._ReportText
   15.19 +                };
   15.20              }
   15.21  
   15.22              /// <summary>
    16.1 --- a/UI/FormRegionPreviewUnencrypted.cs	Fri Dec 14 11:19:41 2018 +0100
    16.2 +++ b/UI/FormRegionPreviewUnencrypted.cs	Fri Dec 14 13:27:10 2018 +0100
    16.3 @@ -333,7 +333,6 @@
    16.4          /// <returns>The response item or null if an error occured.</returns>
    16.5          private Outlook.MailItem CreateResponseItem(ReplyAction replyAction)
    16.6          {
    16.7 -            PEPMessage message;
    16.8              PEPMessage decryptedMessage = null;
    16.9              Outlook.Attachments attachments;
   16.10              Outlook.MailItem omi;
   16.11 @@ -349,7 +348,7 @@
   16.12                  omi = this.OutlookItem as Outlook.MailItem;
   16.13  
   16.14                  // Use mirror or create it from original
   16.15 -                if (((PEPMessage.Create(omi, out message) == Globals.ReturnStatus.Success) &&
   16.16 +                if (((PEPMessage.Create(omi, out PEPMessage message) == Globals.ReturnStatus.Success) &&
   16.17                       (msgProcessor.Decrypt(message, out decryptedMessage))))
   16.18                  {
   16.19                      // Create reply of current item
    17.1 --- a/UI/KeySyncWizard.xaml.cs	Fri Dec 14 11:19:41 2018 +0100
    17.2 +++ b/UI/KeySyncWizard.xaml.cs	Fri Dec 14 13:27:10 2018 +0100
    17.3 @@ -681,8 +681,7 @@
    17.4          {
    17.5              bool success = false;
    17.6  
    17.7 -            HandshakeItem item;
    17.8 -            if (HandshakeItem.Create(this.Myself, this.Partner, false, out item) == Globals.ReturnStatus.Success)
    17.9 +            if (HandshakeItem.Create(this.Myself, this.Partner, false, out HandshakeItem item) == Globals.ReturnStatus.Success)
   17.10              {
   17.11                  item.AreTabControlsVisible = false;
   17.12                  item.ActiveTab = (this.Type == WizardType.pEp) ? HandshakeItem.Tabs.Trustwords : HandshakeItem.Tabs.Fingerprint;
   17.13 @@ -1696,8 +1695,10 @@
   17.14                  {
   17.15                      int counter = 0;
   17.16                      ns = Globals.ThisAddIn.Application.Session;
   17.17 -                    timer = new System.Windows.Forms.Timer();
   17.18 -                    timer.Interval = FAST_POLLING_INTERVAL;
   17.19 +                    timer = new System.Windows.Forms.Timer
   17.20 +                    {
   17.21 +                        Interval = FAST_POLLING_INTERVAL
   17.22 +                    };
   17.23                      timer.Tick += (s, e) =>
   17.24                      {
   17.25                          if (counter++ < MAX_POLLING_COUNT)
    18.1 --- a/UI/RibbonCustomizations.cs	Fri Dec 14 11:19:41 2018 +0100
    18.2 +++ b/UI/RibbonCustomizations.cs	Fri Dec 14 13:27:10 2018 +0100
    18.3 @@ -453,9 +453,11 @@
    18.4                  state.SelectedPage = page;
    18.5  
    18.6                  // Build form and state
    18.7 -                form = new FormOptions();
    18.8 -                form.StartPosition = FormStartPosition.CenterParent;
    18.9 -                form.DisplayState = state;
   18.10 +                form = new FormOptions
   18.11 +                {
   18.12 +                    StartPosition = FormStartPosition.CenterParent,
   18.13 +                    DisplayState = state
   18.14 +                };
   18.15  
   18.16                  result = form.ShowDialog(); // Must show as dialog to block code
   18.17  
    19.1 --- a/Wrappers/WatchedExplorer.cs	Fri Dec 14 11:19:41 2018 +0100
    19.2 +++ b/Wrappers/WatchedExplorer.cs	Fri Dec 14 13:27:10 2018 +0100
    19.3 @@ -272,8 +272,10 @@
    19.4  
    19.5                  if (omi != null)
    19.6                  {
    19.7 -                    this.inlineResponseItem = new CryptableMailItem(omi, null, false);
    19.8 -                    this.inlineResponseItem.IsInlineResponse = true;
    19.9 +                    this.inlineResponseItem = new CryptableMailItem(omi, null, false)
   19.10 +                    {
   19.11 +                        IsInlineResponse = true
   19.12 +                    };
   19.13                  }
   19.14              }
   19.15              catch (Exception ex)
    20.1 --- a/Wrappers/WatchedWindow.cs	Fri Dec 14 11:19:41 2018 +0100
    20.2 +++ b/Wrappers/WatchedWindow.cs	Fri Dec 14 13:27:10 2018 +0100
    20.3 @@ -264,10 +264,8 @@
    20.4                                          (string.IsNullOrEmpty(message.ForceProtectionId)))
    20.5                                      {
    20.6                                          var msgProcessor = new MsgProcessor();
    20.7 -                                        PEPMessage decryptedMsg = null;
    20.8 -                                        string[] keyList;
    20.9                                          pEpDecryptFlags flags = pEpDecryptFlags.pEpDecryptFlagsNone;
   20.10 -                                        pEpRating rating = msgProcessor.Decrypt(ref message, out decryptedMsg, out keyList, ref flags);
   20.11 +                                        pEpRating rating = msgProcessor.Decrypt(ref message, out PEPMessage decryptedMsg, out string[] keyList, ref flags);
   20.12                                          if (decryptedMsg != null)
   20.13                                          {
   20.14                                              message = decryptedMsg;
   20.15 @@ -440,7 +438,6 @@
   20.16                          if (this.CurrentMailItem.GetIsAttachedMail(out messageId))
   20.17                          {
   20.18                              Outlook.MailItem mirror = null;
   20.19 -                            PEPMessage pEpMessage;
   20.20  
   20.21                              // Try to get the mirror
   20.22                              mirror = this.CurrentMailItem.GetMirror(messageId);
   20.23 @@ -452,12 +449,11 @@
   20.24                              }
   20.25                              else
   20.26                              {
   20.27 -                                if ((PEPMessage.Create(this.CurrentMailItem, out pEpMessage) == Globals.ReturnStatus.Success) &&
   20.28 +                                if ((PEPMessage.Create(this.CurrentMailItem, out PEPMessage pEpMessage) == Globals.ReturnStatus.Success) &&
   20.29                                      (pEpMessage.IsSecure))
   20.30                                  {
   20.31 -                                    PEPMessage decryptedMessage;
   20.32                                      MsgProcessor msgProcessor = new MsgProcessor();
   20.33 -                                    if (msgProcessor.Decrypt(pEpMessage, out decryptedMessage))
   20.34 +                                    if (msgProcessor.Decrypt(pEpMessage, out PEPMessage decryptedMessage))
   20.35                                      {
   20.36                                          isSecureAttachedMail = true;
   20.37                                          mirror = this.CurrentMailItem.CreateMirrorOMI(messageId);
   20.38 @@ -508,10 +504,11 @@
   20.39                      this.GetFormRegionPreviewUnencrypted()?.DisplayState?.SetMessage(cacheItem.Mirror);
   20.40                  }
   20.41  
   20.42 -                this.cryptableMailItem = new CryptableMailItem(this.CurrentMailItem, provisionalRating);
   20.43 -
   20.44 -                // Set inline response property
   20.45 -                this.cryptableMailItem.IsInlineResponse = isInlineResponse;
   20.46 +                this.cryptableMailItem = new CryptableMailItem(this.CurrentMailItem, provisionalRating)
   20.47 +                {
   20.48 +                    // Set inline response property
   20.49 +                    IsInlineResponse = isInlineResponse
   20.50 +                };
   20.51  
   20.52                  // Set properties for encrypted attached mail
   20.53                  if (isSecureAttachedMail)
   20.54 @@ -901,7 +898,6 @@
   20.55          /// </summary>
   20.56          private void SetIsEnabled(bool enabled)
   20.57          {
   20.58 -            PEPIdentity currIdent;
   20.59              Globals.ReturnStatus sts;
   20.60              Outlook.Recipient currUser = null;
   20.61              Outlook.Account currAccount = null;
   20.62 @@ -930,7 +926,7 @@
   20.63                              {
   20.64                                  ns = Globals.ThisAddIn.Application.Session;
   20.65                                  currUser = ns.CurrentUser;
   20.66 -                                sts = PEPIdentity.Create(currUser, out currIdent);
   20.67 +                                sts = PEPIdentity.Create(currUser, out PEPIdentity currIdent);
   20.68  
   20.69                                  if (sts == Globals.ReturnStatus.Success)
   20.70                                  {
   20.71 @@ -1189,8 +1185,7 @@
   20.72                          if ((e.Mirror == null) &&
   20.73                              (this.CurrentMailItem?.GetIsForcefullyProtected() == true))
   20.74                          {
   20.75 -                            PEPMessage mirror = null;
   20.76 -                            if (PEPMessage.Create(this.CurrentMailItem, out mirror) == Globals.ReturnStatus.Success)
   20.77 +                            if (PEPMessage.Create(this.CurrentMailItem, out PEPMessage mirror) == Globals.ReturnStatus.Success)
   20.78                              {
   20.79                                  e.Mirror = mirror;
   20.80                              }