Skip to content

Archives

Namespace Nfty.Core.Formats in assembly Nfty.Core.

public static class Archives

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

public const string CookBookExtension = ".cbk";

The CookBook archive extension.

IngredientExtension

public const string IngredientExtension = ".igt";

The Ingredient archive extension.

KitchenExtension

public const string KitchenExtension = ".ktn";

The Kitchen workspace extension.

MenuExtension

public const string MenuExtension = ".mnu";

The Menu archive extension.

RecipeExtension

public const string RecipeExtension = ".rcp";

The Recipe archive extension.

SealedExtension

public const string SealedExtension = ".tin";

The sealed export extension.

SetExtension

public const string SetExtension = ".set";

The cooked Set archive extension.

Methods

KindOf(string)

public static ArchiveKind KindOf(string path);

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)

public static bool TryKindOf(string path, out ArchiveKind kind);

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.