private static byte CONSTRUCTED_DATAOBJECT_MASK = 0x20; // 0010 0000 (Object primitive or constructed) public static TLVList Parse(Stream s) { TLVList l = new TLVList(); while (s.Position < s.Length) { TLV t = new TLV(s); t.Childs = TLV.ParseTagList(t.Value); l.Add(t); } return(l); }
private static TLVList ParseTagList(byte[] data) { TLVList tagList = new TLVList(); MemoryStream ms = new MemoryStream(data); while (ms.Position < ms.Length) { TLV tlv = new TLV(ms); if (tlv.Value != null && tlv.Value.Length > 0) { if (tlv.isConstructed) { tlv.Childs = TLV.ParseTagList(tlv.Value); } tagList.Add(tlv); } } return(tagList); }