Skip to content

SetFiles

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

public sealed record SetFiles

ONE mapping between a set number and the name its files carry: images/, metadata/ and models/. The writer's own names (0001.png) are the default; an export may rename them to token ids and shift the first id, and records that in set.json so every reader finds the same files the exporter wrote.

Remarks

Every reader of a per-asset file asks here - SetReader, the models lookup, the viewer, the exporter itself - because a second copy of "number to file name" is how a renamed export stops opening. nfty/ is the exception by design: it keeps the Set's own names, as nfty's cross-referenced record, and carries the set number inside.

Constructors

SetFiles(string, int)

public SetFiles(string Naming = "padded", int Start = 1);

Parameters

  • Naming (string) - The spelling token: padded (0001) or token-id (1).
  • Start (int) - The token id of the first asset: 1, or 0.

Remarks

Every reader of a per-asset file asks here - SetReader, the models lookup, the viewer, the exporter itself - because a second copy of "number to file name" is how a renamed export stops opening. nfty/ is the exception by design: it keeps the Set's own names, as nfty's cross-referenced record, and carries the set number inside.

Fields

PaddedWord

public const string PaddedWord = "padded";

The token for the writer's own zero-padded names.

TokenIdWord

public const string TokenIdWord = "token-id";

The token for bare token-id names.

Properties

Default

public static SetFiles Default { get; }

The writer's own names, starting at 1: what a Set with no record follows.

IsDefault

public bool IsDefault { get; }

Whether this is exactly the writer's own naming.

IsKnown

public bool IsKnown { get; }

Whether this build knows the spelling; an unknown one is refused rather than guessed.

IsPadded

public bool IsPadded { get; }

Whether names are zero-padded.

Naming

public string Naming { get; init; }

The spelling token: padded (0001) or token-id (1).

Start

public int Start { get; init; }

The token id of the first asset: 1, or 0.

Methods

Id(int)

public int Id(int number);

The token id of the asset with this set number.

Parameters

  • number (int) - The set number, from 1.

Returns. The id.

ImageFile(int)

public string ImageFile(int number);

The asset's picture, relative to images/.

Parameters

  • number (int) - The set number.

Returns. The file name.

MetadataFile(int)

public string MetadataFile(int number);

The asset's metadata file, relative to metadata/: the bare token id when token-id named, so a contract's baseURI + tokenId resolves it.

Parameters

  • number (int) - The set number.

Returns. The file name.

NumberOf(string)

public int? NumberOf(string file);

The set number a per-asset file's name carries, or null for a name the writer would not have given.

Parameters

  • file (string) - A file name or path; the extension is ignored.

Returns. The set number, from 1, or null.

Stem(int)

public string Stem(int number);

The name an asset's files share, without extension.

Parameters

  • number (int) - The set number.

Returns. For example 0001 or 0.