/// <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>() where T : ISerializablePacket, new() { return(MessageHelper.DeserializeList <T>(_data)); }
/// <summary> /// Writes content of the message into a packet /// </summary> /// <typeparam name="T"></typeparam> /// <param name="packetToBeFilled"></param> /// <returns></returns> public T Deserialize <T>() where T : ISerializablePacket, new() { var packetToBeFilled = new T(); 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); }
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); }