Skip to content

SetExporter

Namespace Nfty.Core.Publish in assembly Nfty.Core.

public static class SetExporter

Publishes a cooked Set: decides what leaves the machine, and in what shape.

Remarks

Why this is not a flag on SetWriter. Writing a Set and publishing one are different operations with different audiences. A cook produces the author's working copy and should hold everything; an export is addressed to somebody — a marketplace, a buyer, a collaborator, a reviewer — and each of those wants a different subset. Folding the second into the first is what produced the defect that motivated this: --pack zipped the output folder rather than the Set, so a cook in a working directory shipped the author's source book inside the archive they handed a buyer.

Sealing is refused as a source. Exporting a .tin is exactly the operation a seal declines, and this is where that policy lives — not in a front-end, which would leave the CLI able to launder a sealed Set back into an open one in a single command.

Methods

Export(string, string, ExportOptions, string?, string?, Parallelism?)

public static ExportResult Export(string setPath, string outDir, ExportOptions options, string? cookBookPath = null, string? passphrase = null, Parallelism? parallelism = null);

Exports a Set.

Parameters

  • setPath (string) - The Set to export: a folder, or a .set archive.
  • outDir (string) - The folder to write into; created if missing.
  • options (ExportOptions) - What to include, and in what shape.
  • cookBookPath (string?) - The .cbk to ship, when ExportOptions.IncludeCookBook is set.
  • passphrase (string?) - Required when ExportOptions.Sealed is set.
  • parallelism (Parallelism?) - How wide the per-asset numbering may run; null means Parallelism.Default. The exported files never depend on it.

Returns. Where it landed, and what went into it.

Exceptions

  • ArgumentException - The options ask for something that cannot be built.
  • SealedSetException - The source is itself sealed, or sealing failed.
  • CorruptSetException - A number watermark was asked for and an asset image could not be read; when several cannot, the lowest-positioned one is named.

ExportAsync(string, string, ExportOptions, string?, string?, IProgress<ExportProgress>?, CancellationToken, Parallelism?)

public static Task<ExportResult> ExportAsync(string setPath, string outDir, ExportOptions options, string? cookBookPath = null, string? passphrase = null, IProgress<ExportProgress>? progress = null, CancellationToken cancellationToken = default, Parallelism? parallelism = null);

Exports a Set, reporting progress and stopping when asked.

Parameters

  • setPath (string) - The Set to export: a folder, or a .set archive.
  • outDir (string) - The folder to write into; created if missing.
  • options (ExportOptions) - What to include, and in what shape.
  • cookBookPath (string?) - The .cbk to ship, when ExportOptions.IncludeCookBook is set.
  • passphrase (string?) - Required when ExportOptions.Sealed is set.
  • progress (IProgress<ExportProgress>?) - One step per asset stitched and per file written.
  • cancellationToken (CancellationToken) - Stops between steps.
  • parallelism (Parallelism?) - How wide the per-asset numbering may run; null means Parallelism.Default. The exported files never depend on it.

Returns. Where it landed, and what went into it.

Exceptions

  • ArgumentException - The options ask for something that cannot be built.
  • SealedSetException - The source is itself sealed, or sealing failed.
  • CorruptSetException - A number watermark was asked for and an asset image could not be read; when several cannot, the lowest-positioned one is named.

Remarks

The async one is the real implementation and the sync twin blocks on it, rather than the other way round: an export is stream work end to end - unpacking a .set, encoding a sheet, copying or zipping every file - so there is genuinely something to await. Blocking is safe because nothing in Core captures a synchronization context.

The sheet is stitched FIRST, so a grid that cannot be built fails before anything has been written to the destination - and so the slowest part of the run is the part the bar spends most of its time on rather than a pause after it reaches the end.

Plan(string, ExportOptions, string?)

public static ExportPlan Plan(string setPath, ExportOptions options, string? cookBookPath = null);

Works out what an export would contain, without writing anything.

Parameters

  • setPath (string) - The Set to export: a folder, or a .set archive.
  • options (ExportOptions) - What to include.
  • cookBookPath (string?) - The .cbk to ship, when ExportOptions.IncludeCookBook is set.

Returns. The plan.

Exceptions

  • ArgumentException - The options ask for something that cannot be built.
  • CorruptSetException - The source is not a readable Set.