示例#1
0
 public void Deserialize(byte[] rawTLV, bool withDup = false)
 {
     for (int i = 0; i < rawTLV.Length;)
     {
         AddToList(TLV.Create(rawTLV, ref i), withDup);
     }
 }
示例#2
0
        public static TLVList DeserializeChildrenWithNoLV(byte[] rawTlv, int pos)
        {
            TLVList children = new TLVList();

            for (int i = pos; i < rawTlv.Length;)
            {
                T t = T.Create(rawTlv, ref i);
                children.AddToList(TLV.Create(t.TagLable));
            }
            return(children);
        }
示例#3
0
        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);
        }
示例#4
0
        private static TLVList DeserList(List <TLVXML> serXML)
        {
            TLVList result = new TLVList();

            serXML.ForEach((x) =>
            {
                TLV tlvToAdd = TLV.Create(x.Tag);
                result.AddToList(tlvToAdd);
                if (x.Children.Count > 0)
                {
                    tlvToAdd.Children.AddListToList(DeserList(x.Children));
                }
                else
                if (x.Value != null)
                {
                    tlvToAdd.Value = x.Value;
                }
            });
            return(result);
        }