/// <summary> /// Uses content of the message to regenerate list of packets /// </summary> /// <typeparam name="T"></typeparam> /// <param name="packetCreator"></param> /// <returns></returns> public IEnumerable <T> DeserializeList <T>(Func <T> packetCreator) where T : ISerializablePacket { return(MessageHelper.DeserializeList(_data, packetCreator)); }
/// <summary> /// Writes content of the message into a packet /// </summary> /// <typeparam name="T"></typeparam> /// <param name="packetToBeFilled"></param> /// <returns></returns> public T Deserialize <T>(T packetToBeFilled) where T : ISerializablePacket { return(MessageHelper.Deserialize(_data, packetToBeFilled)); }
/// <summary> /// Respond with data (message is created internally) /// </summary> /// <param name="data"></param> /// <param name="statusCode"></param> public void Respond(ISerializablePacket packet, ResponseStatus statusCode = ResponseStatus.Default) { Respond(MessageHelper.Create(OpCode, packet.ToBytes()), statusCode); }
/// <summary> /// /// </summary> /// <param name="response"></param> /// <param name="statusCode"></param> public void Respond(int response, ResponseStatus statusCode = ResponseStatus.Default) { Respond(MessageHelper.Create(OpCode, response), statusCode); }
/// <summary> /// Respond with data (message is created internally) /// </summary> /// <param name="data"></param> /// <param name="statusCode"></param> public void Respond(byte[] data, ResponseStatus statusCode = ResponseStatus.Default) { Respond(MessageHelper.Create(OpCode, data), statusCode); }