Repo-wide sweep with the pinned CSharpier 1.3.0 tool. Whitespace and line-wrapping only; OpenNest.Engine.Tests (109) and OpenNest.IO.Tests pass after reformat, full solution builds 0 errors. Added .csharpierignore so csproj/config XML keeps its existing layout (CSharpier's XML wrapping churns attributes with zero benefit). Formatting is now enforceable: dotnet csharpier check . passes.
34 lines
1013 B
C#
34 lines
1013 B
C#
using System;
|
|
|
|
namespace OpenNest;
|
|
|
|
/// <summary>
|
|
/// Bridges legacy <see cref="IProgress{NestProgress}"/> reporting into job progress while a candidate
|
|
/// trial is being evaluated. Used by both the legacy adapter and the migrated built-in nesters so the
|
|
/// stage/context mapping has one implementation.
|
|
/// </summary>
|
|
internal static class CandidateProgressBridge
|
|
{
|
|
internal static IProgress<NestProgress> Create(
|
|
IProgress<NestJobProgress> progress,
|
|
string stockId
|
|
)
|
|
{
|
|
if (progress == null)
|
|
return null;
|
|
return new LegacyToJob(progress, stockId);
|
|
}
|
|
|
|
private sealed class LegacyToJob(IProgress<NestJobProgress> progress, string stockId)
|
|
: IProgress<NestProgress>
|
|
{
|
|
public void Report(NestProgress value)
|
|
{
|
|
ArgumentNullException.ThrowIfNull(value);
|
|
progress.Report(
|
|
new NestJobProgress(NestJobStage.EvaluatingCandidate, stockId, -1, 0, 0, value)
|
|
);
|
|
}
|
|
}
|
|
}
|