public static TLV Convert(TLVasJSON tlvasJSON) { TLV tlv = TLV.Create(tlvasJSON.Tag); if (tlv.Tag.IsConstructed) { foreach (TLVasJSON tlvChild in tlvasJSON.Children) { tlv.Children.AddToList(Convert(tlvChild)); } } else { tlv.Value = FormattingUtils.Formatting.HexStringToByteArray(tlvasJSON.Value); } return(tlv); }
public static TLVasJSON Convert(TLV tlv) { TLVasJSON json = new TLVasJSON() { Tag = tlv.Tag.TagLable, Name = TLVMetaDataSourceSingleton.Instance.DataSource.GetName(tlv.Tag.TagLable), }; if (tlv.Tag.IsConstructed) { foreach (TLV tlvChild in tlv.Children) { json.Children.Add(Convert(tlvChild)); } } else { json.Value = FormattingUtils.Formatting.ByteArrayToHexString(tlv.Value); } return(json); }