private void StreamWrite(F16_ICP button, int value, NetworkStream stream) { var message = $"{button.ToString()} {value}\n"; Byte[] data = System.Text.Encoding.ASCII.GetBytes(message); stream.Write(data, 0, data.Length); }
public void SendCommand(F16_ICP button, NetworkStream stream) { switch (button) { case F16_ICP.ICP_DATA_RTN_SEQ_SW: case F16_ICP.ICP_DATA_UP_DN_SW: StreamWrite(button, 0, stream); Thread.Sleep(100); StreamWrite(button, 1, stream); break; default: StreamWrite(button, 1, stream); Thread.Sleep(100); StreamWrite(button, 0, stream); break; } Thread.Sleep(100); }