Exemplo n.º 1
0
 /// <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));
 }
Exemplo n.º 2
0
        /// <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));
        }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
 public void Respond(int response, ResponseStatus statusCode = ResponseStatus.Default)
 {
     Respond(MessageHelper.Create(OpCode, response), statusCode);
 }
Exemplo n.º 5
0
 /// <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);
 }