예제 #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));
 }
예제 #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));
        }
예제 #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);
 }
예제 #4
0
 public void Respond(int response, ResponseStatus statusCode = ResponseStatus.Default)
 {
     Respond(MessageHelper.Create(OpCode, response), statusCode);
 }
예제 #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);
 }