mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-11-13 01:11:09 -05:00
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>
33 lines
841 B
C#
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);
|
|
}
|
|
}
|
|
}
|