DFLayoutNotesFieldProperties.cs 708 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. namespace InABox.Core
  3. {
  4. public class DFLayoutNotesFieldProperties : DFLayoutFieldProperties<string[]>
  5. {
  6. public override string FormatValue(object value)
  7. {
  8. return string.Join(",", (string[])value);
  9. }
  10. public override object? ParseValue(object value)
  11. {
  12. if (value is string[])
  13. return value;
  14. if (value is string)
  15. try
  16. {
  17. return Serialization.Deserialize<string[]>((string)value);
  18. }
  19. catch (Exception)
  20. {
  21. return null;
  22. }
  23. return null;
  24. }
  25. }
  26. }