Skip to content

ArchivePeek

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

public static class ArchivePeek

Reads an archive's own manifest without decoding anything inside it.

Remarks

This is what makes a workspace listing possible. KitchenContents deliberately holds paths rather than Loaded* graphs, because CookBookArchive.Read() eagerly decodes every variant PNG in the tree — materialising a whole folder just to name what is in it would pull the entire workspace into memory. But a listing that can only show file names is a poor listing, and everything worth showing is already in the outer manifest: a CookBook's recipeWeights gives its recipe count and its canvas gives its size, with no nested read and no image touched at all.

So: open the zip, read manifest.json, close. Same ReadManifest() every other reader goes through, so the schema gate applies here too and a future-version archive is refused rather than half-understood.

Methods

CookBook(string)

public static CookBookManifest CookBook(string path);

Reads a CookBook's manifest alone.

Parameters

  • path (string) - Path to a .cbk.

Returns. Its manifest.

Exceptions

CookBookTree(string)

public static PeekedCookBook CookBookTree(string path);

Reads a CookBook and every manifest nested inside it — recipes and their ingredients — without decoding a single variant image.

Parameters

  • path (string) - Path to a .cbk.

Returns. The book's manifests, recipes ordinally by id.

Exceptions

  • InvalidDataException - The archive or a manifest inside it is unreadable.
  • UnsupportedSchemaVersionException - It, or something inside it, declares a newer schema than this build reads.

Remarks

The whole argument for this type, applied one level deeper: see PeekedCookBook for what the shape is for and what it deliberately does not carry. Same ReadManifest() gate at every level, so a nested archive declaring a newer schema is refused here exactly as it would be by a full read.

Ingredient(string)

public static IngredientManifest Ingredient(string path);

Reads an Ingredient's manifest alone.

Parameters

  • path (string) - Path to an .igt.

Returns. Its manifest.

Exceptions

Recipe(string)

public static RecipeManifest Recipe(string path);

Reads a Recipe's manifest alone.

Parameters

  • path (string) - Path to a .rcp.

Returns. Its manifest.

Exceptions

RecipeTree(string)

public static PeekedRecipe RecipeTree(string path);

Reads a Recipe and every Ingredient manifest nested inside it, without decoding an image.

Parameters

  • path (string) - Path to a .rcp.

Returns. The recipe's manifests.

Exceptions

  • InvalidDataException - The archive or a manifest inside it is unreadable.
  • UnsupportedSchemaVersionException - It, or something inside it, declares a newer schema than this build reads.

VariantPng(string, string?, string?, string)

public static byte[] VariantPng(string path, string? recipeId, string? ingredientId, string variantId);

One variant's stored PNG bytes, read out of a .igt, a .rcp or a .cbk without opening any other variant: only the nested archives on the way to it are read.

Parameters

  • path (string) - The archive.
  • recipeId (string?) - The recipe holding the ingredient; required for a .cbk, null otherwise.
  • ingredientId (string?) - The ingredient holding the variant; required for a .cbk or .rcp, null for a .igt.
  • variantId (string) - The variant.

Returns. The encoded PNG exactly as stored: a Dynamic or Static variant is its gray value-map.

Exceptions

  • InvalidDataException - The archive, or an entry on the way, is missing or unreadable.