示例#1
0
        private static void DecodingConvert(BinaryReader br, ref object obj, TTLVStructNode node, int valueLength)
        {
            byte[] valueBuffer = new byte[valueLength];
            br.Read(valueBuffer, 0, valueBuffer.Length);
            object memberValue = node.GetValue(obj);
            object value       = node.Converter.ConvertBackObject(node.Tag, valueBuffer, memberValue, node.GetMemberType(), node.ConverterPara);

            SetTTLVNodeValue(obj, node, value);
        }
示例#2
0
        private static void DecodingIList(BinaryReader br, ref object obj, TTLVStructNode node, int valueLength)
        {
            var list = (IList)node.GetValue(obj);

            if (list == null)
            {
                list = (IList)node.CreateMemberInstance();
                SetTTLVNodeValue(obj, node, list);
            }

            DecodingCollection(list, br, node, valueLength);
        }
示例#3
0
        private static void DecodingObject(BinaryReader br, ref object obj, TTLVStructNode node, int valueLength)
        {
            var obj2 = node.GetValue(obj);

            if (obj2 == null)
            {
                obj2 = node.CreateMemberInstance();
                SetTTLVNodeValue(obj, node, obj2);
            }

            var endPosition = br.BaseStream.Position + valueLength;
            var childs      = GetTTLVStructNodeChilds(node);

            PrimitiveDecoding(br, endPosition, ref obj2, childs);
            br.BaseStream.Position = endPosition;
        }