Esempio n. 1
0
        public override bool Pack(UdpStream stream, ref object o)
        {
            // cast to string and get bytes
            byte[] bytes = (byte[])(o);

            // write length and bytes into buffer
            stream.WriteInt(bytes.Length);
            stream.WriteByteArray(bytes);

            return(true);
        }
Esempio n. 2
0
        public override bool Pack(UdpStream stream, ref object o)
        {
            // cast to string and get bytes
            string msg = (string) o;
            byte[] bytes = Encoding.UTF8.GetBytes(msg);

            // write length and bytes into buffer
            stream.WriteInt(bytes.Length);
            stream.WriteByteArray(bytes);

            return true;
        }
Esempio n. 3
0
        public override bool Pack(UdpStream stream, ref object o)
        {
            // cast to string and get bytes
            string msg = (string)o;

            byte[] bytes = Encoding.UTF8.GetBytes(msg);

            // write length and bytes into buffer
            stream.WriteInt(bytes.Length);
            stream.WriteByteArray(bytes);

            return(true);
        }
 public override bool Pack(UdpStream stream, NetMessage input, out NetMessage sent)
 {
     stream.WriteByteArray(input.Data, 0, input.LengthBytes);
     sent = input;
     return(true);
 }