Parser library for data sent from the mobile application Touch Sender.
Example of receiving data from Touch Sender via UDP and parsing its contents to display touch states.
using System.Net;
using System.Net.Sockets;
using TouchSenderInterpreter;
namespace ConsoleApp1;
class Program
{
static void Main(string[] args)
{
int port = 50000;
IPEndPoint? senderEP = null;
// Ctrl + C to quit
using (var udpClient = new UdpClient(port))
{
while (true)
{
var recievedData = udpClient.Receive(ref senderEP);
// parse recieved data of Touch Sender
var result = Interpreter.Read(recievedData);
if (result.IsSuccess)
{
// print SingleTouchRatio
Console.WriteLine(result.Payload?.SingleTouchRatio);
}
else
{
Console.WriteLine("Failed to parse Touch Sender data");
Console.WriteLine(result.ErrorMessage);
}
}
}
}
}If the JSON data is successfully parsed, a result object with the following structure is obtained.
{
"Payload": {
"Id": 538,
"DeviceInfo": {
"Width": 360,
"Height": 800
},
"SingleTouch": {
"X": 248.33333333333334,
"Y": 387
}
},
"IsSuccess": true,
"ErrorMessage": null
}- Create a new release based on
release-drafter. - When the version tag (e.g.,
v1.0.0) is added, the GitHub Actions workflow for the release is triggered. - The workflow builds the package (e.g.,
.nupkgfile) and attaches it to the release.