RecipeArchive¶
Namespace Nfty.Core.Formats in assembly Nfty.Core.
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?)¶
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 meansParallelism.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
InvalidDataException- The archive, or a manifest or image inside it, is missing or unreadable.UnsupportedSchemaVersionException- A manifest declares a schema this build does not read: newer thanSchema.Current, or older thanSchema.Oldest.
Read(string, Parallelism?)¶
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 meansParallelism.Default. Never changes the bytes.
Returns. The loaded recipe; the caller owns it and must dispose it.
Exceptions
InvalidDataException- The archive, or a manifest or image inside it, is missing or unreadable.UnsupportedSchemaVersionException- A manifest declares a schema this build does not read: newer thanSchema.Current, or older thanSchema.Oldest.
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 meansParallelism.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
InvalidDataException- The archive, or a manifest or image inside it, is missing or unreadable.UnsupportedSchemaVersionException- A manifest declares a schema this build does not read: newer thanSchema.Current, or older thanSchema.Oldest.OperationCanceledException-ctwas canceled.
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 meansParallelism.Default.
Returns. The loaded recipe; the caller owns it.
Exceptions
InvalidDataException- The archive, or a manifest or image inside it, is missing or unreadable.UnsupportedSchemaVersionException- A manifest declares a schema this build does not read: newer thanSchema.Current, or older thanSchema.Oldest.OperationCanceledException-ctwas canceled.
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. ItsPartialAlphais ignored — the written value is recomputed fromingredients' images.ingredients(IReadOnlyList<LoadedIngredient>) - Its ingredients, nested as.igtentries.parallelism(Parallelism?) - How wide image encoding or decoding may run; null meansParallelism.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.igtentries.parallelism(Parallelism?) - How wide image encoding or decoding may run; null meansParallelism.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.igtentries.ct(CancellationToken) - Cancels the write.parallelism(Parallelism?) - How wide image encoding or decoding may run; null meansParallelism.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.igtentries.ct(CancellationToken) - Cancels the write.parallelism(Parallelism?) - How wide image encoding or decoding may run; null meansParallelism.Default. Never changes the bytes.
Returns. A task that completes when it is written.