/// <summary> /// Reads and constructs a MDSMessage according to the protocol rules. /// </summary> /// <param name="deserializer">Deserializer to read message</param> /// <returns>MDSMessage object that is read</returns> public MDSMessage ReadMessage(IMDSDeserializer deserializer) { //Read protocol type var protocolType = deserializer.ReadUInt32(); if (protocolType != MDSDefaultProtocolType) { throw new MDSException("Wrong protocol type: " + protocolType + "."); } //Read message type var messageTypeId = deserializer.ReadInt32(); //Read and return message return deserializer.ReadObject(() => MDSMessageFactory.CreateMessageByTypeId(messageTypeId)); }
/// <summary> /// Reads and constructs a MDSMessage according to the protocol rules. /// </summary> /// <param name="deserializer">Deserializer to read message</param> /// <returns>MDSMessage object that is read</returns> public MDSMessage ReadMessage(IMDSDeserializer deserializer) { //Read protocol type var protocolType = deserializer.ReadUInt32(); if (protocolType != MDSDefaultProtocolType) { throw new MDSException("Wrong protocol type: " + protocolType + "."); } //Read message type var messageTypeId = deserializer.ReadInt32(); //Read and return message return(deserializer.ReadObject(() => MDSMessageFactory.CreateMessageByTypeId(messageTypeId))); }
/// <summary> /// Deserializes this message. /// </summary> /// <param name="deserializer">Deserializer used to deserialize objects</param> public override void Deserialize(IMDSDeserializer deserializer) { base.Deserialize(deserializer); ServerGraph = deserializer.ReadObject(() => new ServerGraphInfo()); }
/// <summary> /// Deserializes this message. /// </summary> /// <param name="deserializer">Deserializer used to deserialize objects</param> public override void Deserialize(IMDSDeserializer deserializer) { base.Deserialize(deserializer); Result = deserializer.ReadObject(() => new MDSOperationResultMessage()); Message = deserializer.ReadObject(() => new MDSDataTransferMessage()); }