private void PrimitiveConvertToBytes(List <byte> buffer, IEnumerable collection, TypeCode typeCode) { foreach (var item in collection) { byte[] tmpBuffer = TTLVCommon.ConvertToBytes(typeCode, item); buffer.AddRange(tmpBuffer); } }
private void PrimitiveStringCollectionConvertToBytes(List <byte> buffer, IEnumerable collection, TypeCode typeCode) { foreach (var item in collection) { if (item == null) { buffer.AddRange(this._stringNullLengthBuffer); } else { byte[] tmpBuffer = TTLVCommon.ConvertToBytes(typeCode, item); buffer.AddRange(BitConverter.GetBytes(tmpBuffer.Length)); if (tmpBuffer.Length > 0) { buffer.AddRange(tmpBuffer); } } } }
private static void EncodingBasicType(List <byte> buffer, TTLVStructNode node, object objValue) { byte[] valueBuffer = TTLVCommon.ConvertToBytes(node.TypeCode, objValue); AddTTLVNodeValue(buffer, node, valueBuffer); }