Skip to content

ExportPlan

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

public record ExportPlan

Everything an export will contain, worked out without writing anything.

Remarks

This exists so the sentence a user reads before pressing Export is generated by the code that does the exporting. The alternative — a front-end assembling its own summary from the same checkboxes — is how a screen comes to promise one thing and ship another, and shipping something other than what the screen promised is precisely the defect this whole feature exists to prevent.

Constructors

ExportPlan(IReadOnlyList<ExportEntry>, string, int, string)

public ExportPlan(IReadOnlyList<ExportEntry> Entries, string Collection, int Count, string OutputName);

Parameters

  • Entries (IReadOnlyList<ExportEntry>) - Every file, in the order it will be written.
  • Collection (string) - The collection's name, from set.json.
  • Count (int) - How many assets the Set holds.
  • OutputName (string) - The leaf name the export will be given.

Remarks

This exists so the sentence a user reads before pressing Export is generated by the code that does the exporting. The alternative — a front-end assembling its own summary from the same checkboxes — is how a screen comes to promise one thing and ship another, and shipping something other than what the screen promised is precisely the defect this whole feature exists to prevent.

Fields

SpriteSheetName

public const string SpriteSheetName = "spritesheet.png";

What a stitched sheet is called inside an export.

Properties

Bytes

public long Bytes { get; }

The total size of everything being shipped.

Remarks

A planned ExportPlan.SpriteSheet contributes nothing, because nothing has encoded it yet and a guess would be worse than an omission — ExportPlan.Parts() names it so the reader still knows it is coming.

CarriesCookBook

public bool CarriesCookBook { get; }

Whether the source CookBook is among the entries — the one inclusion with a consequence a user should be warned about rather than merely told.

Collection

public string Collection { get; init; }

The collection's name, from set.json.

Count

public int Count { get; init; }

How many assets the Set holds.

DialogWarnings

public IReadOnlyList<string> DialogWarnings { get; init; }

The same warnings, in the same order, worded for the export dialog: they name its fields ("Image base URI") where ExportPlan.Warnings names the command-line flags.

Remarks

Core owns both wordings so the two front-ends cannot disagree about WHICH warnings apply, only about what to call the control that fixes them. Empty only when ExportPlan.Warnings is.

Entries

public IReadOnlyList<ExportEntry> Entries { get; init; }

Every file, in the order it will be written.

OutputName

public string OutputName { get; init; }

The leaf name the export will be given.

RecordedCookBookSha256

public string? RecordedCookBookSha256 { get; init; }

The source CookBook hash set.json records, or null when it records none.

SetHasModels

public bool SetHasModels { get; init; }

Whether the Set being exported carries models/ at all, whatever this export keeps.

SpriteSheet

public SpriteSheetLayout? SpriteSheet { get; init; }

The sheet this export will stitch, or null when it is not making one.

Remarks

The one part of an export that does not exist yet. Every ExportEntry names a file on disk and carries its real size; a sheet is built BY the export, so at plan time there is a grid and a pixel size and no bytes. It is described here rather than left out of the plan, because the plan is what the screen promises and a sheet that appeared in the output without appearing in the list is exactly the defect this seam exists to prevent. The plan ExportResult carries has it as an ordinary entry, with its real size.

Warnings

public IReadOnlyList<string> Warnings { get; init; }

Things true of this export that its author should hear before uploading it — dangling image links, links still relative — worded here so the terminal and the dialog say the same thing.

Remarks

Warnings, never refusals: each describes an export that is legitimate for SOME destination (a folder of art uploaded separately, say).

Methods

Parts()

public IReadOnlyList<string> Parts();

What is going, one line per part — images/ 500 files, set.json, ChestDemo.cbk.

Returns. The lines, in Ordinal order.

Remarks

Named, not counted, and rendered here rather than in each front-end. "Exported 1,502 files" is exactly the sentence that let a packed Set carry its author's source book without anyone noticing; a reader checks a list of four things and does not check a number. Core renders it for the reason the reports in Stats/ are rendered here — the terminal and the dialog have to say the identical thing, not something similar.

SizeText()

public string SizeText();

The total, for a person: 636 KB, 1.2 MB.

Returns. The size as text, invariant like every other figure this product prints.