Exemple #1
0
        /// <inheritdoc/>
        public Byte[] Encode(Response response)
        {
            DatagramWriter writer = new DatagramWriter();

            Serialize(writer, response, response.Code);
            return(writer.ToByteArray());
        }
Exemple #2
0
        /// <inheritdoc/>
        public Byte[] Encode(EmptyMessage message)
        {
            DatagramWriter writer = new DatagramWriter();

            Serialize(writer, message, Code.Empty);
            return(writer.ToByteArray());
        }
Exemple #3
0
        /// <inheritdoc/>
        public Byte[] Encode(Request request)
        {
            DatagramWriter writer = new DatagramWriter();

            Serialize(writer, request, request.Code);
            return(writer.ToByteArray());
        }
Exemple #4
0
 /// <summary>
 /// Serializes a message.
 /// </summary>
 /// <param name="writer">the writer</param>
 /// <param name="message">the message to write</param>
 /// <param name="code">the code</param>
 protected abstract void Serialize(DatagramWriter writer, Message message, Int32 code);