123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- namespace InABox.Core
- {
- public class DFLayoutPINFieldProperties : DFLayoutFieldProperties<string, string?>
- {
-
- [EditorSequence(-995)]
- [PINEditor]
- public override string Default { get; set; }
-
- public int Length { get; set; }
- public DFLayoutPINFieldProperties()
- {
- Length = 4;
- }
- public override string FormatValue(string? value)
- {
- return value ?? string.Empty;
- }
- public override string? DeserializeValue(DFLoadStorageEntry entry)
- {
- var value = entry.GetValue();
- if(value is int i)
- {
- return i.ToString();
- }
- return value?.ToString();
- }
- public override string GetValue(string? value)
- {
- return value ?? Default;
- }
- public override void SerializeValue(DFSaveStorageEntry entry, string? value)
- {
- entry.SetValue(value);
- }
- protected override void LoadProperties()
- {
- base.LoadProperties();
- Length = GetProperty("Length", 4);
- }
- protected override void SaveProperties()
- {
- base.SaveProperties();
- SetProperty("Length", Length);
- }
- }
- }
|