示例#1
0
        public override byte[] GetBytes(int extraLength)
        {
            byte[] bytes  = base.GetBytes(extraLength);
            int    offset = Size - sizeof(UInt32);

            AddBytes(bytes, ref offset, Bigendian.GetBigendianBytes(Flags));

            return(bytes);
        }
示例#2
0
        public void UInt32Test()
        {
            UInt32 expected = 0x12345678;

            byte[] bytes  = Bigendian.GetBigendianBytes(expected);
            UInt32 actual = Bigendian.BigendianToUInt32(bytes, 0);

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void UInt16Test()
        {
            UInt16 expected = 0x1234;

            byte[] bytes  = Bigendian.GetBigendianBytes(expected);
            UInt16 actual = Bigendian.BigendianToUInt16(bytes, 0);

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public virtual byte[] GetBytes(int extraLength)
        {
            byte[] bytes  = new byte[Size + extraLength];
            int    offset = 0;

            bytes[offset++] = MajorVersion;
            bytes[offset++] = MinorVersion;
            AddBytes(bytes, ref offset, Bigendian.GetBigendianBytes(Size));
            AddBytes(bytes, ref offset, Bigendian.GetBigendianBytes(ExpiryTimeLow));
            AddBytes(bytes, ref offset, Bigendian.GetBigendianBytes(ExpiryTimeHigh));
            AddBytes(bytes, ref offset, ClientID);

            return(bytes);
        }
示例#5
0
 public void GetBigendianBytesTest()
 {
     byte[] expected = new byte[] { 0x22, 0x11 };
     byte[] actual   = Bigendian.GetBigendianBytes(0x2211);
     Helpers.AreArrayEqual(expected, actual);
 }