DFLayoutMultiSignaturePadProperties.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. private Dictionary<string, byte[]> _default = new Dictionary<string, byte[]>();
  10. [EditorSequence(-995)]
  11. [NullEditor]
  12. public override Dictionary<string, byte[]> Default
  13. {
  14. get => _default;
  15. set => _default = value ?? new Dictionary<string, byte[]>();
  16. }
  17. public override string FormatValue(Dictionary<string, byte[]>? value)
  18. {
  19. return value != null ? "Yes" : "";
  20. }
  21. public override Dictionary<string, byte[]>? DeserializeValue(DFLoadStorageEntry entry)
  22. {
  23. return entry.GetValue<Dictionary<string, byte[]>>();
  24. }
  25. public override void SerializeValue(DFSaveStorageEntry entry, Dictionary<string, byte[]>? value)
  26. {
  27. entry.SetValue(value);
  28. }
  29. public override Dictionary<string, byte[]> GetValue(Dictionary<string, byte[]>? value)
  30. {
  31. return value ?? Default;
  32. }
  33. }
  34. }