Exemple #1
0
 private void txtHex_KeyUp(object sender, KeyEventArgs e)
 {
     if (string.IsNullOrEmpty(txtHex.Text))
     {
         return;
     }
     try
     {
         byte[] bits = Convertor.Hex2Bytes(txtHex.Text);
         txtStr.Text   = Convertor.Bytes2String(bits);
         txtAscii.Text = Convertor.Bytes2AsciiStr(bits);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        private void appendReceiveData(byte[] buffer)
        {
            if (buffer == null)
            {
                appendCmdMsg("received null.");
                return;
            }
            var rec = Convertor.Bytes2Hex(buffer);

            if (checkAscii.Checked)
            {
                rec = Convertor.Bytes2AsciiStr(buffer);
            }
            if (checkStr.Checked)
            {
                rec = Convertor.Bytes2String(buffer);
            }
            txtReceive.AppendText(buildReceiveData(rec));
        }
Exemple #3
0
        void _spr_DataReceived(object sender, SerialDataReceivedEventArgs e, byte[] bits)
        {
            if (bits == null)
            {
                txtCmdMsg.Text = "received null.";
                return;
            }
            string rec = Convertor.Bytes2Hex(bits);

            if (checkAscii.Checked)
            {
                rec = Convertor.Bytes2AsciiStr(bits);
            }
            if (checkStr.Checked)
            {
                rec = Convertor.Bytes2String(bits);
            }
            listBox1.Items.Add(rec);
            //throw new NotImplementedException();
        }
Exemple #4
0
 public void BitConverter(byte[] bits)
 {
     Str = Convertor.Bytes2String(bits);
     Asc = Convertor.Bytes2AsciiStr(bits);
     Hex = Convertor.Bytes2Hex(bits);
 }