Beispiel #1
0
 public Paquete()
 {
     this.idDato  = IdentificadorDato.Null;
     this.identi  = IdentificadorListado.Null;
     this.mensaje = null;
     this.nombre  = null;
 }
Beispiel #2
0
        public Paquete(byte[] arregloBytes)
        {
            this.idDato = (IdentificadorDato)BitConverter.ToInt32(arregloBytes, 0);
            int longitudNombre  = BitConverter.ToInt32(arregloBytes, 4);
            int longitudMensaje = BitConverter.ToInt32(arregloBytes, 8);

            if (longitudNombre > 0)
            {
                this.nombre = Encoding.UTF8.GetString(arregloBytes, 12, longitudNombre);
            }
            else
            {
                this.nombre = null;
            }
            if (longitudMensaje > 0)
            {
                this.mensaje = Encoding.UTF8.GetString(arregloBytes, 12 + longitudNombre, longitudMensaje);
            }
            else
            {
                this.mensaje = null;
            }
        }