/// <summary> /// Constructs the instance by parsing the serialized byte array passed. /// </summary> /// <param name="input">A byte array formatted as return by <see cref="ToArray" />.</param> /// <exception cref="FormatException">Thrown if the byte array passed is not valid.</exception> public DuplexSessionHeader(byte[] input) { int pos; if (input.Length != Size || input[0] != 0) { throw new FormatException("Invalid DuplexSessionHeader."); } this.Type = (DuplexMessageType)input[1]; pos = 2; this.QueryID = Helper.ReadGuid(input, ref pos); }
/// <summary> /// Constructor. /// </summary> /// <param name="queryID">The session relative ID used to correlate queries and responses.</param> /// <param name="type"> /// The <see cref="DuplexMessageType" /> value indicating whether the message /// is a query or a response. /// </param> public DuplexSessionHeader(Guid queryID, DuplexMessageType type) { this.QueryID = queryID; this.Type = type; }