Skip to content

SetReader

Namespace Nfty.Core.Output in assembly Nfty.Core.

public static class SetReader

Opens a cooked Set — a folder, or a packed .set archive.

Methods

IsSetFolder(string)

public static bool IsSetFolder(string path);

Whether path is a directory holding a cooked Set.

Parameters

  • path (string) - The path to test.

Returns. True when it is a folder with a set.json in it.

Remarks

A Set is the one archive kind that is also a FOLDER — generate --out writes one and --pack is optional — so a caller dispatching on the file type has a question Archives.KindOf cannot answer: that method resolves an EXTENSION, and a directory has none. This is outside its domain rather than a second copy of it.

It asks for set.json rather than merely for a directory, so an ordinary folder still falls through to whatever the caller does with a path it does not recognise instead of being guessed at — the same rule the extension table follows.

Read(string, Parallelism?)

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

Reads a Set.

Parameters

  • path (string) - A Set folder, or a .set archive.
  • parallelism (Parallelism?) - How wide the per-asset JSON parsing may run; null means Parallelism.Default. The result never depends on it.

Returns. The manifest and items; the caller owns it and must dispose it.

Exceptions

ReadAsync(string, CancellationToken, Parallelism?)

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

Reads a Set off the calling thread, honoring ct throughout: during the unpack (the archive extracts asynchronously) and between assets while parsing. A canceled or failed read deletes its unpacked copy.

Parameters

  • path (string) - A Set folder, or a .set archive.
  • ct (CancellationToken) - Cancels the read.
  • parallelism (Parallelism?) - How wide the per-asset JSON parsing may run; null means Parallelism.Default. The result never depends on it.

Returns. The manifest and items; the caller owns it and must dispose it.