将16进制字符串转换成16进制数据

var tb1 = Tb1.Text;
            if (string.IsNullOrEmpty(tb1))
            {
                tb1 = "0000";
            }
            var s1 = tb1.Substring(0, 2);
            var int_1 = Convert.ToInt32(s1, 16);
            var s2 = tb1.Substring(2, 2);
            var int_2 = Convert.ToInt32(s2, 16);
            var bt1 = Convert.ToByte(int_1);
            var bt2 = Convert.ToByte(int_2);
            var bt = new byte[] { 0xfc, 0x07, bt1, bt2 };
            var vCrc = CrcCcitt.Crc(bt);
            tb_status.Text += "Disable Set --->" + Environment.NewLine;
            tb_status.Text += "[";
            foreach (var b in vCrc)
            {
                tb_status.Text += Convert.ToString(b, 16) + " ";
            }
            tb_status.Text += "]" + Environment.NewLine;
            var data = _intoNotes.SettingCommand(vCrc);
            tb_status.Text += data + Environment.NewLine;
上一篇:C语言OJ项目参考(2747) 进制转换


下一篇:文件和目录属性ls which alias