Skip to content

RecipeArchive

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

public static class RecipeArchive

Reads and writes .rcp archives — a manifest plus one nested .igt per ingredient. The ZipArchive overloads exist so a CookBook can nest one without a file.

Methods

Read(ZipArchive, Parallelism?)

public static LoadedRecipe Read(ZipArchive zip, Parallelism? parallelism = null);

Reads a Recipe from an already-open archive, decoding every variant PNG.

Parameters

  • zip (ZipArchive) - The open archive.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

Returns. The loaded recipe; the caller owns it. Its manifest's PartialAlpha is recomputed from its loaded ingredients rather than trusting the stored value.

Exceptions

Read(string, Parallelism?)

public static LoadedRecipe Read(string path, Parallelism? parallelism = null);

Reads a Recipe from a file, decoding every variant PNG.

Parameters

  • path (string) - Archive path.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

Returns. The loaded recipe; the caller owns it and must dispose it.

Exceptions

ReadAsync(ZipArchive, CancellationToken, Parallelism?)

public static Task<LoadedRecipe> ReadAsync(ZipArchive zip, CancellationToken ct = default, Parallelism? parallelism = null);

Reads a Recipe from an already-open archive.

Parameters

  • zip (ZipArchive) - The open archive.
  • ct (CancellationToken) - Cancels the read; anything already decoded is disposed first.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

Returns. The loaded recipe; the caller owns it. Its manifest's PartialAlpha is recomputed from its loaded ingredients rather than trusting the stored value.

Exceptions

ReadAsync(string, CancellationToken, Parallelism?)

public static Task<LoadedRecipe> ReadAsync(string path, CancellationToken ct = default, Parallelism? parallelism = null);

Reads a Recipe from a file.

Parameters

  • path (string) - Archive path.
  • ct (CancellationToken) - Cancels the read; anything already decoded is disposed first.
  • parallelism (Parallelism?) - How wide decoding may run; null means Parallelism.Default.

Returns. The loaded recipe; the caller owns it.

Exceptions

Write(ZipArchive, RecipeManifest, IReadOnlyList<LoadedIngredient>, Parallelism?)

public static void Write(ZipArchive zip, RecipeManifest manifest, IReadOnlyList<LoadedIngredient> ingredients, Parallelism? parallelism = null);

Writes a Recipe into an already-open archive.

Parameters

  • zip (ZipArchive) - The open archive.
  • manifest (RecipeManifest) - The recipe's manifest. Its PartialAlpha is ignored — the written value is recomputed from ingredients' images.
  • ingredients (IReadOnlyList<LoadedIngredient>) - Its ingredients, nested as .igt entries.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

Write(string, RecipeManifest, IReadOnlyList<LoadedIngredient>, Parallelism?)

public static void Write(string path, RecipeManifest manifest, IReadOnlyList<LoadedIngredient> ingredients, Parallelism? parallelism = null);

Writes a Recipe to a file.

Parameters

  • path (string) - Destination path.
  • manifest (RecipeManifest) - The recipe's manifest.
  • ingredients (IReadOnlyList<LoadedIngredient>) - Its ingredients, nested as .igt entries.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

WriteAsync(ZipArchive, RecipeManifest, IReadOnlyList<LoadedIngredient>, CancellationToken, Parallelism?)

public static Task WriteAsync(ZipArchive zip, RecipeManifest manifest, IReadOnlyList<LoadedIngredient> ingredients, CancellationToken ct = default, Parallelism? parallelism = null);

Writes a Recipe into an already-open archive.

Parameters

  • zip (ZipArchive) - The open archive.
  • manifest (RecipeManifest) - The recipe's manifest.
  • ingredients (IReadOnlyList<LoadedIngredient>) - Its ingredients, nested as .igt entries.
  • ct (CancellationToken) - Cancels the write.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

Returns. A task that completes when it is written.

WriteAsync(string, RecipeManifest, IReadOnlyList<LoadedIngredient>, CancellationToken, Parallelism?)

public static Task WriteAsync(string path, RecipeManifest manifest, IReadOnlyList<LoadedIngredient> ingredients, CancellationToken ct = default, Parallelism? parallelism = null);

Writes a Recipe to a file.

Parameters

  • path (string) - Destination path.
  • manifest (RecipeManifest) - The recipe's manifest.
  • ingredients (IReadOnlyList<LoadedIngredient>) - Its ingredients, nested as .igt entries.
  • ct (CancellationToken) - Cancels the write.
  • parallelism (Parallelism?) - How wide image encoding or decoding may run; null means Parallelism.Default. Never changes the bytes.

Returns. A task that completes when it is written.