Renaming enums and exceptions
authorThomas
Mon, 27 Nov 2017 12:06:46 +0100
changeset 193683060fe7965d
parent 1934 7162e9741ce0
child 1937 afdb0f400520
child 1938 5985d2fecec7
Renaming enums and exceptions
AdapterCallbacks.cs
CryptableMailItem.cs
Extensions/MailItemExtensions.cs
Extensions/StoreExtensions.cs
FPPMessage.cs
Globals.cs
Log.cs
PEPAttachment.cs
PEPIdentity.cs
PEPMessage.cs
ThisAddIn.cs
UI/FormControlPreviewMessage.xaml.cs
UI/FormRegionPrivacyStatus.cs
UI/HandshakeDialog.xaml.cs
     1.1 --- a/AdapterCallbacks.cs	Mon Nov 27 11:40:18 2017 +0100
     1.2 +++ b/AdapterCallbacks.cs	Mon Nov 27 12:06:46 2017 +0100
     1.3 @@ -73,9 +73,9 @@
     1.4                  {
     1.5                      handshakeDialog.Close();
     1.6                  }
     1.7 -                catch (Exception e)
     1.8 +                catch (Exception ex)
     1.9                  {
    1.10 -                    Log.Error("Could not close handshake dialog. " + e.Message);
    1.11 +                    Log.Error("Could not close handshake dialog. " + ex.ToString());
    1.12                  }
    1.13  
    1.14                  // We set the result in case of an reentrant call, so the
    1.15 @@ -299,9 +299,9 @@
    1.16                      };
    1.17                      timer.Start();
    1.18                  }
    1.19 -                catch (Exception e)
    1.20 +                catch (Exception ex)
    1.21                  {
    1.22 -                    Log.Verbose("NeedFastPolling: Error occured. " + e.Message);
    1.23 +                    Log.Verbose("NeedFastPolling: Error occured. " + ex.ToString());
    1.24                      timer?.Stop();
    1.25                      timer?.Dispose();
    1.26                      timer = null;
     2.1 --- a/CryptableMailItem.cs	Mon Nov 27 11:40:18 2017 +0100
     2.2 +++ b/CryptableMailItem.cs	Mon Nov 27 12:06:46 2017 +0100
     2.3 @@ -403,9 +403,9 @@
     2.4                          }
     2.5                      }
     2.6                  }
     2.7 -                catch (Exception e)
     2.8 +                catch (Exception ex)
     2.9                  {
    2.10 -                    Log.Error("MailItem_Write: Error while saving to pEp Drafts folder. " + e.Message);
    2.11 +                    Log.Error("MailItem_Write: Error while saving to pEp Drafts folder. " + ex.ToString());
    2.12                      useFallback = true;
    2.13                  }
    2.14                  finally
    2.15 @@ -936,9 +936,9 @@
    2.16                                  originalRating = (pEpRating)rating;
    2.17                              }
    2.18                          }
    2.19 -                        catch (Exception e)
    2.20 +                        catch (Exception ex)
    2.21                          {
    2.22 -                            Log.Warning("CryptableMailItem.OriginalRating: Error getting original rating. " + e.Message);
    2.23 +                            Log.Warning("CryptableMailItem.OriginalRating: Error getting original rating. " + ex.ToString());
    2.24                              originalRating = pEpRating.pEpRatingUndefined;
    2.25                          }
    2.26                      }
    2.27 @@ -1259,9 +1259,9 @@
    2.28                              result = AdapterExtensions.ReevaluateMessageRating(mirror);
    2.29                          }
    2.30                      }
    2.31 -                    catch (Exception e)
    2.32 +                    catch (Exception ex)
    2.33                      {
    2.34 -                        Log.Error("ProcessAndGetRating: Error reevaluating mirror rating. " + e.Message);
    2.35 +                        Log.Error("ProcessAndGetRating: Error reevaluating mirror rating. " + ex.ToString());
    2.36                          result = mirror.Rating;
    2.37                      }
    2.38  
    2.39 @@ -1305,9 +1305,9 @@
    2.40                          {
    2.41                              result = AdapterExtensions.ReevaluateMessageRating(mirror);
    2.42                          }
    2.43 -                        catch (Exception e)
    2.44 +                        catch (Exception ex)
    2.45                          {
    2.46 -                            Log.Error("ProcessAndGetRating: Error reevaluating mirror rating. " + e.Message);
    2.47 +                            Log.Error("ProcessAndGetRating: Error reevaluating mirror rating. " + ex.ToString());
    2.48                              result = mirror.Rating;
    2.49                          }
    2.50                      }
    2.51 @@ -1339,9 +1339,9 @@
    2.52                              }
    2.53                          }
    2.54                      }
    2.55 -                    catch (Exception e)
    2.56 +                    catch (Exception ex)
    2.57                      {
    2.58 -                        Log.Error("ProcessAndGetRating: Could not set pEp internal category, " + e.ToString());
    2.59 +                        Log.Error("ProcessAndGetRating: Could not set pEp internal category, " + ex.ToString());
    2.60                      }
    2.61  
    2.62                      /* Apply a custom message class to secure mail items in secure stores (doesn't apply for pEp internal messages). This is needed for the
    2.63 @@ -1359,9 +1359,9 @@
    2.64                              MapiHelper.SetProperty(this.internalMailItem, MapiProperty.PidTagMessageClass, MapiPropertyValue.PidTagMessageClassSecurePEP);
    2.65                              preProcessingPropertySet = true;
    2.66                          }
    2.67 -                        catch (Exception e)
    2.68 +                        catch (Exception ex)
    2.69                          {
    2.70 -                            Log.Error("ProcessAndGetRating: Could not set custom message class, " + e.ToString());
    2.71 +                            Log.Error("ProcessAndGetRating: Could not set custom message class, " + ex.ToString());
    2.72                          }
    2.73                      }
    2.74  
    2.75 @@ -1372,9 +1372,9 @@
    2.76                          {
    2.77                              this.internalMailItem.Save();
    2.78                          }
    2.79 -                        catch (Exception e)
    2.80 +                        catch (Exception ex)
    2.81                          {
    2.82 -                            Log.Error("ProcessAndGetRating: Could not save pre-processing properties, " + e.ToString());
    2.83 +                            Log.Error("ProcessAndGetRating: Could not save pre-processing properties, " + ex.ToString());
    2.84                          }
    2.85                      }
    2.86  
    2.87 @@ -1503,10 +1503,10 @@
    2.88                                          mailItem.Save();
    2.89                                          break;
    2.90                                      }
    2.91 -                                    catch (Exception e)
    2.92 +                                    catch (Exception ex)
    2.93                                      {
    2.94                                          Log.Warning("ProcessAndGetRating: Failed to save MailItem, try " +
    2.95 -                                                    curCount.ToString() + "/" + maxRetryCount.ToString() + ". Error: " + e.Message);
    2.96 +                                                    curCount.ToString() + "/" + maxRetryCount.ToString() + ". Error: " + ex.ToString());
    2.97                                      }
    2.98  
    2.99                                      curCount++;
   2.100 @@ -1899,9 +1899,9 @@
   2.101                      MapiHelper.SetProperty(omi, MapiProperty.PidTagMessageDeliveryTime, this.internalMailItem.ReceivedTime.ToUniversalTime());
   2.102                      MapiHelper.SetProperty(omi, MapiProperty.PidTagClientSubmitTime, this.internalMailItem.SentOn.ToUniversalTime());
   2.103                  }
   2.104 -                catch (Exception e)
   2.105 +                catch (Exception ex)
   2.106                  {
   2.107 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set received and sent time. " + e.Message);
   2.108 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set received and sent time. " + ex.ToString());
   2.109                      throw;
   2.110                  }
   2.111  
   2.112 @@ -1910,9 +1910,9 @@
   2.113                  {
   2.114                      omi.Sender = this.internalMailItem.Sender;
   2.115                  }
   2.116 -                catch (Exception e)
   2.117 +                catch (Exception ex)
   2.118                  {
   2.119 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set sender directly. " + e.Message);
   2.120 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set sender directly. " + ex.ToString());
   2.121                  }
   2.122  
   2.123                  try
   2.124 @@ -1923,9 +1923,9 @@
   2.125                      // Entry ID is needed to resolve the sender so a reply is possible without having to re-enter address, this is last in case it fails
   2.126                      MapiHelper.SetProperty(omi, MapiProperty.PidTagSenderEntryId, MapiHelper.GetProperty(this.internalMailItem, MapiProperty.PidTagSenderEntryId));
   2.127                  }
   2.128 -                catch (Exception e)
   2.129 +                catch (Exception ex)
   2.130                  {
   2.131 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set sender through MAPI properties. " + e.Message);
   2.132 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set sender through MAPI properties. " + ex.ToString());
   2.133                      throw;
   2.134                  }
   2.135  
   2.136 @@ -1933,9 +1933,9 @@
   2.137                  {
   2.138                      omi.SendUsingAccount = this.internalMailItem.SendUsingAccount;
   2.139                  }
   2.140 -                catch (Exception e)
   2.141 +                catch (Exception ex)
   2.142                  {
   2.143 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set SendUsingAccount. " + e.Message);
   2.144 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set SendUsingAccount. " + ex.ToString());
   2.145                  }
   2.146  
   2.147                  // Set flags
   2.148 @@ -1946,9 +1946,9 @@
   2.149                  {
   2.150                      MapiHelper.SetProperty(omi, MapiProperty.PidTagMessageFlags, messageFlags);
   2.151                  }
   2.152 -                catch (Exception e)
   2.153 +                catch (Exception ex)
   2.154                  {
   2.155 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set message flags. " + e.Message);
   2.156 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set message flags. " + ex.ToString());
   2.157                  }
   2.158  
   2.159                  // Conversation information
   2.160 @@ -1974,9 +1974,9 @@
   2.161                      MapiHelper.SetProperty(omi, MapiProperty.PidTagConversationIndexTracking, false);
   2.162                      MapiHelper.SetProperty(omi, MapiProperty.PidTagConversationTopic, this.internalMailItem.ConversationTopic);
   2.163                  }
   2.164 -                catch (Exception e)
   2.165 +                catch (Exception ex)
   2.166                  {
   2.167 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set conversation information. " + e.Message);
   2.168 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set conversation information. " + ex.ToString());
   2.169                  }
   2.170  
   2.171                  omi.To = this.internalMailItem.To;
   2.172 @@ -2050,9 +2050,9 @@
   2.173                                          MapiHelper.GetProperty(this.internalMailItem, MapiProperty.PidTagReceivedByName),
   2.174                                          Outlook.OlUserPropertyType.olText);
   2.175                  }
   2.176 -                catch (Exception e)
   2.177 +                catch (Exception ex)
   2.178                  {
   2.179 -                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set received-by information. " + e.Message);
   2.180 +                    Log.Verbose("CryptableMailItem.CreateMirrorOMI: Failed to set received-by information. " + ex.ToString());
   2.181                  }
   2.182  
   2.183                  // Mark the mail item as a mirror
   2.184 @@ -2082,9 +2082,9 @@
   2.185                  omi.Move(folder);
   2.186                  created = true;
   2.187              }
   2.188 -            catch (Exception e)
   2.189 +            catch (Exception ex)
   2.190              {
   2.191 -                Log.Verbose("CreateMirrorOMI: Creating new mail item failed. " + e.Message);
   2.192 +                Log.Verbose("CreateMirrorOMI: Creating new mail item failed. " + ex.ToString());
   2.193                  omi.PermanentlyDelete();
   2.194                  omi = null;
   2.195              }
   2.196 @@ -2163,9 +2163,9 @@
   2.197                      // WARNING: this creates a new mail item that will no longer be referenced here!!
   2.198                      omi.Move(folder);
   2.199                  }
   2.200 -                catch (Exception e)
   2.201 +                catch (Exception ex)
   2.202                  {
   2.203 -                    Log.Error("CreateMirrorOMI: Creating by copy failed. " + e.Message);
   2.204 +                    Log.Error("CreateMirrorOMI: Creating by copy failed. " + ex.ToString());
   2.205                  }
   2.206                  finally
   2.207                  {
   2.208 @@ -2400,10 +2400,10 @@
   2.209                          }
   2.210                      }
   2.211                  }
   2.212 -                catch (Exception e)
   2.213 +                catch (Exception ex)
   2.214                  {
   2.215                      mirror = null;
   2.216 -                    Log.Error("FindMirrorOMI: Error searching for mirror omi. " + e.Message);
   2.217 +                    Log.Error("FindMirrorOMI: Error searching for mirror omi. " + ex.ToString());
   2.218                  }
   2.219                  finally
   2.220                  {
     3.1 --- a/Extensions/MailItemExtensions.cs	Mon Nov 27 11:40:18 2017 +0100
     3.2 +++ b/Extensions/MailItemExtensions.cs	Mon Nov 27 12:06:46 2017 +0100
     3.3 @@ -872,10 +872,10 @@
     3.4                  store = folder.Store;
     3.5                  maxFileSize = store.GetMaxSubmitSize();
     3.6              }
     3.7 -            catch (Exception e)
     3.8 +            catch (Exception ex)
     3.9              {
    3.10                  maxFileSize = 0;
    3.11 -                Log.Error("GetMaxMailSize: failure occured, returning default. " + e.Message);
    3.12 +                Log.Error("GetMaxMailSize: failure occured, returning default. " + ex.ToString());
    3.13              }
    3.14              finally
    3.15              {
    3.16 @@ -1001,9 +1001,9 @@
    3.17                  {
    3.18                      mailItem.Save();
    3.19                  }
    3.20 -                catch (Exception e)
    3.21 +                catch (Exception ex)
    3.22                  {
    3.23 -                    Log.Error("PermanentlyDelete: Error saving mail item. " + e.Message);
    3.24 +                    Log.Error("PermanentlyDelete: Error saving mail item. " + ex.ToString());
    3.25                  }
    3.26  
    3.27                  // Locate the store for the mailitem if none was given
    3.28 @@ -1056,18 +1056,18 @@
    3.29                      {
    3.30                          deletedMailItem.Save();
    3.31                      }
    3.32 -                    catch (Exception e)
    3.33 +                    catch (Exception ex)
    3.34                      {
    3.35 -                        Log.Error("PermanentlyDelete: Error saving deleted mail item. " + e.Message);
    3.36 +                        Log.Error("PermanentlyDelete: Error saving deleted mail item. " + ex.ToString());
    3.37                      }
    3.38  
    3.39                      // Now that the mail item is in the deleted folder, calling .Delete() will delete permanently
    3.40                      deletedMailItem.Delete();
    3.41                      deleted = true;
    3.42                  }
    3.43 -                catch (Exception e)
    3.44 +                catch (Exception ex)
    3.45                  {
    3.46 -                    Log.Error("PermanentlyDelete: Error deleting. " + e.Message);
    3.47 +                    Log.Error("PermanentlyDelete: Error deleting. " + ex.ToString());
    3.48                  }
    3.49                  finally
    3.50                  {
    3.51 @@ -1105,9 +1105,9 @@
    3.52                      {
    3.53                          mailItem.Save();
    3.54                      }
    3.55 -                    catch (Exception e)
    3.56 +                    catch (Exception ex)
    3.57                      {
    3.58 -                        Log.Error("PermanentlyDelete: Error saving mail item. " + e.Message);
    3.59 +                        Log.Error("PermanentlyDelete: Error saving mail item. " + ex.ToString());
    3.60                      }
    3.61  
    3.62                      // Delete the mail item moving to deleted items folder
    3.63 @@ -1497,9 +1497,9 @@
    3.64                      properties = omi.UserProperties;
    3.65                      up = properties.Find(name);
    3.66                  }
    3.67 -                catch (Exception e)
    3.68 +                catch (Exception ex)
    3.69                  {
    3.70 -                    Log.Verbose("MailItemExtensions.GetUserProperty: Error getting user properties. " + e.Message);
    3.71 +                    Log.Verbose("MailItemExtensions.GetUserProperty: Error getting user properties. " + ex.ToString());
    3.72                      up = null;
    3.73                  }
    3.74  
    3.75 @@ -1596,9 +1596,9 @@
    3.76                          mimeParser = new MimeParser(stream);
    3.77                          headers = mimeParser.ParseHeaders();
    3.78                      }
    3.79 -                    catch (Exception e)
    3.80 +                    catch (Exception ex)
    3.81                      {
    3.82 -                        Log.Error("GetParsedTransportMessageHeaders: Failed to parse MIME headers, " + e.ToString());
    3.83 +                        Log.Error("GetParsedTransportMessageHeaders: Failed to parse MIME headers, " + ex.ToString());
    3.84                      }
    3.85                      finally
    3.86                      {
     4.1 --- a/Extensions/StoreExtensions.cs	Mon Nov 27 11:40:18 2017 +0100
     4.2 +++ b/Extensions/StoreExtensions.cs	Mon Nov 27 12:06:46 2017 +0100
     4.3 @@ -413,10 +413,10 @@
     4.4                  propertyAccessor = store.PropertyAccessor;
     4.5                  maxFileSize = propertyAccessor.GetProperty(MapiProperty.PidTagMaximumSubmitMessageSize.DaslName);
     4.6              }
     4.7 -            catch (Exception e)
     4.8 +            catch (Exception ex)
     4.9              {
    4.10                  maxFileSize = DEFAULT_MAX_SIZE;
    4.11 -                Log.Verbose("GetMaxSubmitSize: Error getting size limit. " + e.Message);
    4.12 +                Log.Verbose("GetMaxSubmitSize: Error getting size limit. " + ex.ToString());
    4.13              }
    4.14              finally
    4.15              {
     5.1 --- a/FPPMessage.cs	Mon Nov 27 11:40:18 2017 +0100
     5.2 +++ b/FPPMessage.cs	Mon Nov 27 12:06:46 2017 +0100
     5.3 @@ -45,7 +45,7 @@
     5.4          /// <summary>
     5.5          /// The message types that are supported by the FPP.
     5.6          /// </summary>
     5.7 -        public enum MessageTypes
     5.8 +        public enum MessageType
     5.9          {
    5.10              InitialMessage,
    5.11              AnswerMessage,
    5.12 @@ -55,7 +55,7 @@
    5.13          /// <summary>
    5.14          /// The database tables used for FPP message processing.
    5.15          /// </summary>
    5.16 -        private enum DatabaseTables
    5.17 +        private enum DatabaseTable
    5.18          {
    5.19              Keys,
    5.20              EntryIds
    5.21 @@ -102,13 +102,13 @@
    5.22          /// Gets the message type of this PEPMessage
    5.23          /// </summary>
    5.24          /// <returns>The message type of the PEPMessage</returns>
    5.25 -        public MessageTypes? GetMessageType()
    5.26 +        public MessageType? GetMessageType()
    5.27          {
    5.28 -            MessageTypes? msgType = null;
    5.29 +            MessageType? msgType = null;
    5.30  
    5.31              for (int i = 0; i < this.CurrentMessage?.Attachments?.Count; i++)
    5.32              {
    5.33 -                MessageTypes type;
    5.34 +                MessageType type;
    5.35                  PEPAttachment attachment = this.CurrentMessage.Attachments[i];
    5.36  
    5.37                  // Check attachments for message type identifier
    5.38 @@ -121,7 +121,7 @@
    5.39                  else if ((attachment.FileName?.StartsWith("message") == true) &&
    5.40                           (attachment.FileName?.EndsWith(".pEp") == true))
    5.41                  {
    5.42 -                    msgType = MessageTypes.InitialMessage;
    5.43 +                    msgType = MessageType.InitialMessage;
    5.44                  }
    5.45              }
    5.46  
    5.47 @@ -137,14 +137,14 @@
    5.48          {
    5.49              string key = null;
    5.50              PEPAttachment attachment = null;
    5.51 -            MessageTypes msgType = MessageTypes.InitialMessage;
    5.52 +            MessageType msgType = MessageType.InitialMessage;
    5.53  
    5.54              for (int i = 0; i < this.CurrentMessage?.Attachments?.Count; i++)
    5.55              {
    5.56                  attachment = this.CurrentMessage.Attachments[i];
    5.57  
    5.58                  if ((attachment.IsFPPAttachment(out msgType)) &&
    5.59 -                    (msgType == MessageTypes.KeyTransportMessage))
    5.60 +                    (msgType == MessageType.KeyTransportMessage))
    5.61                  {
    5.62                      key = Encoding.UTF8.GetString(attachment.Data);
    5.63                      break;
    5.64 @@ -248,15 +248,15 @@
    5.65          public Globals.ReturnStatus ContinueProcessing()
    5.66          {
    5.67              Globals.ReturnStatus status = Globals.ReturnStatus.Success;
    5.68 -            MessageTypes? currentMsgType = this.GetMessageType();
    5.69 +            MessageType? currentMsgType = this.GetMessageType();
    5.70  
    5.71              switch (currentMsgType)
    5.72              {
    5.73 -                case FPPMessage.MessageTypes.InitialMessage:
    5.74 +                case FPPMessage.MessageType.InitialMessage:
    5.75                      {
    5.76                          // Check if key is in db and decrypt in this case
    5.77                          string key = null;
    5.78 -                        if ((FPPMessage.GetValueFromDb(DatabaseTables.Keys, this.CurrentMessage.ForceProtectionId, out key) == Globals.ReturnStatus.Success) &&
    5.79 +                        if ((FPPMessage.GetValueFromDb(DatabaseTable.Keys, this.CurrentMessage.ForceProtectionId, out key) == Globals.ReturnStatus.Success) &&
    5.80                              (key != null))
    5.81                          {
    5.82                              // Decrypt message
    5.83 @@ -268,10 +268,10 @@
    5.84                          else
    5.85                          {
    5.86                              // Save the EntryId
    5.87 -                            FPPMessage.InsertMsgIdAndValueInDb(DatabaseTables.EntryIds, this.CurrentMessage.ForceProtectionId, this.CurrentEntryId);
    5.88 +                            FPPMessage.InsertMsgIdAndValueInDb(DatabaseTable.EntryIds, this.CurrentMessage.ForceProtectionId, this.CurrentEntryId);
    5.89  
    5.90                              // Create answer message
    5.91 -                            status = this.CreateAndSendNextFPPMessage(MessageTypes.AnswerMessage);
    5.92 +                            status = this.CreateAndSendNextFPPMessage(MessageType.AnswerMessage);
    5.93  
    5.94                              // Set form regions
    5.95                              WindowFormRegionCollection formRegions = Globals.FormRegions[Globals.ThisAddIn.Application.ActiveWindow()];
    5.96 @@ -292,7 +292,7 @@
    5.97                          }
    5.98                      }
    5.99                      break;
   5.100 -                case FPPMessage.MessageTypes.AnswerMessage:
   5.101 +                case FPPMessage.MessageType.AnswerMessage:
   5.102                      {
   5.103                          bool sendNextMessage = false;
   5.104                          Log.Verbose("FPPMessage.ContinueProcessing: Trusted Force Protection Protocol Answer Message found.");
   5.105 @@ -312,11 +312,11 @@
   5.106                          // Send Key Transport Message if required
   5.107                          if (sendNextMessage)
   5.108                          {
   5.109 -                            status = this.CreateAndSendNextFPPMessage(MessageTypes.KeyTransportMessage);
   5.110 +                            status = this.CreateAndSendNextFPPMessage(MessageType.KeyTransportMessage);
   5.111                          }
   5.112                      }
   5.113                      break;
   5.114 -                case FPPMessage.MessageTypes.KeyTransportMessage:
   5.115 +                case FPPMessage.MessageType.KeyTransportMessage:
   5.116                      {
   5.117                          bool importKeyAndDecrypt = false;
   5.118                          Log.Verbose("FPPMessage.ContinueProcessing: Trusted Force Protection Protocol Key Transport Message found.");
   5.119 @@ -342,14 +342,14 @@
   5.120                              if (string.IsNullOrEmpty(key) == false)
   5.121                              {
   5.122                                  // Save to database
   5.123 -                                status = FPPMessage.InsertMsgIdAndValueInDb(DatabaseTables.Keys, this.CurrentMessage.ForceProtectionId, key);
   5.124 +                                status = FPPMessage.InsertMsgIdAndValueInDb(DatabaseTable.Keys, this.CurrentMessage.ForceProtectionId, key);
   5.125                                  if (status == Globals.ReturnStatus.Success)
   5.126                                  {
   5.127                                      Log.Verbose("FPPMessage.ContinueProcessing: Message ID and key successfully stored in database.");
   5.128  
   5.129                                      // Lookup original
   5.130                                      string entryId = null;
   5.131 -                                    status = FPPMessage.GetValueFromDb(DatabaseTables.EntryIds, this.CurrentMessage.ForceProtectionId, out entryId);
   5.132 +                                    status = FPPMessage.GetValueFromDb(DatabaseTable.EntryIds, this.CurrentMessage.ForceProtectionId, out entryId);
   5.133                                      if ((status != Globals.ReturnStatus.Success) ||
   5.134                                          (string.IsNullOrEmpty(entryId)))
   5.135                                      {
   5.136 @@ -396,7 +396,7 @@
   5.137          /// <param name="currentMsg">The current message.</param>
   5.138          /// <param name="nextMessageType">The type of the next message.</param>
   5.139          /// <returns>The creation status.</returns>
   5.140 -        public Globals.ReturnStatus CreateAndSendNextFPPMessage(MessageTypes nextMessageType)
   5.141 +        public Globals.ReturnStatus CreateAndSendNextFPPMessage(MessageType nextMessageType)
   5.142          {
   5.143              Globals.ReturnStatus status = Globals.ReturnStatus.Failure;
   5.144              PEPMessage nextMsg = new PEPMessage();
   5.145 @@ -416,14 +416,14 @@
   5.146  
   5.147                  // Create the respective attachment according to type
   5.148                  PEPAttachment attachment = null;
   5.149 -                if (nextMessageType == MessageTypes.AnswerMessage)
   5.150 +                if (nextMessageType == MessageType.AnswerMessage)
   5.151                  {
   5.152                      attachment = new PEPAttachment();
   5.153                      attachment.FileName = PEP_FPP_ATTACHMENT_FILE_NAME;
   5.154                      attachment.MimeType = PEP_FPP_ATTACHMENT_MIME_TYPE;
   5.155                      Log.Verbose("CreateAndSendNextFPPMessage: Answer Message created.");
   5.156                  }
   5.157 -                else if (nextMessageType == MessageTypes.KeyTransportMessage)
   5.158 +                else if (nextMessageType == MessageType.KeyTransportMessage)
   5.159                  {
   5.160                      // Doublecheck rating
   5.161                      pEpRating identityRating = pEpRating.pEpRatingUndefined;
   5.162 @@ -444,7 +444,7 @@
   5.163  
   5.164                      // Get key from db and attach it
   5.165                      string key = null;
   5.166 -                    if ((FPPMessage.GetValueFromDb(DatabaseTables.Keys, this.CurrentMessage.ForceProtectionId, out key) == Globals.ReturnStatus.Success) &&
   5.167 +                    if ((FPPMessage.GetValueFromDb(DatabaseTable.Keys, this.CurrentMessage.ForceProtectionId, out key) == Globals.ReturnStatus.Success) &&
   5.168                          (key != null))
   5.169                      {
   5.170                          // Attach key
   5.171 @@ -768,9 +768,9 @@
   5.172                      MapiHelper.SetProperty(omi, MapiProperty.PidTagMessageDeliveryTime, original.ReceivedTime.ToUniversalTime());
   5.173                      MapiHelper.SetProperty(omi, MapiProperty.PidTagClientSubmitTime, original.SentOn.ToUniversalTime());
   5.174                  }
   5.175 -                catch (Exception e)
   5.176 +                catch (Exception ex)
   5.177                  {
   5.178 -                    Log.Verbose("CreateMirrorOMI: Failed to set received and sent time. " + e.Message);
   5.179 +                    Log.Verbose("CreateMirrorOMI: Failed to set received and sent time. " + ex.ToString());
   5.180                      throw;
   5.181                  }
   5.182  
   5.183 @@ -779,9 +779,9 @@
   5.184                  {
   5.185                      omi.Sender = original.Sender;
   5.186                  }
   5.187 -                catch (Exception e)
   5.188 +                catch (Exception ex)
   5.189                  {
   5.190 -                    Log.Verbose("CreateMirrorOMI: Failed to set sender directly. " + e.Message);
   5.191 +                    Log.Verbose("CreateMirrorOMI: Failed to set sender directly. " + ex.ToString());
   5.192                  }
   5.193  
   5.194                  try
   5.195 @@ -792,9 +792,9 @@
   5.196                      // Entry ID is needed to resolve the sender so a reply is possible without having to re-enter address, this is last in case it fails
   5.197                      MapiHelper.SetProperty(omi, MapiProperty.PidTagSenderEntryId, MapiHelper.GetProperty(original, MapiProperty.PidTagSenderEntryId));
   5.198                  }
   5.199 -                catch (Exception e)
   5.200 +                catch (Exception ex)
   5.201                  {
   5.202 -                    Log.Verbose("CreateMirrorOMI: Failed to set sender through MAPI properties. " + e.Message);
   5.203 +                    Log.Verbose("CreateMirrorOMI: Failed to set sender through MAPI properties. " + ex.ToString());
   5.204                      throw;
   5.205                  }
   5.206  
   5.207 @@ -802,9 +802,9 @@
   5.208                  {
   5.209                      omi.SendUsingAccount = original.SendUsingAccount;
   5.210                  }
   5.211 -                catch (Exception e)
   5.212 +                catch (Exception ex)
   5.213                  {
   5.214 -                    Log.Verbose("CreateMirrorOMI: Failed to set SendUsingAccount. " + e.Message);
   5.215 +                    Log.Verbose("CreateMirrorOMI: Failed to set SendUsingAccount. " + ex.ToString());
   5.216                  }
   5.217  
   5.218                  // Set flags
   5.219 @@ -815,9 +815,9 @@
   5.220                  {
   5.221                      MapiHelper.SetProperty(omi, MapiProperty.PidTagMessageFlags, messageFlags);
   5.222                  }
   5.223 -                catch (Exception e)
   5.224 +                catch (Exception ex)
   5.225                  {
   5.226 -                    Log.Verbose("CreateMirrorOMI: Failed to set message flags. " + e.Message);
   5.227 +                    Log.Verbose("CreateMirrorOMI: Failed to set message flags. " + ex.ToString());
   5.228                  }
   5.229  
   5.230                  // Conversation information
   5.231 @@ -843,9 +843,9 @@
   5.232                      MapiHelper.SetProperty(omi, MapiProperty.PidTagConversationIndexTracking, false);
   5.233                      MapiHelper.SetProperty(omi, MapiProperty.PidTagConversationTopic, original.ConversationTopic);
   5.234                  }
   5.235 -                catch (Exception e)
   5.236 +                catch (Exception ex)
   5.237                  {
   5.238 -                    Log.Verbose("CreateMirrorOMI: Failed to set conversation information. " + e.Message);
   5.239 +                    Log.Verbose("CreateMirrorOMI: Failed to set conversation information. " + ex.ToString());
   5.240                  }
   5.241  
   5.242                  omi.To = original.To;
   5.243 @@ -919,9 +919,9 @@
   5.244                                          MapiHelper.GetProperty(original, MapiProperty.PidTagReceivedByName),
   5.245                                          Outlook.OlUserPropertyType.olText);
   5.246                  }
   5.247 -                catch (Exception e)
   5.248 +                catch (Exception ex)
   5.249                  {
   5.250 -                    Log.Verbose("CreateMirrorOMI: Failed to set received-by information. " + e.Message);
   5.251 +                    Log.Verbose("CreateMirrorOMI: Failed to set received-by information. " + ex.ToString());
   5.252                  }
   5.253  
   5.254                  // Mark the mail item as a mirror
   5.255 @@ -951,9 +951,9 @@
   5.256                  omi.Move(folder);
   5.257                  created = true;
   5.258              }
   5.259 -            catch (Exception e)
   5.260 +            catch (Exception ex)
   5.261              {
   5.262 -                Log.Verbose("CreateMirrorOMI: Creating new mail item failed. " + e.Message);
   5.263 +                Log.Verbose("CreateMirrorOMI: Creating new mail item failed. " + ex.ToString());
   5.264                  omi.PermanentlyDelete();
   5.265                  omi = null;
   5.266              }
   5.267 @@ -1025,9 +1025,9 @@
   5.268                      // WARNING: this creates a new mail item that will no longer be referenced here!!
   5.269                      omi.Move(folder);
   5.270                  }
   5.271 -                catch (Exception e)
   5.272 +                catch (Exception ex)
   5.273                  {
   5.274 -                    Log.Error("CreateMirrorOMI: Creating by copy failed. " + e.Message);
   5.275 +                    Log.Error("CreateMirrorOMI: Creating by copy failed. " + ex.ToString());
   5.276                  }
   5.277              }
   5.278  
   5.279 @@ -1203,7 +1203,7 @@
   5.280                  {
   5.281                      attachment = attachments[i];
   5.282                      PEPAttachment attach = new PEPAttachment(attachment);
   5.283 -                    MessageTypes type;
   5.284 +                    MessageType type;
   5.285                      if (attach.IsFPPAttachment(out type))
   5.286                      {
   5.287                          convertMessage = false;
   5.288 @@ -1287,7 +1287,7 @@
   5.289                  {
   5.290                      throw new Exception("Error getting message GUID.");
   5.291                  }
   5.292 -                else if (FPPMessage.InsertMsgIdAndValueInDb(DatabaseTables.Keys, id, key) != Globals.ReturnStatus.Success)
   5.293 +                else if (FPPMessage.InsertMsgIdAndValueInDb(DatabaseTable.Keys, id, key) != Globals.ReturnStatus.Success)
   5.294                  {
   5.295                      throw new Exception("Error saving key and message uuid to db.");
   5.296                  }
   5.297 @@ -1482,7 +1482,7 @@
   5.298          /// <param name="msgId">The message id to store.</param>
   5.299          /// <param name="value">The key/entryId to store.</param>
   5.300          /// <returns>Success if key/entryId was stored or is already in the db, otherwise Failure</returns>
   5.301 -        private static Globals.ReturnStatus InsertMsgIdAndValueInDb(DatabaseTables dbTable, string msgId, string value)
   5.302 +        private static Globals.ReturnStatus InsertMsgIdAndValueInDb(DatabaseTable dbTable, string msgId, string value)
   5.303          {
   5.304              string insertValues = null;
   5.305              Globals.ReturnStatus status = Globals.ReturnStatus.Failure;
   5.306 @@ -1490,7 +1490,7 @@
   5.307              /* SQL statement to insert a message id and a value into the respective table. If values are already
   5.308               * in the table, the insertion is omitted.
   5.309               */
   5.310 -            if (dbTable == DatabaseTables.EntryIds)
   5.311 +            if (dbTable == DatabaseTable.EntryIds)
   5.312              {
   5.313  
   5.314                  insertValues = "insert or ignore into " + PEP_FPP_DB_ENTRY_IDS_TABLE_NAME + " ("
   5.315 @@ -1499,7 +1499,7 @@
   5.316  
   5.317                  Log.Verbose("InsertKeyAndValueInDb: Trying to insert value in EntryIds table...");
   5.318              }
   5.319 -            else if (dbTable == DatabaseTables.Keys)
   5.320 +            else if (dbTable == DatabaseTable.Keys)
   5.321              {
   5.322                  insertValues = "insert or ignore into " + PEP_FPP_DB_KEYS_TABLE_NAME + " ("
   5.323                                                          + PEP_FPP_DB_MESSAGE_ID_COLUMN_NAME + ", "
   5.324 @@ -1568,7 +1568,7 @@
   5.325          /// <param name="messageId">The id of the message to retrieve its value.</param>
   5.326          /// <param name="value">The retrieved key/entryId or null if an error occured.</param>
   5.327          /// <returns>Success if key/entryId was retrieved successfully, otherwise Failure</returns>
   5.328 -        private static Globals.ReturnStatus GetValueFromDb(DatabaseTables dbTable, string messageId, out string value)
   5.329 +        private static Globals.ReturnStatus GetValueFromDb(DatabaseTable dbTable, string messageId, out string value)
   5.330          {
   5.331              value = null;
   5.332              Globals.ReturnStatus status = Globals.ReturnStatus.Failure;
   5.333 @@ -1582,7 +1582,7 @@
   5.334                      {
   5.335                          // Look up value that corresponds to message id
   5.336                          string getValue = null;
   5.337 -                        if (dbTable == DatabaseTables.EntryIds)
   5.338 +                        if (dbTable == DatabaseTable.EntryIds)
   5.339                          {
   5.340                              getValue = "select " + PEP_FPP_DB_ENTRY_ID_COLUMN_NAME +
   5.341                                         " from " + PEP_FPP_DB_ENTRY_IDS_TABLE_NAME +
   5.342 @@ -1590,7 +1590,7 @@
   5.343  
   5.344                              Log.Verbose("GetValueFromDb: Trying to get EntryId from database...");
   5.345                          }
   5.346 -                        else if (dbTable == DatabaseTables.Keys)
   5.347 +                        else if (dbTable == DatabaseTable.Keys)
   5.348                          {
   5.349                              getValue = "select " + PEP_FPP_DB_KEY_COLUMN_NAME +
   5.350                                         " from " + PEP_FPP_DB_KEYS_TABLE_NAME +
   5.351 @@ -1609,11 +1609,11 @@
   5.352                                  {
   5.353                                      // Set index according to database table
   5.354                                      string index = null;
   5.355 -                                    if (dbTable == DatabaseTables.EntryIds)
   5.356 +                                    if (dbTable == DatabaseTable.EntryIds)
   5.357                                      {
   5.358                                          index = PEP_FPP_DB_ENTRY_ID_COLUMN_NAME;
   5.359                                      }
   5.360 -                                    else if (dbTable == DatabaseTables.Keys)
   5.361 +                                    else if (dbTable == DatabaseTable.Keys)
   5.362                                      {
   5.363                                          index = PEP_FPP_DB_KEY_COLUMN_NAME;
   5.364                                      }
     6.1 --- a/Globals.cs	Mon Nov 27 11:40:18 2017 +0100
     6.2 +++ b/Globals.cs	Mon Nov 27 12:06:46 2017 +0100
     6.3 @@ -326,10 +326,10 @@
     6.4              {
     6.5                  versionNumber = Globals.ThisAddIn.Application.Version.Substring(0, 2);
     6.6              }
     6.7 -            catch (Exception e)
     6.8 +            catch (Exception ex)
     6.9              {
    6.10                  versionNumber = string.Empty;
    6.11 -                Log.Error("GetOutlookVersion: Error getting version. " + e.Message);
    6.12 +                Log.Error("GetOutlookVersion: Error getting version. " + ex.ToString());
    6.13              }
    6.14  
    6.15              if (int.TryParse(versionNumber, out versionNo))
    6.16 @@ -338,10 +338,10 @@
    6.17                  {
    6.18                      version = (Globals.Version)versionNo;
    6.19                  }
    6.20 -                catch (Exception e)
    6.21 +                catch (Exception ex)
    6.22                  {
    6.23                      version = Version.Undefined;
    6.24 -                    Log.Error("GetOutlookVersion: Error parsing version. " + e.Message);
    6.25 +                    Log.Error("GetOutlookVersion: Error parsing version. " + ex.ToString());
    6.26                  }
    6.27              }
    6.28  
     7.1 --- a/Log.cs	Mon Nov 27 11:40:18 2017 +0100
     7.2 +++ b/Log.cs	Mon Nov 27 12:06:46 2017 +0100
     7.3 @@ -254,9 +254,9 @@
     7.4                      }
     7.5                  }
     7.6              }
     7.7 -            catch (Exception e)
     7.8 +            catch (Exception ex)
     7.9              {
    7.10 -                Log.Error("Could not archive log file. Error creating archive file. " + e.Message);
    7.11 +                Log.Error("Could not archive log file. Error creating archive file. " + ex.ToString());
    7.12                  archiveFile = null;
    7.13              }
    7.14  
    7.15 @@ -271,9 +271,9 @@
    7.16                      {
    7.17                          File.Move(Log.GetLogFilePath(), archiveFile);
    7.18                      }
    7.19 -                    catch (Exception e)
    7.20 +                    catch (Exception ex)
    7.21                      {
    7.22 -                        Log.Warning("Could not archive log file. " + e.Message);
    7.23 +                        Log.Warning("Could not archive log file. " + ex.ToString());
    7.24                      }
    7.25  
    7.26                      Log.Clear();
    7.27 @@ -302,9 +302,9 @@
    7.28                      {
    7.29                          File.Delete(logFiles[i]);
    7.30                      }
    7.31 -                    catch (Exception e)
    7.32 +                    catch (Exception ex)
    7.33                      {
    7.34 -                        Log.Warning("LogRotate: Could not delete old log file. " + e.Message);
    7.35 +                        Log.Warning("LogRotate: Could not delete old log file. " + ex.ToString());
    7.36                      }
    7.37                  }
    7.38              }
     8.1 --- a/PEPAttachment.cs	Mon Nov 27 11:40:18 2017 +0100
     8.2 +++ b/PEPAttachment.cs	Mon Nov 27 12:06:46 2017 +0100
     8.3 @@ -573,9 +573,9 @@
     8.4          /// </summary>
     8.5          /// <param name="msgType">The message type if successful.</param>
     8.6          /// <returns>Whether this attachment is a FPP attachment.</returns>
     8.7 -        public bool IsFPPAttachment(out FPPMessage.MessageTypes msgType)
     8.8 +        public bool IsFPPAttachment(out FPPMessage.MessageType msgType)
     8.9          {
    8.10 -            msgType = FPPMessage.MessageTypes.InitialMessage;
    8.11 +            msgType = FPPMessage.MessageType.InitialMessage;
    8.12  
    8.13              if ((this.FileName == FPPMessage.PEP_FPP_ATTACHMENT_FILE_NAME) &&
    8.14                  (this.MimeType == FPPMessage.PEP_FPP_ATTACHMENT_MIME_TYPE))
    8.15 @@ -583,15 +583,15 @@
    8.16                  if (this.Data == null ||
    8.17                      this.Data?.Length == 0)
    8.18                  {
    8.19 -                    msgType = FPPMessage.MessageTypes.AnswerMessage;
    8.20 +                    msgType = FPPMessage.MessageType.AnswerMessage;
    8.21                  }
    8.22                  else
    8.23                  {
    8.24 -                    msgType = FPPMessage.MessageTypes.KeyTransportMessage;
    8.25 +                    msgType = FPPMessage.MessageType.KeyTransportMessage;
    8.26                  }
    8.27              }
    8.28  
    8.29 -            return (msgType != FPPMessage.MessageTypes.InitialMessage);
    8.30 +            return (msgType != FPPMessage.MessageType.InitialMessage);
    8.31          }
    8.32  
    8.33          /// <summary>
    8.34 @@ -660,9 +660,9 @@
    8.35                      {
    8.36                          File.Delete(tempFileName);
    8.37                      }
    8.38 -                    catch (Exception e)
    8.39 +                    catch (Exception ex)
    8.40                      {
    8.41 -                        Log.Error("PEPAttachment.AddTo: Could not delete temp file. " + e.Message);
    8.42 +                        Log.Error("PEPAttachment.AddTo: Could not delete temp file. " + ex.ToString());
    8.43                      }
    8.44  
    8.45                      tempFile = tempDir + "\\";
    8.46 @@ -762,9 +762,9 @@
    8.47                  {
    8.48                      File.Delete(tempFileName);
    8.49                  }
    8.50 -                catch (Exception e)
    8.51 +                catch (Exception ex)
    8.52                  {
    8.53 -                    Log.Error("PEPAttachment.AddTo: Could not delete temp file. " + e.Message);
    8.54 +                    Log.Error("PEPAttachment.AddTo: Could not delete temp file. " + ex.ToString());
    8.55                  }
    8.56  
    8.57                  // Create file name for the attachment
    8.58 @@ -820,9 +820,9 @@
    8.59                  {
    8.60                      Directory.Delete(tempDir, true);
    8.61                  }
    8.62 -                catch (Exception e)
    8.63 +                catch (Exception ex)
    8.64                  {
    8.65 -                    Log.Error("PEPAttachment.AddTo: Could not delete temp directory. " + e.Message);
    8.66 +                    Log.Error("PEPAttachment.AddTo: Could not delete temp directory. " + ex.ToString());
    8.67                  }
    8.68  
    8.69                  // Marshal.ReleaseComObject(newAttachment);
     9.1 --- a/PEPIdentity.cs	Mon Nov 27 11:40:18 2017 +0100
     9.2 +++ b/PEPIdentity.cs	Mon Nov 27 12:06:46 2017 +0100
     9.3 @@ -1467,10 +1467,10 @@
     9.4                                  exchangeUser = true;
     9.5                              }
     9.6                          }
     9.7 -                        catch (Exception e)
     9.8 +                        catch (Exception ex)
     9.9                          {
    9.10                              exchangeUser = false;
    9.11 -                            Log.Error("GetFromIdentity: Error getting email type. " + e.Message);
    9.12 +                            Log.Error("GetFromIdentity: Error getting email type. " + ex.ToString());
    9.13                          }
    9.14                      }
    9.15  
    9.16 @@ -2061,9 +2061,9 @@
    9.17                      {
    9.18                          tempAddress = addressEntry.Address;
    9.19                      }
    9.20 -                    catch (Exception e)
    9.21 +                    catch (Exception ex)
    9.22                      {
    9.23 -                        Log.Warning("PEPIdentity.Create: Could not get address from addressEntry. " + e.ToString());
    9.24 +                        Log.Warning("PEPIdentity.Create: Could not get address from addressEntry. " + ex.ToString());
    9.25                      }
    9.26                  }
    9.27  
    10.1 --- a/PEPMessage.cs	Mon Nov 27 11:40:18 2017 +0100
    10.2 +++ b/PEPMessage.cs	Mon Nov 27 12:06:46 2017 +0100
    10.3 @@ -693,9 +693,9 @@
    10.4                  {
    10.5                      receivedOnUtc = TimeZoneInfo.ConvertTimeToUtc((DateTime)this._ReceivedOn);
    10.6                  }
    10.7 -                catch (Exception e)
    10.8 +                catch (Exception ex)
    10.9                  {
   10.10 -                    Log.Verbose("PEPMessage.ToCOMType: Error converting received time to UTC. " + e.Message);
   10.11 +                    Log.Verbose("PEPMessage.ToCOMType: Error converting received time to UTC. " + ex.ToString());
   10.12                      receivedOnUtc = (DateTime)this._ReceivedOn;
   10.13                  }
   10.14                  span = receivedOnUtc - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
   10.15 @@ -711,9 +711,9 @@
   10.16                  {
   10.17                      sentOnUtc = TimeZoneInfo.ConvertTimeToUtc((DateTime)this._SentOn);
   10.18                  }
   10.19 -                catch (Exception e)
   10.20 +                catch (Exception ex)
   10.21                  {
   10.22 -                    Log.Verbose("PEPMessage.ToCOMType: Error converting sent time to UTC. " + e.Message);
   10.23 +                    Log.Verbose("PEPMessage.ToCOMType: Error converting sent time to UTC. " + ex.ToString());
   10.24                      sentOnUtc = (DateTime)this._SentOn;
   10.25                  }
   10.26                  span = sentOnUtc - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
   10.27 @@ -1682,9 +1682,9 @@
   10.28                          {
   10.29                              pgpMIME.AddTo(attachments);
   10.30                          }
   10.31 -                        catch (Exception e)
   10.32 +                        catch (Exception ex)
   10.33                          {
   10.34 -                            Log.Verbose("Failed to add PGP/MIME attachment. " + e.Message);
   10.35 +                            Log.Verbose("Failed to add PGP/MIME attachment. " + ex.ToString());
   10.36  
   10.37                              /* If adding the attachment fails, check if it is because of file size limitations
   10.38                               * and throw dedicated exception in that case (needed for user feedback).
   10.39 @@ -2120,9 +2120,9 @@
   10.40                      {
   10.41                          newMessage.ReceivedOn = TimeZoneInfo.ConvertTimeFromUtc(receivedOnUtc, TimeZoneInfo.Local);
   10.42                      }
   10.43 -                    catch (Exception e)
   10.44 +                    catch (Exception ex)
   10.45                      {
   10.46 -                        Log.Error("PEPMessage.Create: Error converting received time to local time. " + e.Message);
   10.47 +                        Log.Error("PEPMessage.Create: Error converting received time to local time. " + ex.ToString());
   10.48                          newMessage.ReceivedOn = new DateTime(1970, 1, 1).AddSeconds(msg.Recv);
   10.49                      }
   10.50                  }
   10.51 @@ -2139,9 +2139,9 @@
   10.52                      {
   10.53                          newMessage.SentOn = TimeZoneInfo.ConvertTimeFromUtc(sentOnUtc, TimeZoneInfo.Local);
   10.54                      }
   10.55 -                    catch (Exception e)
   10.56 +                    catch (Exception ex)
   10.57                      {
   10.58 -                        Log.Error("PEPMessage.Create: Error converting sent time to local time. " + e.Message);
   10.59 +                        Log.Error("PEPMessage.Create: Error converting sent time to local time. " + ex.ToString());
   10.60                          newMessage.SentOn = new DateTime(1970, 1, 1).AddSeconds(msg.Sent);
   10.61                      }
   10.62                  }
    11.1 --- a/ThisAddIn.cs	Mon Nov 27 11:40:18 2017 +0100
    11.2 +++ b/ThisAddIn.cs	Mon Nov 27 12:06:46 2017 +0100
    11.3 @@ -291,9 +291,9 @@
    11.4                      }
    11.5                  }
    11.6              }
    11.7 -            catch (Exception e)
    11.8 +            catch (Exception ex)
    11.9              {
   11.10 -                Log.Error("SyncAccountsList: Error occured. " + e.Message);
   11.11 +                Log.Error("SyncAccountsList: Error occured. " + ex.ToString());
   11.12              }
   11.13              finally
   11.14              {
   11.15 @@ -566,9 +566,9 @@
   11.16                              }
   11.17                          }
   11.18                      }
   11.19 -                    catch (Exception e)
   11.20 +                    catch (Exception ex)
   11.21                      {
   11.22 -                        Log.Verbose("RegisterMyself: Error setting sync flag for new account. " + e.Message);
   11.23 +                        Log.Verbose("RegisterMyself: Error setting sync flag for new account. " + ex.ToString());
   11.24                      }
   11.25  
   11.26                      // Log information if invalid
   11.27 @@ -1633,9 +1633,9 @@
   11.28                      {
   11.29                          store = stores[i];
   11.30                      }
   11.31 -                    catch (Exception e)
   11.32 +                    catch (Exception ex)
   11.33                      {
   11.34 -                        Log.Warning("OpenPEPStoreRootFolder: Failed to get store, " + e.Message);
   11.35 +                        Log.Warning("OpenPEPStoreRootFolder: Failed to get store, " + ex.ToString());
   11.36                      }
   11.37  
   11.38                      if (store?.FilePath == path)
   11.39 @@ -1658,9 +1658,9 @@
   11.40                      {
   11.41                          ns.AddStoreEx(path, Outlook.OlStoreType.olStoreUnicode);
   11.42                      }
   11.43 -                    catch (Exception e)
   11.44 +                    catch (Exception ex)
   11.45                      {
   11.46 -                        Log.Error("OpenPEPStoreRootFolder: Failes to add pEp store. " + e.Message);
   11.47 +                        Log.Error("OpenPEPStoreRootFolder: Failes to add pEp store. " + ex.ToString());
   11.48                      }
   11.49  
   11.50                      for (int i = 1; i <= stores.Count; i++)
   11.51 @@ -1673,9 +1673,9 @@
   11.52                          {
   11.53                              store = stores[i];
   11.54                          }
   11.55 -                        catch (Exception e)
   11.56 +                        catch (Exception ex)
   11.57                          {
   11.58 -                            Log.Warning("OpenPEPStoreRootFolder: Failed to get store, " + e.Message);
   11.59 +                            Log.Warning("OpenPEPStoreRootFolder: Failed to get store, " + ex.ToString());
   11.60                          }
   11.61  
   11.62                          if (store?.FilePath == path)
   11.63 @@ -1703,9 +1703,9 @@
   11.64                              store = stores[i];
   11.65                              Log.Warning("OpenPEPStoreRootFolder: file path of store " + i + ": " + store?.FilePath ?? "<null>");
   11.66                          }
   11.67 -                        catch (Exception e)
   11.68 +                        catch (Exception ex)
   11.69                          {
   11.70 -                            Log.Warning("OpenPEPStoreRootFolder: Failed to get store, " + e.Message);
   11.71 +                            Log.Warning("OpenPEPStoreRootFolder: Failed to get store, " + ex.ToString());
   11.72                          }
   11.73  
   11.74                          // Custom comparison of file paths independently of their (known) prefixes
   11.75 @@ -1949,9 +1949,9 @@
   11.76                              // After opening it will always be visible
   11.77                              this.OpenPEPStoreRootFolder();
   11.78                          }
   11.79 -                        catch (Exception e)
   11.80 +                        catch (Exception ex)
   11.81                          {
   11.82 -                            Log.Warning("SetPEPStoreRootFolderVisibility: Failed to make pEp root folder visible. " + e.ToString());
   11.83 +                            Log.Warning("SetPEPStoreRootFolderVisibility: Failed to make pEp root folder visible. " + ex.ToString());
   11.84                          }
   11.85                      }
   11.86                      else
   11.87 @@ -2479,10 +2479,10 @@
   11.88                      pEpDraftsFolder = folders?.Add(Globals.PEP_DRAFTS_FOLDER_NAME, Outlook.OlDefaultFolders.olFolderDrafts) as Outlook.Folder;
   11.89                  }
   11.90              }
   11.91 -            catch (Exception e)
   11.92 +            catch (Exception ex)
   11.93              {
   11.94                  pEpDraftsFolder = null;
   11.95 -                Log.Error("Cannot create pEp drafts folder. " + e.Message);
   11.96 +                Log.Error("Cannot create pEp drafts folder. " + ex.ToString());
   11.97              }
   11.98              finally
   11.99              {
  11.100 @@ -2523,9 +2523,9 @@
  11.101                          category = null;
  11.102                      }
  11.103                  }
  11.104 -                catch (Exception e)
  11.105 +                catch (Exception ex)
  11.106                  {
  11.107 -                    Log.Error("CreatePEPInternalCategory: Error checking if category exists. " + e.Message);
  11.108 +                    Log.Error("CreatePEPInternalCategory: Error checking if category exists. " + ex.ToString());
  11.109                      success = false;
  11.110  
  11.111                      // Just try to create it anyway, this will throw an exception if it already exists
  11.112 @@ -2547,9 +2547,9 @@
  11.113                          categories?.Add(Globals.PEP_INTERNAL_CATEGORY_NAME, Outlook.OlCategoryColor.olCategoryColorDarkGreen);
  11.114                          success = true;
  11.115                      }
  11.116 -                    catch (Exception e)
  11.117 +                    catch (Exception ex)
  11.118                      {
  11.119 -                        Log.Error("CreatePEPInternalCategory: Error checking if category exists. " + e.Message);
  11.120 +                        Log.Error("CreatePEPInternalCategory: Error checking if category exists. " + ex.ToString());
  11.121                          success = false;
  11.122                      }
  11.123                      finally
  11.124 @@ -2599,9 +2599,9 @@
  11.125                              }
  11.126                          }
  11.127                      }
  11.128 -                    catch (Exception e)
  11.129 +                    catch (Exception ex)
  11.130                      {
  11.131 -                        Log.Error("SetPEPInternalCategory: Error setting category for account. " + e.Message);
  11.132 +                        Log.Error("SetPEPInternalCategory: Error setting category for account. " + ex.ToString());
  11.133                          success = false;
  11.134                      }
  11.135                      finally
  11.136 @@ -3508,17 +3508,17 @@
  11.137                                              {
  11.138                                                  messages[0].ApplyTo(omi, false, false);
  11.139                                              }
  11.140 -                                            catch (AttachmentSizeException e)
  11.141 +                                            catch (AttachmentSizeException ex)
  11.142                                              {
  11.143                                                  // Adjust warning message for this concrete case
  11.144                                                  sendUnencryptedWarning = Properties.Resources.Message_SendErrorAttachmentSize + Environment.NewLine + Environment.NewLine + Properties.Resources.Message_SendUnencryptedConfirmation;
  11.145 -                                                Log.Verbose("Application_ItemSend: Error with attachments while applying encrypted message. " + e.Message);
  11.146 +                                                Log.Verbose("Application_ItemSend: Error with attachments while applying encrypted message. " + ex.ToString());
  11.147                                                  sentMessage.ApplyTo(omi, false, false);
  11.148                                                  throw;
  11.149                                              }
  11.150 -                                            catch (Exception e)
  11.151 +                                            catch (Exception ex)
  11.152                                              {
  11.153 -                                                Log.Verbose("Application_ItemSend: Error applying encrypted message. " + e.Message);
  11.154 +                                                Log.Verbose("Application_ItemSend: Error applying encrypted message. " + ex.ToString());
  11.155                                                  sentMessage.ApplyTo(omi, false, false);
  11.156                                                  throw;
  11.157                                              }
  11.158 @@ -3536,16 +3536,16 @@
  11.159                                                  {
  11.160                                                      this.CreateAndSendMessage(messages[i], true, false);
  11.161                                                  }
  11.162 -                                                catch (AttachmentSizeException e)
  11.163 +                                                catch (AttachmentSizeException ex)
  11.164                                                  {
  11.165                                                      // Adjust warning message for this concrete case
  11.166                                                      sendUnencryptedWarning = Properties.Resources.Message_SendErrorAttachmentSize + Environment.NewLine + Environment.NewLine + Properties.Resources.Message_SendUnencryptedConfirmation;
  11.167 -                                                    Log.Verbose("Application_ItemSend: Error with attachments while sending encrypted message. " + e.Message);
  11.168 +                                                    Log.Verbose("Application_ItemSend: Error with attachments while sending encrypted message. " + ex.ToString());
  11.169                                                      throw;
  11.170                                                  }
  11.171 -                                                catch (Exception e)
  11.172 +                                                catch (Exception ex)
  11.173                                                  {
  11.174 -                                                    Log.Verbose("Application_ItemSend: Error sending encrypted message. " + e.Message);
  11.175 +                                                    Log.Verbose("Application_ItemSend: Error sending encrypted message. " + ex.ToString());
  11.176                                                      throw;
  11.177                                                  }
  11.178                                              }
    12.1 --- a/UI/FormControlPreviewMessage.xaml.cs	Mon Nov 27 11:40:18 2017 +0100
    12.2 +++ b/UI/FormControlPreviewMessage.xaml.cs	Mon Nov 27 12:06:46 2017 +0100
    12.3 @@ -221,9 +221,9 @@
    12.4                          }
    12.5                      }
    12.6                  }
    12.7 -                catch (Exception e)
    12.8 +                catch (Exception ex)
    12.9                  {
   12.10 -                    Log.Error("SetRichTextBoxContent: Error searching for attached images. " + e.Message);
   12.11 +                    Log.Error("SetRichTextBoxContent: Error searching for attached images. " + ex.ToString());
   12.12                  }
   12.13  
   12.14                  // If no images were found in HTML, set RTF text without images and return
   12.15 @@ -250,10 +250,10 @@
   12.16                                  img = (new ImageConverter()).ConvertFrom(attachmentImage.Data) as Bitmap;
   12.17                              }                            
   12.18                          }
   12.19 -                        catch (Exception e)
   12.20 +                        catch (Exception ex)
   12.21                          {
   12.22                              img = null;
   12.23 -                            Log.Verbose("SetRichTextBoxContent: Error converting attachment image to Bitmap. " + e.Message);
   12.24 +                            Log.Verbose("SetRichTextBoxContent: Error converting attachment image to Bitmap. " + ex.ToString());
   12.25                          }
   12.26  
   12.27                          if (img != null)
   12.28 @@ -262,9 +262,9 @@
   12.29                          }
   12.30                      }
   12.31                  }
   12.32 -                catch (Exception e)
   12.33 +                catch (Exception ex)
   12.34                  {
   12.35 -                    Log.Error("SetRichTextBoxContent: Error searching for attached images. " + e.Message);
   12.36 +                    Log.Error("SetRichTextBoxContent: Error searching for attached images. " + ex.ToString());
   12.37                  }
   12.38  
   12.39                  // If no images were found, set RTF text without images and return
   12.40 @@ -313,9 +313,9 @@
   12.41                          wb.Navigate("about:blank");
   12.42                          wb.Document.Write(html);
   12.43                      }
   12.44 -                    catch (Exception e)
   12.45 +                    catch (Exception ex)
   12.46                      {
   12.47 -                        Log.Error("SetRichTextBoxContent: Error writing HTML to web browser. " + e.Message);
   12.48 +                        Log.Error("SetRichTextBoxContent: Error writing HTML to web browser. " + ex.ToString());
   12.49                          this.RichTextBoxMessageBody.Rtf = this.displayState?.Message?.LongMsgFormattedRtf;
   12.50                          return;
   12.51                      }
   12.52 @@ -343,9 +343,9 @@
   12.53                              imageFromClipboard = Clipboard.GetImage();
   12.54                          }
   12.55                      }
   12.56 -                    catch (Exception e)
   12.57 +                    catch (Exception ex)
   12.58                      {
   12.59 -                        Log.Error("SetRichTextBoxContent: Error backing up clipboard. " + e.Message);
   12.60 +                        Log.Error("SetRichTextBoxContent: Error backing up clipboard. " + ex.ToString());
   12.61                          this.RichTextBoxMessageBody.Rtf = this.displayState?.Message?.LongMsgFormattedRtf;
   12.62                          return;
   12.63                      }
   12.64 @@ -356,9 +356,9 @@
   12.65                          wb.Document.ExecCommand("SelectAll", false, null);
   12.66                          wb.Document.ExecCommand("Copy", false, null);
   12.67                      }
   12.68 -                    catch (Exception e)
   12.69 +                    catch (Exception ex)
   12.70                      {
   12.71 -                        Log.Error("SetRichTextBoxContent: Error copying from web browser to clipboard. " + e.Message);
   12.72 +                        Log.Error("SetRichTextBoxContent: Error copying from web browser to clipboard. " + ex.ToString());
   12.73                          this.RichTextBoxMessageBody.Rtf = this.displayState?.Message?.LongMsgFormattedRtf;
   12.74                          return;
   12.75                      }
   12.76 @@ -387,9 +387,9 @@
   12.77                              }
   12.78                          }
   12.79                      }
   12.80 -                    catch (Exception e)
   12.81 +                    catch (Exception ex)
   12.82                      {
   12.83 -                        Log.Error("SetRichTextBoxContent: Error getting rtf from clipboard. " + e.Message);
   12.84 +                        Log.Error("SetRichTextBoxContent: Error getting rtf from clipboard. " + ex.ToString());
   12.85                          this.RichTextBoxMessageBody.Rtf = this.displayState?.Message?.LongMsgFormattedRtf;
   12.86  
   12.87                          // If Exception was caused by another application which uses clipboard than GetOpenClipboardWindowText() will return information of this application. Uses user32.dll 
   12.88 @@ -403,9 +403,9 @@
   12.89                          // Replace WMF picture headers with RtfPicturePlaceHolder  
   12.90                          rtf = ReplaceWmfHeaders(rtf);
   12.91                      }
   12.92 -                    catch (Exception e)
   12.93 +                    catch (Exception ex)
   12.94                      {
   12.95 -                        Log.Error("SetRichTextBoxContent: Error replacing WMF headers. " + e.Message);
   12.96 +                        Log.Error("SetRichTextBoxContent: Error replacing WMF headers. " + ex.ToString());
   12.97                          this.RichTextBoxMessageBody.Rtf = this.displayState?.Message?.LongMsgFormattedRtf;
   12.98                          return;
   12.99                      }
  12.100 @@ -418,9 +418,9 @@
  12.101                              ReplaceFirstFromFile(ref rtf, RtfPicturePlaceHolder, wmfFileNames[i]);
  12.102                          }
  12.103                      }
  12.104 -                    catch (Exception e)
  12.105 +                    catch (Exception ex)
  12.106                      {
  12.107 -                        Log.Error("SetRichTextBoxContent: Error replacing RtfPicturePlaceHolder. " + e.Message);
  12.108 +                        Log.Error("SetRichTextBoxContent: Error replacing RtfPicturePlaceHolder. " + ex.ToString());
  12.109                          this.RichTextBoxMessageBody.Rtf = this.displayState?.Message?.LongMsgFormattedRtf;
  12.110                          return;
  12.111                      }
  12.112 @@ -513,9 +513,9 @@
  12.113                  text = sb.ToString();
  12.114                  sb = null;
  12.115              }
  12.116 -            catch (Exception e)
  12.117 +            catch (Exception ex)
  12.118              {
  12.119 -                Log.Error("ReplaceFirstFromFile: Error. " + e.Message);
  12.120 +                Log.Error("ReplaceFirstFromFile: Error. " + ex.ToString());
  12.121              }
  12.122          }
  12.123  
  12.124 @@ -566,9 +566,9 @@
  12.125                  File.WriteAllBytes(tempFolderAndFileName, buffer);
  12.126                  buffer = null;
  12.127              }
  12.128 -            catch (Exception e)
  12.129 +            catch (Exception ex)
  12.130              {
  12.131 -                Log.Error("SaveMetaFile: Error writing to disk. " + e.Message);
  12.132 +                Log.Error("SaveMetaFile: Error writing to disk. " + ex.ToString());
  12.133                  return null;
  12.134              }
  12.135  
  12.136 @@ -590,9 +590,9 @@
  12.137              {
  12.138                  File.Delete(tempFileName);
  12.139              }
  12.140 -            catch (Exception e)
  12.141 +            catch (Exception ex)
  12.142              {
  12.143 -                Log.Error("Could not delete temp file. " + e.Message);
  12.144 +                Log.Error("Could not delete temp file. " + ex.ToString());
  12.145              }
  12.146  
  12.147              return tempDir;
    13.1 --- a/UI/FormRegionPrivacyStatus.cs	Mon Nov 27 11:40:18 2017 +0100
    13.2 +++ b/UI/FormRegionPrivacyStatus.cs	Mon Nov 27 12:06:46 2017 +0100
    13.3 @@ -184,9 +184,9 @@
    13.4              {
    13.5                  this.ResolveAllRecipients();
    13.6              }
    13.7 -            catch (Exception e)
    13.8 +            catch (Exception ex)
    13.9              {
   13.10 -                Log.Verbose("BuildAndShowManager: Error resolving recipients. " + e.Message);
   13.11 +                Log.Verbose("BuildAndShowManager: Error resolving recipients. " + ex.ToString());
   13.12              }
   13.13  
   13.14              // Build the dialog
   13.15 @@ -201,9 +201,9 @@
   13.16                  handshakeDialog.Closed += HandshakeDialog_Closed;
   13.17                  handshakeDialog.ShowDialog();
   13.18              }
   13.19 -            catch (Exception e)
   13.20 +            catch (Exception ex)
   13.21              {
   13.22 -                Globals.StopAndSendCrashReport(e);
   13.23 +                Globals.StopAndSendCrashReport(ex);
   13.24              }
   13.25          }
   13.26  
   13.27 @@ -349,9 +349,9 @@
   13.28                          Log.Verbose("UpdateInspector: Error retrieving inspector window or application.");
   13.29                      }
   13.30                  }
   13.31 -                catch (Exception e)
   13.32 +                catch (Exception ex)
   13.33                  {
   13.34 -                    Log.Verbose("UpdateInspector: Error updating inspector window. " + e.Message);
   13.35 +                    Log.Verbose("UpdateInspector: Error updating inspector window. " + ex.ToString());
   13.36                  }
   13.37                  finally
   13.38                  {
   13.39 @@ -599,9 +599,9 @@
   13.40                      this.cryptableMailItem.ResolveAllRecipients();
   13.41                      this.cryptableMailItem.PropertyChanged += MailItem_PropertyChanged;
   13.42                  }
   13.43 -                catch (Exception e)
   13.44 +                catch (Exception ex)
   13.45                  {
   13.46 -                    Log.Error("Error resolving recipients. " + e.Message);
   13.47 +                    Log.Error("Error resolving recipients. " + ex.ToString());
   13.48                  }
   13.49              }
   13.50  
    14.1 --- a/UI/HandshakeDialog.xaml.cs	Mon Nov 27 11:40:18 2017 +0100
    14.2 +++ b/UI/HandshakeDialog.xaml.cs	Mon Nov 27 12:06:46 2017 +0100
    14.3 @@ -970,9 +970,9 @@
    14.4                              break;
    14.5                      }
    14.6                  }
    14.7 -                catch (Exception e)
    14.8 +                catch (Exception ex)
    14.9                  {
   14.10 -                    Log.Error("HandshakeDialog.BuildDialog: Error creating key sync or FPP item. " + e.Message);
   14.11 +                    Log.Error("HandshakeDialog.BuildDialog: Error creating key sync or FPP item. " + ex.ToString());
   14.12                      return false;
   14.13                  }
   14.14  
   14.15 @@ -1019,9 +1019,9 @@
   14.16                              break;
   14.17                      }
   14.18                  }
   14.19 -                catch (Exception e)
   14.20 +                catch (Exception ex)
   14.21                  {
   14.22 -                    Log.Error("HandshakeDialog.BuildDialog: Error creating key sync item. " + e.Message);
   14.23 +                    Log.Error("HandshakeDialog.BuildDialog: Error creating key sync item. " + ex.ToString());
   14.24                      return false;
   14.25                  }
   14.26