Begin implementing "/update" responses from QLab

This commit is contained in:
2019-04-08 16:06:15 -05:00
parent 091ea32ccc
commit d2b295c328
11 changed files with 107 additions and 54 deletions
@@ -32,7 +32,6 @@ namespace SharpOSC
char[] types = new char[0];
List<object> arguments = new List<object>();
List<object> mainArray = arguments; // used as a reference when we are parsing arrays to get the main array back
// Get address
address = getAddress(msg, index);
index += msg.FirstIndexAfter(address.Length, x => x == ',');
@@ -147,7 +146,7 @@ namespace SharpOSC
case ('['):
if (arguments != mainArray)
throw new Exception("SharopOSC does not support nested arrays");
throw new Exception("SharpOSC does not support nested arrays");
arguments = new List<object>(); // make arguments point to a new object array
break;
@@ -247,6 +246,12 @@ namespace SharpOSC
}
}
if (types == null)
{
byte[] term = { 0 };
types = Encoding.ASCII.GetChars(term);
}
if (i >= msg.Length && types == null)
throw new Exception("No null terminator after type string");
@@ -480,6 +485,5 @@ namespace SharpOSC
}
#endregion
}
}
@@ -33,7 +33,6 @@ namespace SharpOSC
string _address;
TcpClient client;
Thread receivingThread;
byte END = 0xc0;
byte ESC = 0xdb;
@@ -81,7 +80,7 @@ namespace SharpOSC
}
} catch(Exception e)
{
Console.WriteLine(e.ToString());
//Console.WriteLine(e.ToString());
}
return response;
}
@@ -103,10 +102,6 @@ namespace SharpOSC
OnMessageReceived(response);
return response;
}
public void StartReceiving()
{
receivingThread.Start();
}
public void Send(OscPacket packet)
{
@@ -145,7 +140,6 @@ namespace SharpOSC
public void Close()
{
client.GetStream().Close();
receivingThread.Abort();
client.Close();
}
@@ -97,10 +97,10 @@ namespace SharpOSC
}
catch (Exception e)
{
// If there is an error reading the packet, null is sent to the callback
}
OscPacketCallback(packet);
Console.WriteLine(e.ToString());
// If there is an error reading the packet, null is sent to the callback
}
OscPacketCallback(packet);
}
else
{