Initial commit

This commit is contained in:
2026-07-03 16:31:37 +07:00
commit 899c7c637d
1939 changed files with 641750 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using System.Collections.Concurrent;
using RobotNet10.NavigationTune.Interfaces;
namespace RobotNet10.NavigationTune.Services;
/// <summary>
/// Singleton registry mapping testRunId to CancellationTokenSource so Stop/EMC Stop can cancel the running test.
/// </summary>
public class RunningTestCancellationRegistry : IRunningTestCancellationRegistry
{
private readonly ConcurrentDictionary<Guid, CancellationTokenSource> _map = new();
public void Register(Guid testRunId, CancellationTokenSource cts)
{
_map[testRunId] = cts;
}
public bool TryCancel(Guid testRunId)
{
if (_map.TryRemove(testRunId, out var cts))
{
try
{
cts.Cancel();
return true;
}
catch (ObjectDisposedException) { return false; }
}
return false;
}
public void Unregister(Guid testRunId)
{
if (_map.TryRemove(testRunId, out var cts))
{
try { cts.Dispose(); } catch (ObjectDisposedException) { }
}
}
}