DFLayoutMultiSignaturePadProperties.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using Newtonsoft.Json.Linq;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Text;
  5. namespace InABox.Core
  6. {
  7. public class DFLayoutMultiSignaturePadProperties : DFLayoutFieldProperties<Dictionary<string, byte[]>, Dictionary<string, byte[]>?>
  8. {
  9. [EditorSequence(-995)]
  10. [NullEditor]
  11. public override Dictionary<string, byte[]> Default { get; set; } = new Dictionary<string, byte[]>();
  12. public override string FormatValue(Dictionary<string, byte[]>? value)
  13. {
  14. return value != null ? "Yes" : "";
  15. }
  16. public override Dictionary<string, byte[]>? DeserializeValue(DFLoadStorageEntry entry)
  17. {
  18. return entry.GetValue<Dictionary<string, byte[]>>();
  19. }
  20. public override void SerializeValue(DFSaveStorageEntry entry, Dictionary<string, byte[]>? value)
  21. {
  22. entry.SetValue(value);
  23. }
  24. public override Dictionary<string, byte[]> GetValue(Dictionary<string, byte[]>? value)
  25. {
  26. return value ?? Default;
  27. }
  28. }
  29. }