コード例 #1
0
        private object ReadCoil(string address, ushort length)
        {
            OperateResult <byte[]> b = xGBCnet.Read(address, length);

            if (!b.IsSuccess)
            {
                throw new InvalidOperationException($"{b.Message}");
            }
            else
            {
                return(HslCommunication.BasicFramework.SoftBasic.ByteToBoolArray(b.Content));
            }
        }
コード例 #2
0
 private void button25_Click(object sender, EventArgs e)
 {
     if (textBox6.Text.IndexOf(';') < 0)
     {
         DemoUtils.BulkReadRenderResult(xGBCnet, textBox6, textBox9, textBox10);
     }
     else
     {
         string[] address            = textBox6.Text.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
         OperateResult <byte[]> read = xGBCnet.Read(address);
         if (read.IsSuccess)
         {
             textBox10.Text = "Result: " + read.Content.ToHexString(' ');
         }
         else
         {
             MessageBox.Show("Read Failed! " + read.Message);
         }
     }
 }