Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions TouchSenderInterpreter.ConsoleAppDemo/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net.Sockets;
using System.Text;
using System.Text.Json;

using TouchSenderInterpreter.Models;
Expand Down Expand Up @@ -66,7 +65,6 @@ static async Task ReceiveTouchSenderPayload(CancellationToken cts)
while (true)
{
var receivedResults = await udpClient.ReceiveAsync(cts);
var receivedText = Encoding.UTF8.GetString(receivedResults.Buffer);
touchSenderResult = Interpreter.Read(receivedResults.Buffer);
}
}
Expand Down
4 changes: 2 additions & 2 deletions TouchSenderInterpreter.Test/InterpreterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace TouchSenderInterpreter.Test
internal class TestDataGenerator
{
static readonly int ExampleId = 10;
static readonly Deviceinfo FullDeviceInfo = new(Width: 1920, Height: 1080);
static readonly Singletouch FullSingleTouch = new(X: 0.5, Y: 0.5);
static readonly DeviceInfo FullDeviceInfo = new(Width: 1920, Height: 1080);
static readonly SingleTouch FullSingleTouch = new(X: 0.5, Y: 0.5);
static readonly TouchSenderPayload FullPayload = new(ExampleId, FullDeviceInfo, FullSingleTouch);
public static IEnumerable<object[]> FullPayloads()
{
Expand Down
12 changes: 6 additions & 6 deletions TouchSenderInterpreter/Models/TouchSenderPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
{
public record TouchSenderPayload(
int Id,
Deviceinfo DeviceInfo,
Singletouch SingleTouch
DeviceInfo DeviceInfo,
SingleTouch SingleTouch
)
{
public Singletouch SingleTouchRatio
public SingleTouch SingleTouchRatio
{
get
{
return new Singletouch(
return new SingleTouch(
X: SingleTouch.X / DeviceInfo.Width,
Y: SingleTouch.Y / DeviceInfo.Height
);
}
}
};

public record Deviceinfo(
public record DeviceInfo(
int Width,
int Height
);

public record Singletouch(
public record SingleTouch(
double? X,
double? Y
);
Expand Down
Loading