public ISmtpServerOptions GetSmtpServerOptions() { var result = new SmtpServerOptions(); var smtpServer = Get(SmtpServer); if (smtpServer != null) { result.SmtpServer = (string)smtpServer; result.SmtpServerPort = Convert.ToInt32(Get(SmtpServerPort)); result.SmtpServerUseSSl = Convert.ToBoolean(Get(SmtpSslEncryption)); result.SmtpAuthentication = Convert.ToInt32(Get(SmtpAuthentication)); result.SmtpServerUser = productionCipher.Decrypt((string)Get(SmtpServerUsername), encryptorKey); result.SmtpServerPassword = productionCipher.Decrypt((string)Get(SmtpServerPassword), encryptorKey); } return(result); }
private object SetSpecificValue(PropertyInfo fromProperty, PropertyInfo toProperty, object fromValue) { if (fromProperty.PropertyType == typeof(DateTime)) { return(AutoConvertDateTime(fromProperty, toProperty, (DateTime)fromValue)); } if (fromProperty.PropertyType == typeof(DateTime?)) { var nullableDate = (DateTime?)fromValue; if (nullableDate.HasValue) { return(AutoConvertDateTime(fromProperty, toProperty, nullableDate.Value)); } } var encryptionKey = GetEncryptionKey(fromProperty.GetEncryptionAttribute()); if (encryptionKey != null) { return(productionCipher.Decrypt(fromValue.ToString(), encryptionKey)); } encryptionKey = GetEncryptionKey(toProperty.GetEncryptionAttribute()); if (encryptionKey != null) { return(productionCipher.Encrypt(fromValue.ToString(), encryptionKey)); } return(fromValue); }