diff --git a/NetRemote/Serial.cs b/NetRemote/Serial.cs index ef3b841..4821ebb 100644 --- a/NetRemote/Serial.cs +++ b/NetRemote/Serial.cs @@ -109,7 +109,7 @@ private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) string result; _data += port.ReadExisting(); - if (_data.IndexOf("\n") > -1 || _data.IndexOf("\r") > -1) + if (_data.Split('{').Length == _data.Split('}').Length) { try { diff --git a/NetRemote/Server.cs b/NetRemote/Server.cs index bae742c..3dea083 100644 --- a/NetRemote/Server.cs +++ b/NetRemote/Server.cs @@ -189,7 +189,7 @@ private void ReadCallback(IAsyncResult ar) client.data.Append(Encoding.ASCII.GetString(client.buffer, 0, read)); data = client.data.ToString(); - if (data.IndexOf("\n") > -1 || data.IndexOf("\r") > -1) + if (data.Split('{').Length == data.Split('}').Length) { try {