示例#1
0
        /// <summary>
        /// Writes a Double Value into the block
        /// </summary>
        /// <param name="typeCode">The type code of the TLV to contain the data</param>
        /// <param name="data">The data to write</param>
        public void WriteDouble(int typeCode, double data)
        {
            CheckAccess();
            byte[] byteArray = System.BitConverter.GetBytes(data);
            Array.Reverse(byteArray);

            tlvList.Add(TLVMarshal.MakeTLV(typeCode, byteArray));
            tlvBlockSize += 8;
        }
示例#2
0
 /// <summary>
 /// Writes a 16-bit unsigned integer TLV into the block
 /// </summary>
 /// <param name="typeCode">The type code of the TLV to contain the data</param>
 /// <param name="data">The data to write</param>
 public void WriteUint(int typeCode, uint data)
 {
     CheckAccess();
     byte[] byteArray = new byte[4];
     byteArray[0] = (byte)((data & 0xFF000000) >> 24);
     byteArray[1] = (byte)((data & 0x00FF0000) >> 16);
     byteArray[2] = (byte)((data & 0x0000FF00) >> 8);
     byteArray[3] = (byte)((data & 0x000000FF));
     tlvList.Add(TLVMarshal.MakeTLV(typeCode, byteArray));
     tlvBlockSize += 4;
 }
示例#3
0
 /// <summary>
 /// Writes a byte array TLV into the block
 /// </summary>
 /// <param name="typeCode">The type code of the TLV to contain the data</param>
 /// <param name="data">The data to write</param>
 public void WriteByteArray(int typeCode, byte[] data)
 {
     CheckAccess();
     tlvList.Add(TLVMarshal.MakeTLV(typeCode, data));
     tlvBlockSize += data.Length;
 }
示例#4
0
 /// <summary>
 /// Writes a string TLV into the block
 /// </summary>
 /// <param name="typeCode">The type code of the TLV to contain the data</param>
 /// <param name="data">The data to write</param>
 /// <param name="encoding">The encoding to use to write the data</param>
 public void WriteString(int typeCode, string data, Encoding encoding)
 {
     CheckAccess();
     tlvList.Add(TLVMarshal.MakeTLV(typeCode, encoding.GetBytes(data)));
     tlvBlockSize += encoding.GetByteCount(data);
 }
示例#5
0
 /// <summary>
 /// Writes a single byte TLV into the block
 /// </summary>
 /// <param name="typeCode">The type code of the TLV to contain the data</param>
 /// <param name="data">The data to write</param>
 public void WriteByte(int typeCode, byte data)
 {
     CheckAccess();
     tlvList.Add(TLVMarshal.MakeTLV(typeCode, new byte[] { data }));
     tlvBlockSize += 1;
 }
示例#6
0
 /// <summary>
 /// Writes an empty TLV into the block
 /// </summary>
 /// <param name="typeCode">The type code of the TLV to write</param>
 public void WriteEmpty(int typeCode)
 {
     CheckAccess();
     tlvList.Add(TLVMarshal.MakeTLV(typeCode, null));
 }