Beispiel #1
0
        /// <summary>
        /// Parses the byte-array to UInt64.
        /// </summary>
        /// <returns>The user interface nt64.</returns>
        /// <param name="bytes">Bytes.</param>
        /// <param name="offset">Offset.</param>
        public static ulong ParseUInt64(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 ulongResult = VarintBitConverter.ToUInt64(newBytes, out readBytes);

            offset += readBytes;

            return(ulongResult);
        }
Beispiel #2
0
        /// <summary>
        /// Parses the byte-array to Int32.
        /// </summary>
        /// <returns>The int32.</returns>
        /// <param name="bytes">Bytes.</param>
        /// <param name="offset">Offset.</param>
        public static int ParseInt32(byte[] bytes, ref int offset)
        {
            var readBytes = 0;
            var newBytes  = new byte[bytes.Length - offset];

            Array.Copy(bytes, offset, newBytes, 0, newBytes.Length);
            var intResult = VarintBitConverter.ToInt32(newBytes, out readBytes);

            offset += readBytes;

            return(intResult);
        }
Beispiel #3
0
 /// <summary>
 /// Parses the byte-array to Int64.
 /// </summary>
 /// <returns>The int64.</returns>
 /// <param name="bytes">Bytes.</param>
 public static long ParseInt64(byte[] bytes)
 {
     return(VarintBitConverter.ToInt64(bytes));
 }
Beispiel #4
0
 /// <summary>
 /// Parses the byte-array to Int32.
 /// </summary>
 /// <returns>The int32.</returns>
 /// <param name="bytes">Bytes.</param>
 public static int ParseInt32(byte[] bytes)
 {
     return(VarintBitConverter.ToInt32(bytes));
 }
Beispiel #5
0
 /// <summary>
 /// Parses the byte-array to Int16.
 /// </summary>
 /// <returns>The int16.</returns>
 /// <param name="bytes">Bytes.</param>
 public static short ParseInt16(byte[] bytes)
 {
     return(VarintBitConverter.ToInt16(bytes));
 }
Beispiel #6
0
        /// <summary>
        /// Parses the stream to Int64.
        /// </summary>
        /// <returns>The int64.</returns>
        /// <param name="stream">Stream.</param>
        public static long ParseInt64(Stream stream)
        {
            var byteArray = ParseStreamToByteArray(stream);

            return(VarintBitConverter.ToInt64(byteArray));
        }
Beispiel #7
0
        /// <summary>
        /// Parses the stream to Int16.
        /// </summary>
        /// <returns>The int16.</returns>
        /// <param name="stream">Stream.</param>
        public static short ParseInt16(Stream stream)
        {
            var byteArray = ParseStreamToByteArray(stream);

            return(VarintBitConverter.ToInt16(byteArray));
        }
Beispiel #8
0
        /// <summary>
        /// Parses the stream to UInt32.
        /// </summary>
        /// <returns>The user interface nt32.</returns>
        /// <param name="stream">Stream.</param>
        public static uint ParseUInt32(Stream stream)
        {
            var byteArray = ParseStreamToByteArray(stream);

            return(VarintBitConverter.ToUInt32(byteArray));
        }