From 3aa7fb8cf8b8d5523e01e319394e2f2d75f31ff9 Mon Sep 17 00:00:00 2001 From: ggben Date: Thu, 21 Dec 2023 10:10:48 +0100 Subject: [PATCH 1/2] Update TuioClient.cs to fix session_ids being casted to int Session id's were casted to (int) instead of (long) causing invalid cast exceptions. --- TUIO/TuioClient.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/TUIO/TuioClient.cs b/TUIO/TuioClient.cs index 40d963f..fd7827d 100644 --- a/TUIO/TuioClient.cs +++ b/TUIO/TuioClient.cs @@ -204,7 +204,7 @@ private void processMessage(OSCMessage message) if (command == "set") { - long s_id = (int)args[1]; + long s_id = (long)args[1]; int f_id = (int)args[2]; float xpos = (float)args[3]; float ypos = (float)args[4]; @@ -244,7 +244,7 @@ private void processMessage(OSCMessage message) for (int i = 1; i < args.Count; i++) { // get the message content - long s_id = (int)args[i]; + long s_id = (long)args[i]; newObjectList.Add(s_id); // reduce the object list to the lost objects if (aliveObjectList.Contains(s_id)) @@ -353,7 +353,7 @@ private void processMessage(OSCMessage message) if (command == "set") { - long s_id = (int)args[1]; + long s_id = (long)args[1]; float xpos = (float)args[2]; float ypos = (float)args[3]; float xspeed = (float)args[4]; @@ -390,7 +390,7 @@ private void processMessage(OSCMessage message) for (int i = 1; i < args.Count; i++) { // get the message content - long s_id = (int)args[i]; + long s_id = (long)args[i]; newCursorList.Add(s_id); // reduce the cursor list to the lost cursors if (aliveCursorList.Contains(s_id)) @@ -545,7 +545,7 @@ private void processMessage(OSCMessage message) if (command == "set") { - long s_id = (int)args[1]; + long s_id = (long)args[1]; float xpos = (float)args[2]; float ypos = (float)args[3]; float angle = (float)args[4]; @@ -586,7 +586,7 @@ private void processMessage(OSCMessage message) for (int i = 1; i < args.Count; i++) { // get the message content - long s_id = (int)args[i]; + long s_id = (long)args[i]; newBlobList.Add(s_id); // reduce the blob list to the lost blobs if (aliveBlobList.Contains(s_id)) From fa8a75f2644153743fa0c3b7c40ce2bb298b86f1 Mon Sep 17 00:00:00 2001 From: ggben Date: Fri, 22 Dec 2023 00:02:19 +0100 Subject: [PATCH 2/2] Update TuioClient.cs using Convert.ToInt64() to improve 32 and 64 bit support --- TUIO/TuioClient.cs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/TUIO/TuioClient.cs b/TUIO/TuioClient.cs index fd7827d..b3e55a1 100644 --- a/TUIO/TuioClient.cs +++ b/TUIO/TuioClient.cs @@ -204,7 +204,7 @@ private void processMessage(OSCMessage message) if (command == "set") { - long s_id = (long)args[1]; + long s_id = Convert.ToInt64(args[1]); int f_id = (int)args[2]; float xpos = (float)args[3]; float ypos = (float)args[4]; @@ -244,7 +244,7 @@ private void processMessage(OSCMessage message) for (int i = 1; i < args.Count; i++) { // get the message content - long s_id = (long)args[i]; + long s_id = Convert.ToInt64(args[i]); newObjectList.Add(s_id); // reduce the object list to the lost objects if (aliveObjectList.Contains(s_id)) @@ -256,7 +256,7 @@ private void processMessage(OSCMessage message) { for (int i = 0; i < aliveObjectList.Count; i++) { - long s_id = aliveObjectList[i]; + long s_id = Convert.ToInt64(aliveObjectList[i]); TuioObject removeObject = objectList[s_id]; removeObject.remove(currentTime); frameObjects.Add(removeObject); @@ -352,8 +352,7 @@ private void processMessage(OSCMessage message) if (command == "set") { - - long s_id = (long)args[1]; + long s_id = Convert.ToInt64(args[1]); float xpos = (float)args[2]; float ypos = (float)args[3]; float xspeed = (float)args[4]; @@ -390,7 +389,7 @@ private void processMessage(OSCMessage message) for (int i = 1; i < args.Count; i++) { // get the message content - long s_id = (long)args[i]; + long s_id = Convert.ToInt64(args[i]); newCursorList.Add(s_id); // reduce the cursor list to the lost cursors if (aliveCursorList.Contains(s_id)) @@ -402,7 +401,7 @@ private void processMessage(OSCMessage message) { for (int i = 0; i < aliveCursorList.Count; i++) { - long s_id = aliveCursorList[i]; + long s_id = Convert.ToInt64(aliveCursorList[i]); if (!cursorList.ContainsKey(s_id)) continue; TuioCursor removeCursor = cursorList[s_id]; removeCursor.remove(currentTime); @@ -544,8 +543,7 @@ private void processMessage(OSCMessage message) if (command == "set") { - - long s_id = (long)args[1]; + long s_id = Convert.ToInt64(args[1]); float xpos = (float)args[2]; float ypos = (float)args[3]; float angle = (float)args[4]; @@ -586,7 +584,7 @@ private void processMessage(OSCMessage message) for (int i = 1; i < args.Count; i++) { // get the message content - long s_id = (long)args[i]; + long s_id = Convert.ToInt64(args[i]); newBlobList.Add(s_id); // reduce the blob list to the lost blobs if (aliveBlobList.Contains(s_id)) @@ -598,7 +596,7 @@ private void processMessage(OSCMessage message) { for (int i = 0; i < aliveBlobList.Count; i++) { - long s_id = aliveBlobList[i]; + long s_id = Convert.ToInt64(aliveBlobList[i]); if (!blobList.ContainsKey(s_id)) continue; TuioBlob removeBlob = blobList[s_id]; removeBlob.remove(currentTime);