style: apply CSharpier formatting to all C# sources

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.
This commit is contained in:
aj
2026-09-20 16:41:50 -04:00
parent 8e6fa677fb
commit aec0523062
476 changed files with 16592 additions and 7800 deletions
+42 -12
View File
@@ -13,35 +13,65 @@ public static class NestJobValidator
foreach (var stock in job.Plates)
{
var edges = stock.EdgeSpacing;
if (!Positive(stock.Size.Width) || !Positive(stock.Size.Length) ||
!Nonnegative(stock.PartSpacing) || !Nonnegative(edges.Left) || !Nonnegative(edges.Right) ||
!Nonnegative(edges.Top) || !Nonnegative(edges.Bottom) || stock.Quadrant < 1 || stock.Quadrant > 4 ||
edges.Left + edges.Right >= stock.Size.Length || edges.Top + edges.Bottom >= stock.Size.Width)
throw new ArgumentException($"Invalid stock dimensions/settings: {stock.Id}.", nameof(job));
if (
!Positive(stock.Size.Width)
|| !Positive(stock.Size.Length)
|| !Nonnegative(stock.PartSpacing)
|| !Nonnegative(edges.Left)
|| !Nonnegative(edges.Right)
|| !Nonnegative(edges.Top)
|| !Nonnegative(edges.Bottom)
|| stock.Quadrant < 1
|| stock.Quadrant > 4
|| edges.Left + edges.Right >= stock.Size.Length
|| edges.Top + edges.Bottom >= stock.Size.Width
)
throw new ArgumentException(
$"Invalid stock dimensions/settings: {stock.Id}.",
nameof(job)
);
}
foreach (var part in job.Parts)
{
if (part.Geometry.Motions.Count == 0 || part.Geometry.Motions.Any(m =>
!double.IsFinite(m.X) || !double.IsFinite(m.Y) ||
!double.IsFinite(m.CenterX) || !double.IsFinite(m.CenterY)))
throw new ArgumentException($"Geometry must contain finite motions: {part.Id}.", nameof(job));
if (
part.Geometry.Motions.Count == 0
|| part.Geometry.Motions.Any(m =>
!double.IsFinite(m.X)
|| !double.IsFinite(m.Y)
|| !double.IsFinite(m.CenterX)
|| !double.IsFinite(m.CenterY)
)
)
throw new ArgumentException(
$"Geometry must contain finite motions: {part.Id}.",
nameof(job)
);
try
{
NestJobPlacementValidator.ValidateGeometry(part.Geometry);
}
catch (ArgumentException exception)
{
throw new ArgumentException($"Geometry must contain usable closed edges: {part.Id}. {exception.Message}", nameof(job), exception);
throw new ArgumentException(
$"Geometry must contain usable closed edges: {part.Id}. {exception.Message}",
nameof(job),
exception
);
}
}
}
internal static void ValidateCandidate(PlateCandidate candidate, NestPlateStock stock,
IReadOnlyDictionary<string, int> remaining, IReadOnlyDictionary<string, NestJobPart> parts)
internal static void ValidateCandidate(
PlateCandidate candidate,
NestPlateStock stock,
IReadOnlyDictionary<string, int> remaining,
IReadOnlyDictionary<string, NestJobPart> parts
)
{
NestJobPlacementValidator.ValidateCandidate(candidate, stock, remaining, parts);
}
private static bool Positive(double value) => double.IsFinite(value) && value > 0;
private static bool Nonnegative(double value) => double.IsFinite(value) && value >= 0;
}