コード例 #1
0
 private void PrimitiveConvertToBytes(List <byte> buffer, IEnumerable collection, TypeCode typeCode)
 {
     foreach (var item in collection)
     {
         byte[] tmpBuffer = TTLVCommon.ConvertToBytes(typeCode, item);
         buffer.AddRange(tmpBuffer);
     }
 }
コード例 #2
0
 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);
             }
         }
     }
 }
コード例 #3
0
 private static void EncodingBasicType(List <byte> buffer, TTLVStructNode node, object objValue)
 {
     byte[] valueBuffer = TTLVCommon.ConvertToBytes(node.TypeCode, objValue);
     AddTTLVNodeValue(buffer, node, valueBuffer);
 }