Пример #1
0
        private void isAddOrUpdateMethod()
        {
            List <byte> ListArray = new List <byte>();

            byte[] byteArray       = ByteWithString.encodeingToByte(textBox1.Text, "utf-8");
            byte[] byteArrayRemake = ByteWithString.encodeingToByte(textBox2.Text, "utf-8");
            ListArray.AddRange(ByteWithString.intTo4Byte(byteArray.Length));
            ListArray.AddRange(byteArray.ToList());
            ListArray.AddRange(ByteWithString.intTo4Byte(byteArrayRemake.Length));
            ListArray.AddRange(byteArrayRemake.ToList());
            ListArray.AddRange(thisId);
            theScoket.theSocketSend <byte[]>(0x27, ListArray.ToArray());
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="command">标志</param>
        /// <param name="addOrUpdate">增加或修改</param>
        /// <param name="bytesArray">id</param>
        /// <param name="bytesArray">所属于</param>
        public void GetContent(byte command, byte[] bytesId)
        {
            List <byte> ListArray = new List <byte>();

            byte[] byteArray       = ByteWithString.encodeingToByte(textBox2.Text, "utf-8");                       //名称
            byte[] byteArrayRemake = ByteWithString.encodeingToByte(textBox1.Text, "utf-8");                       //编号
            ListArray.AddRange(ByteWithString.intTo4Byte(byteArray.Length).ToList());                              //名称长度
            ListArray.AddRange(byteArray.ToList());                                                                //名称
            ListArray.AddRange(ByteWithString.intTo4Byte(byteArrayRemake.Length).ToList());                        //编号长度
            ListArray.AddRange(byteArrayRemake.ToList());                                                          //编号
            ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(comboBox1.SelectedValue.ToString())).ToList()); //所属的id
            ListArray.AddRange(bytesId);                                                                           //id
            theScoket.theSocketSend <byte[]>(command, ListArray.ToArray());                                        //
        }
 //刷新变电站
 private void button17_Click(object sender, EventArgs e)
 {
     byte[] bytes = new byte[] { 0x23 };
     theScoket.theSocketSend <byte[]>(0x34, bytes.ToArray());
 }