Files
OpenNest/OpenNest.Desktop/PostProcessorMaterials.cs
T
ajandClaude Opus 5.5 bfff2a3546 refactor(desktop): move post processor loading into OpenNest.Desktop
PostProcessorLoader and PostProcessorMaterials move unchanged (namespace
OpenNest kept) into the toolkit-neutral library, so the Avalonia app can
load the posts in Posts/ and register their materials as the WinForms app
does. Each DLL still loads on its own and a failing one is reported in the
result instead of stopping the others; the WinForms MainForm shows the
failures as before.

New tests load a copy of the test assembly as a post plug-in beside a
broken DLL: the broken one is reported, the good one's posts load and its
materials are registered once each, ignoring case and blanks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 22:18:14 -05:00

33 lines
841 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace OpenNest
{
public static class PostProcessorMaterials
{
private static readonly List<string> materials = new();
public static IReadOnlyList<string> Names => materials;
public static void AddFrom(IMaterialProvidingPostProcessor provider)
{
if (provider == null)
return;
foreach (var name in provider.GetMaterialNames())
{
if (
!string.IsNullOrWhiteSpace(name)
&& !materials.Contains(name, StringComparer.OrdinalIgnoreCase)
)
{
materials.Add(name);
}
}
materials.Sort(StringComparer.OrdinalIgnoreCase);
}
}
}