Static utility in the Editor namespace that stores and retrieves the user's last used ArchSpanPart (the span dressing). It reads from and writes to an EditorCookie key and ensures a non-null ArchSpanPart is returned by calling Dressing().
using Editor;
namespace Sunless.Architecture;
// The span dressing an author last worked in. Subtools are raised per tool activation, so a seed held only in a
// field is a seed that lasts until the next time anything else is picked - which is every few seconds while a room
// is being filled. Remembered the way the handle mode is: it is a way of working, not a property of one part.
public static class ArchSpanMemo
{
const string Key = "arch.span.dressing";
// Dressed on the way out as well as in: what comes back off disk is a whole part, and an id or a pair of ends
// carried out of a previous session would name piers this plan has never heard of.
public static ArchSpanPart Recall() => (EditorCookie.Get( Key, new ArchSpanPart() ) ?? new ArchSpanPart()).Dressing();
public static void Remember( ArchSpanPart span )
{
if ( span is not null )
{
EditorCookie.Set( Key, span.Dressing() );
}
}
}