public bool Unpack(MemoryStream stream) { BuildNumber = BigEndianUtilities.ReadUShort(stream); Minor = Convert.ToByte(stream.ReadByte()); Major = Convert.ToByte(stream.ReadByte()); SubBuildNumber = BigEndianUtilities.ReadUShort(stream); return(true); }
public bool Unpack(MemoryStream stream) { Type = (TDSMessageType)stream.ReadByte(); Status = (TDSMessageStatus)stream.ReadByte(); Length = BigEndianUtilities.ReadUShort(stream); SPID = BigEndianUtilities.ReadUShort(stream); Packet = Convert.ToByte(stream.ReadByte()); Window = Convert.ToByte(stream.ReadByte()); return(true); }
public bool Unpack(MemoryStream stream) { Type = (TDSPreLoginOptionTokenType)stream.ReadByte(); if (Type != TDSPreLoginOptionTokenType.Terminator) { Offset = BigEndianUtilities.ReadUShort(stream); Length = BigEndianUtilities.ReadUShort(stream); } return(true); }
public void ReadUShortFromMemoryStream() { var stream = new MemoryStream(); stream.Write(new byte[] { 0x01, 0x23 }); stream.Seek(0, SeekOrigin.Begin); var res = BigEndianUtilities.ReadUShort(stream); Assert.AreEqual(0x0123, res); }