public object GetValue(object target) { string value = (string)targetProperty.GetValue(target); if (!string.IsNullOrEmpty(value)) { try { value = encryptedTag + DPAPI.Encrypt(value); } catch { } } return(value); }
public void SetValue(object target, object value) { string text = (string)value; if (!string.IsNullOrEmpty(text) && text.StartsWith(encryptedTag)) { try { string encryptedString = text.Substring(encryptedTag.Length); text = DPAPI.Decrypt(encryptedString); } catch { } } targetProperty.SetValue(target, text); }