Пример #1
0
        /// <summary>
        /// Parses the byte-array to UInt16.
        /// </summary>
        /// <returns>The user interface nt16.</returns>
        /// <param name="bytes">Bytes.</param>
        /// <param name="offset">Offset.</param>
        public static ushort ParseUInt16(byte[] bytes, ref int offset)
        {
            var readBytes = 0;
            var newBytes  = new byte[bytes.Length - offset];

            Array.Copy(bytes, offset, newBytes, 0, bytes.Length - offset);
            var ushortResult = VarintBitConverter.ToUInt16(newBytes, out readBytes);

            offset += readBytes;

            return(ushortResult);
        }
Пример #2
0
 /// <summary>
 /// Parses the byte-array to UInt16.
 /// </summary>
 /// <returns>The user interface nt16.</returns>
 /// <param name="bytes">Bytes.</param>
 public static ushort ParseUInt16(byte[] bytes)
 {
     return(VarintBitConverter.ToUInt16(bytes));
 }
Пример #3
0
        /// <summary>
        /// Parses the stream to UInt16.
        /// </summary>
        /// <returns>The user interface nt16.</returns>
        /// <param name="stream">Stream.</param>
        public static ushort ParseUInt16(Stream stream)
        {
            var byteArray = ParseStreamToByteArray(stream);

            return(VarintBitConverter.ToUInt16(byteArray));
        }