SetWriter¶
Namespace Nfty.Core.Output in assembly Nfty.Core.
Writes a generated collection to disk: the images, both metadata files per asset, and the Set manifest — and reads an existing Set back so extend can add to it.
Fields¶
GeneratorVersion¶
The engine stamp written into every Set manifest.
TypeTrait¶
The pseudo trait-type under which an asset's Recipe is published, alongside its real ingredient traits. It shares a namespace with ingredient names in both the OpenSea attributes and the rarity table, so an Ingredient actually named "Type" collides with it and double-counts — which shipped as a rarityPct above 100 and a duplicated row.
Public because Validator reserves the name on this constant's authority rather than repeating the literal. Rejecting the book is the fix rather than disambiguating the key, because the two are genuinely indistinguishable once written: on extend, the recipe trait is read back from metadata/NNNN.json as the plain string "Type", with nothing left to tell it apart from an ingredient of that name.
Methods¶
ReadExisting(string, Parallelism?)¶
Reads what an existing Set already holds, for extend.
Parameters
outDir(string) - The Set folder.parallelism(Parallelism?) - How wide the per-file parsing may run; null meansParallelism.Default. The result never depends on it.
Returns. Its DNAs and the next free number. An empty Set yields no DNAs and number 1.
Exceptions
CorruptSetException- An item file is unreadable or missing its fields.
ReadExistingAsync(string, CancellationToken, Parallelism?)¶
public static Task<SetWriter.ExistingSet> ReadExistingAsync(string outDir, CancellationToken cancellationToken = default, Parallelism? parallelism = null);
Reads what an existing Set already holds, for extend.
Parameters
outDir(string) - The Set folder.cancellationToken(CancellationToken) - Cancels the read.parallelism(Parallelism?) - How wide the per-file parsing may run; null meansParallelism.Default.
Returns. Its DNAs and the next free number.
Exceptions
CorruptSetException- An item file is unreadable or missing its fields.
Write(GeneratedSet, string, bool, IAssetModeler?, IProgress<WriteProgress>?, CancellationToken, Parallelism?)¶
public static void Write(GeneratedSet set, string outDir, bool pack, IAssetModeler? models = null, IProgress<WriteProgress>? progress = null, CancellationToken cancellationToken = default, Parallelism? parallelism = null);
Writes a Set.
Parameters
set(GeneratedSet) - The generated collection.outDir(string) - Destination folder; created if missing.pack(bool) - Also zip the folder into a.setarchive inside it, beside the images.models(IAssetModeler?) - Turns each asset into 3D model files undermodels/; null writes none. A Set is modeled whole or not at all, so extending one needs the same options.progress(IProgress<WriteProgress>?) - Receives one report per asset, one at a time, in increasing order.cancellationToken(CancellationToken) - Cancels the write.parallelism(Parallelism?) - How wide to write; null meansParallelism.Default. The files are byte-identical at any degree.
Exceptions
InvalidOperationException- The Set already on disk was modeled differently, or a modeler named a file outsidemodels/.
WriteAsync(GeneratedSet, string, bool, IProgress<WriteProgress>?, CancellationToken, IAssetModeler?, Parallelism?)¶
public static Task WriteAsync(GeneratedSet set, string outDir, bool pack, IProgress<WriteProgress>? progress = null, CancellationToken cancellationToken = default, IAssetModeler? models = null, Parallelism? parallelism = null);
Writes the set with genuinely async I/O, reporting one WriteProgress per asset. Behaves exactly as SetWriter.Write() — same files, same bytes.
Parameters
set(GeneratedSet) - The generated collection.outDir(string) - Destination folder; created if missing.pack(bool) - Also zip the folder into a.setarchive inside it.progress(IProgress<WriteProgress>?) - Receives one report per asset, one at a time, in increasing order.cancellationToken(CancellationToken) - Cancels the write.models(IAssetModeler?) - As forSetWriter.Write(); last so every existing call site is unchanged.parallelism(Parallelism?) - As forSetWriter.Write().