DFLayoutNotesFieldProperties.cs 846 B

1234567891011121314151617181920212223242526272829303132333435
  1. using Newtonsoft.Json.Linq;
  2. using System;
  3. namespace InABox.Core
  4. {
  5. public class DFLayoutNotesFieldProperties : DFLayoutFieldProperties<string[], string[]?>
  6. {
  7. public override string FormatValue(string[]? value)
  8. {
  9. if(value is string[] arr)
  10. {
  11. return string.Join(", ", arr);
  12. }
  13. else
  14. {
  15. return "";
  16. }
  17. }
  18. public override void SerializeValue(DFSaveStorageEntry entry, string[]? value)
  19. {
  20. entry.SetValue(value);
  21. }
  22. public override string[]? DeserializeValue(DFLoadStorageEntry entry)
  23. {
  24. return entry.GetValue<string[]>();
  25. }
  26. public override string[] GetValue(string[]? value)
  27. {
  28. return value ?? Default;
  29. }
  30. }
  31. }