private void test5() { // The complex situation is that you need to parse the byte array yourself. // Here's just one example. OperateResult <byte[]> read = keyence_net.Read("D100", 10); if (read.IsSuccess) { int count = keyence_net.ByteTransform.TransInt32(read.Content, 0); float temp = keyence_net.ByteTransform.TransSingle(read.Content, 4); short name1 = keyence_net.ByteTransform.TransInt16(read.Content, 8); string barcode = Encoding.ASCII.GetString(read.Content, 10, 10); } }
private void button25_Click(object sender, EventArgs e) { try { OperateResult <byte[]> read = keyence_net.Read(textBox6.Text, ushort.Parse(textBox9.Text)); if (read.IsSuccess) { textBox10.Text = "结果:" + HslCommunication.BasicFramework.SoftBasic.ByteToHexString(read.Content); } else { MessageBox.Show("读取失败:" + read.ToMessageShowString( )); } } catch (Exception ex) { MessageBox.Show("读取失败:" + ex.Message); } }