public virtual byte[] GetBytes() { byte[] bodyData = GetBodyData(); string uni = Encoding.Unicode.GetString(bodyData); string ascii = Encoding.ASCII.GetString(bodyData); string utf8 = Encoding.UTF8.GetString(bodyData); byte[] tlvData = vTlv.GetBytes(); int length = 16; length += bodyData == null ? 0 : bodyData.Length; length += tlvData == null ? 0 : tlvData.Length; vHeader.CommandLength = (uint)length; ByteBuffer buffer = new ByteBuffer(length); //Allocate buffer with enough capacity buffer.Append(vHeader.GetBytes()); if (bodyData != null) { buffer.Append(bodyData); } if (tlvData != null) { buffer.Append(tlvData); } return(buffer.ToBytes()); }
public virtual byte[] GetBytes() { byte[] bodyData = GetBodyData(); byte[] tlvData = VTlv.GetBytes(); int length = 16; length += bodyData == null ? 0 : bodyData.Length; length += tlvData == null ? 0 : tlvData.Length; VHeader.CommandLength = (uint)length; ByteBuffer buffer = new ByteBuffer(length); //Allocate buffer with enough capacity buffer.Append(VHeader.GetBytes()); if (bodyData != null) { buffer.Append(bodyData); } if (tlvData != null) { buffer.Append(tlvData); } return(buffer.ToBytes()); }