Editor/Layers/ArchKindLegacy.cs

A small editor utility mapping legacy numeric ordinals to architecture kind names. It stores a fixed array of legacy names and exposes Count and a Named(int) method that returns an ArchKind for a valid ordinal or ArchKind.None otherwise.

Reflection
namespace Sunless.Architecture;

// The ordinals ArchLayerKind used to carry, closed forever. Nothing this editor has written is in here - kinds have
// always gone to disk as names - so this reads a plan some other tool numbered by hand and nothing else. A
// contributed kind never gets a number.
public static class ArchKindLegacy
{
	static readonly string[] Ordinals =
	{
		"Building", "Story", "Room", "Walkway", "Wall", "Opening", "Stair", "CarvedStair",
		"Trim", "Pillar", "Porch", "Approach", "Roof", "RoofLight", "Platform", "Downpipe",
		"Fence", "Ladder", "Cut", "Road", "Crossing", "Bridge", "Tunnel",
		// 23 was TunnelService, carved through ArchCut since.
		null,
		"Assembly", "AssetInstance", "WallMod", "Beam", "Balcony", "ExteriorStair", "Pipe", "Bracket"
	};

	public static int Count => Ordinals.Length;

	public static ArchKind Named( int ordinal )
	{
		return ordinal >= 0 && ordinal < Ordinals.Length && Ordinals[ordinal] is { } named
			? new ArchKind( named )
			: ArchKind.None;
	}
}