more work on gtk & code cleanup

This commit is contained in:
2025-06-16 15:30:56 +02:00
parent 6f7bb5d92c
commit a49a3b2beb
69 changed files with 374 additions and 268 deletions

View File

@@ -1,6 +1,4 @@
using Pilz.Extensions.Collections;
using System.Collections.Specialized;
using System.Web;
namespace Pilz.Net.Api;

View File

@@ -96,7 +96,7 @@ public class ApiServer : IApiServer
var httpListener = new HttpListener();
httpListener.TimeoutManager.IdleConnection = new TimeSpan(0, 2, 0);
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
httpListener.TimeoutManager.RequestQueue = new TimeSpan(0, 2, 0);

View File

@@ -9,7 +9,7 @@ public abstract class BaseChildItemClient<T>(IApiClient client) : BaseClient<T>(
public abstract string ApiEndpointParent { get; }
public abstract string ApiEndpointChild { get; }
public virtual async Task<IEnumerable<T>> GetAll(int parentId)
public virtual async Task<IEnumerable<T>> GetAll(int parentId)
{
return (await client.SendRequest<GeneralItemMessages<T>.Items>($"{ApiEndpointParent}/{parentId}{ApiEndpointChild}", HttpMethod.Get)).EnsureOk().Items;
}

View File

@@ -1,5 +1,4 @@
using Pilz.Data;
using Pilz.Net.Api.Messages;
namespace Pilz.Net.Api.Client;

View File

@@ -1,7 +1,6 @@
using Pilz.Extensions.Reflection;
using Pilz.Net.Api.Messages;
using System.Diagnostics;
using System.Net;
namespace Pilz.Net.Api.Server;
@@ -41,7 +40,7 @@ public class MaintenanceHandler : IApiHandlerInitializer
{
if (MaintenanceEnabled)
{
// ...
}
}

View File

@@ -7,7 +7,7 @@ namespace Pilz.Net;
public abstract class ConnectionManagerBase(int port)
{
private const int HEADER_LENGTH = 12;
private bool listening = false;
private readonly Dictionary<int, Dictionary<int, byte[]>> dicData = [];
@@ -122,13 +122,15 @@ public abstract class ConnectionManagerBase(int port)
finalBuffer.Add((byte)(value >> 16 & 0xFF));
finalBuffer.Add((byte)(value >> 8 & 0xFF));
finalBuffer.Add((byte)(value & 0xFF));
};
}
;
void addHeader(int packageID, int packagesCount)
{
addInteger(dataID); // Data ID
addInteger(packageID); // Package ID
addInteger(packagesCount); // Packages Count
};
}
;
// Send data (this if statement and else content might be useless)
if (data.Length > maxDataSize)

View File

@@ -5,7 +5,7 @@ namespace Pilz.Net;
public class TCPManager(int port) : ConnectionManagerBase(port)
{
private readonly TcpListener listener = new TcpListener(IPAddress.Any, port);
private readonly TcpListener listener = new(IPAddress.Any, port);
public int BufferSize { get; set; } = 10240;
public override void Start()