Skip to content

Commit

Permalink
Count braces to detect complete commands
Browse files Browse the repository at this point in the history
  • Loading branch information
EarToEarOak committed Apr 13, 2016
1 parent 17c0ac9 commit 62bfa48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NetRemote/Serial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion NetRemote/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 62bfa48

Please sign in to comment.