Archives¶
Namespace Nfty.Core.Formats in assembly Nfty.Core.
Dispatch over the archive types by extension, so callers that accept "any nfty file" (the CLI's inspect, a GUI open dialog) resolve the kind in one place.
Fields¶
CookBookExtension¶
The CookBook archive extension.
IngredientExtension¶
The Ingredient archive extension.
KitchenExtension¶
The Kitchen workspace extension.
MenuExtension¶
The Menu archive extension.
RecipeExtension¶
The Recipe archive extension.
SealedExtension¶
The sealed export extension.
SetExtension¶
The cooked Set archive extension.
Methods¶
KindOf(string)¶
The archive kind for path. An unknown extension is an error rather than a guess — the same rule color specs follow.
Parameters
path(string) - A file path; only its extension is read.
Returns. The kind that extension names.
Exceptions
NotSupportedException- The extension is unknown, or the path has none.
TryKindOf(string, ArchiveKind)¶
The archive kind for path, without throwing when there is not one.
Exists so a caller that must not throw — a System.CommandLine validator, a GUI enabling a menu item — can ask the same question Archives.KindOf() answers, rather than re-implementing the extension table beside it. There is one switch here and two ways in; a second copy of the mapping is how preview came to decide its form with a string compare while dispatching on KindOf, leaving a switch arm no input could reach.
Parameters
path(string) - The path to classify.kind(ArchiveKind) - The kind, when the extension names one.
Returns. True when the extension names one of the kinds.