Editor/Geometry/ArchProfiles.cs

Utility class for architecture editor profiles. Provides lookup of a named ArchProfile on an ArchKit and computes a fascia depth fallback value.

Reflection
using System;
using System.Linq;

namespace Sunless.Architecture;

// Sections read off the kit by name. Not FindProfile: that falls back to the first profile the kit holds, which
// hangs a gutter off every hip.
public static class ArchProfiles
{
	public static ArchProfile Named( ArchKit kit, string name )
	{
		var profile = kit.Profiles.FirstOrDefault( entry => string.Equals( entry.Name, name, StringComparison.OrdinalIgnoreCase ) );

		return profile is not null && profile.IsUsable ? profile : null;
	}

	public static float FasciaDepth( ArchKit kit ) => Math.Max( 1f, kit.CasingDepth * 2f );
}