/// <summary> /// Deserialize fields in this class from a stream. /// </summary> /// <param name="stream">Stream contains a serialized instance of this class.</param> /// <param name="size">How many bytes can read if -1, no limitation. MUST be -1.</param> /// <returns>Bytes have been read from the stream.</returns> public override int Deserialize(Stream stream, int size) { AdapterHelper.Site.Assert.AreEqual(-1, size, "The size value MUST be -1, the actual value is {0}.", size); int bytesRead = 0; this.xidSize = StreamHelper.ReadUInt8(stream); bytesRead += 1; this.xid = new XID(); bytesRead += this.xid.Deserialize(stream, (int)this.xidSize); return(bytesRead); }
/// <summary> /// Reads a byte from the stream. /// </summary> /// <returns>A byte value read from the stream.</returns> private byte ReadByte() { return(StreamHelper.ReadUInt8(this.stream)); }