12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- namespace InABox.Core
- {
- public class DFLayoutPINFieldProperties : DFLayoutFieldProperties<string, string?>
- {
- public int Length { get; set; }
- public DFLayoutPINFieldProperties()
- {
- Length = 4;
- }
- public override string FormatValue(string? value)
- {
- return value ?? "";
- }
- 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);
- }
- }
- }
|