コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: CdrTlvParser.cs プロジェクト: ec49ce/cdr-decoder
        public CdrElement ParseTlvObject(TlvObject tlv)
        {
            CdrElement element = CdrElement.CreateFromTlv(tlv);

            this.ParseElement(element);

            return(element);
        }