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 isAddOrUpdata() { string name = textBoxName.Text; List <byte> ListArray = new List <byte>(); byte[] byteArray = ByteWithString.encodeingToByte(name, "utf-8"); //名称 ListArray.AddRange(ByteWithString.intTo4Byte(byteArray.Length)); //名称长度 ListArray.AddRange(byteArray.ToList()); //名称 ListArray.AddRange(ByteWithString.strToToHexByte(textBoxAddress.Text)); //地址 ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(comboBox1.SelectedValue.ToString()))); //A ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(comboBox2.SelectedValue.ToString()))); //B ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(comboBox3.SelectedValue.ToString()))); //C ListArray.AddRange(thisId); //C this.theScoket.theSocketSend <byte[]>(0x31, ListArray.ToArray()); }
private void isAddOrUpdateMethod() { 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(int.Parse(byteArray.Length.ToString()))); //名称长度 ListArray.AddRange(byteArray.ToList()); //名称 ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(byteArrayRemake.Length.ToString()))); //编号长度 ListArray.AddRange(byteArrayRemake); ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(comboBox2.SelectedValue.ToString()))); //上一个检测点id ListArray.AddRange(ByteWithString.strToToHexByte(textBoxA.Text)); //A ListArray.AddRange(ByteWithString.strToToHexByte(textBoxB.Text)); //B ListArray.AddRange(ByteWithString.strToToHexByte(textBoxC.Text)); //C ListArray.AddRange(ByteWithString.intTo4Byte(int.Parse(comboBox1.SelectedValue.ToString()))); //所属的id ListArray.AddRange(thisId); //id this.theScoket.theSocketSend <byte[]>(0x30, ListArray.ToArray()); // }