public static CdrElement CreateFromTlv(TlvObject tlv) { CdrElement element = new CdrElement(); element._offset = tlv.Offset; element._path = tlv.Path; element._name = tlv.Path; element._isConstructed = tlv.IsConstructed; if (!tlv.IsEmpty) { if (tlv.IsConstructed) { List <CdrElement> val = new List <CdrElement>((tlv.Value as List <TlvObject>).Count); foreach (TlvObject ch in (tlv.Value as List <TlvObject>)) { val.Add(CdrElement.CreateFromTlv(ch)); } ; element._value = val; } else { byte[] src = (tlv.Value as byte[]); byte[] dst = new byte[src.Length]; Array.Copy(src, dst, src.Length); element._value = dst; } } return(element); }
public CdrElement ParseTlvObject(TlvObject tlv) { CdrElement element = CdrElement.CreateFromTlv(tlv); this.ParseElement(element); return(element); }