using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Text; namespace InABox.Core { public class DFLayoutMultiSignaturePadProperties : DFLayoutFieldProperties> { public override string FormatValue(object? value) { return value != null ? "Yes" : ""; } public override object? ParseValue(object? value) { if (value is Dictionary dict) return dict; Dictionary? values = null; if (value is JObject jObject) values = jObject.ToObject>(); else if(value is string str) { if (Guid.TryParse(str, out var id)) { return new Dictionary(); } values = Serialization.Deserialize>(str); } if (values != null) try { var convertedValues = new Dictionary(); foreach (var v in values.Keys) { convertedValues.Add(v, Convert.FromBase64String(values[v])); } return convertedValues; } catch (Exception) { return null; } return null; } } }