2024-04-06 13:46:34 +02:00
|
|
|
using System.Net.Sockets;
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
|
|
|
namespace TanksServer;
|
|
|
|
|
2024-04-06 20:32:54 +02:00
|
|
|
internal class ServicePointDisplay(IOptions<ServicePointDisplayConfiguration> options)
|
2024-04-06 13:46:34 +02:00
|
|
|
{
|
|
|
|
private readonly UdpClient _udpClient = new(options.Value.Hostname, options.Value.Port);
|
|
|
|
|
|
|
|
public ValueTask<int> Send(DisplayPixelBuffer buffer)
|
|
|
|
{
|
|
|
|
return _udpClient.SendAsync(buffer.Data);
|
|
|
|
}
|
|
|
|
}
|
2024-04-06 20:32:54 +02:00
|
|
|
|
|
|
|
internal class ServicePointDisplayConfiguration
|
|
|
|
{
|
|
|
|
public string Hostname { get; set; } = string.Empty;
|
|
|
|
public int Port { get; set; }
|
|
|
|
}
|