public Paquete() { this.idDato = IdentificadorDato.Null; this.identi = IdentificadorListado.Null; this.mensaje = null; this.nombre = null; }
public Paquete(byte[] arregloBytes) { this.idDato = (IdentificadorDato)BitConverter.ToInt32(arregloBytes, 0); this.identi = (IdentificadorListado)BitConverter.ToInt32(arregloBytes, 4); int longitudNombre = BitConverter.ToInt32(arregloBytes, 8); int longitudMensaje = BitConverter.ToInt32(arregloBytes, 12); if (longitudNombre > 0) { this.nombre = Encoding.UTF8.GetString(arregloBytes, 16, longitudNombre); } else { this.nombre = null; } if (longitudMensaje > 0) { this.mensaje = Encoding.UTF8.GetString(arregloBytes, 16 + longitudNombre, longitudMensaje); } else { this.mensaje = null; } }