DFLayoutDocumentFieldProperties.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. namespace InABox.Core
  3. {
  4. public class DFLayoutDocumentFieldProperties : DFLayoutFieldProperties<Guid, Guid?>
  5. {
  6. [EditorSequence(-995)]
  7. [NullEditor]
  8. public override Guid Default { get; set; }
  9. public string? FileMask { get; set; }
  10. public override string FormatValue(Guid? value)
  11. {
  12. return value != null && value != Guid.Empty ? "Yes" : "";
  13. }
  14. public override Guid? DeserializeValue(DFLoadStorageEntry entry)
  15. {
  16. return entry.GetValue<Guid?>();
  17. }
  18. public override void SerializeValue(DFSaveStorageEntry entry, Guid? value)
  19. {
  20. entry.SetValue(value);
  21. }
  22. public override Guid GetValue(Guid? value)
  23. {
  24. return value ?? Default;
  25. }
  26. protected override void LoadProperties()
  27. {
  28. base.LoadProperties();
  29. FileMask = GetProperty("FileMask", FileMask);
  30. }
  31. protected override void SaveProperties()
  32. {
  33. base.SaveProperties();
  34. SetProperty("FileMask", FileMask);
  35. }
  36. }
  37. }