Beispiel #1
0
        /// <summary>
        /// get 2 byte big endian unsigned int from byte array.
        /// </summary>
        /// <param name="Bytes"></param>
        /// <param name="Offset"></param>
        /// <returns></returns>
        public static ushort GetBigEndianUShort(this byte[] Bytes, int Offset)
        {
            if (Offset + 1 >= Bytes.Length)
            {
                throw new Exception("past end of byte array");
            }
            var ip = IntParts.LoadBigEndianShort(Bytes, Offset);

            return(ip.UnsignedShortValue);
        }
Beispiel #2
0
        /// <summary>
        /// get 3 byte big endian int from byte array.
        /// </summary>
        /// <param name="Bytes"></param>
        /// <param name="Offset"></param>
        /// <returns></returns>
        public static int GetBigEndianInt3(this byte[] Bytes, int Offset)
        {
            if (Offset + 2 >= Bytes.Length)
            {
                throw new Exception("past end of byte array");
            }
            var ip = IntParts.LoadBigEndianInt3(Bytes, Offset);

            return(ip.IntValue);
        }
Beispiel #3
0
        public static byte[] ToBigEndian(this short Value)
        {
            var buf = IntParts.ToBigEndianShort(Value);

            return(buf);
        }