Skip to content

KitchenArchive

Namespace Nfty.Core.Formats in assembly Nfty.Core.

public static class KitchenArchive

Reads and writes the .ktn workspace file. Same shape as the other three archives — a ZIP with a manifest.json — even though a Kitchen holds no images. Consistency buys the shared ArchiveIo path, the schema gate, and one more case in Archives.KindOf() rather than one more concept; and a future Kitchen-level asset has somewhere to go.

Methods

Read(ZipArchive)

public static KitchenManifest Read(ZipArchive zip);

Reads the manifest from an already-open archive.

Parameters

  • zip (ZipArchive) - The open archive.

Returns. The manifest.

Exceptions

Read(string)

public static KitchenManifest Read(string path);

Reads a .ktn.

Parameters

  • path (string) - Archive path.

Returns. The manifest.

Exceptions

ReadAsync(string, CancellationToken)

public static Task<KitchenManifest> ReadAsync(string path, CancellationToken cancellationToken = default);

Reads a .ktn.

Parameters

  • path (string) - Archive path.
  • cancellationToken (CancellationToken) - Cancels the read.

Returns. The manifest.

Exceptions

  • InvalidDataException - The archive, or a manifest or image inside it, is missing or unreadable.
  • UnsupportedSchemaVersionException - A manifest declares a schema this build does not read: newer than Schema.Current, or older than Schema.Oldest.
  • OperationCanceledException - cancellationToken was canceled.

Write(ZipArchive, KitchenManifest)

public static void Write(ZipArchive zip, KitchenManifest manifest);

Writes the manifest into an already-open archive.

Parameters

  • zip (ZipArchive) - The open archive.
  • manifest (KitchenManifest) - The workspace's identity.

Write(string, KitchenManifest)

public static void Write(string path, KitchenManifest manifest);

Writes a .ktn.

Parameters

  • path (string) - Destination path.
  • manifest (KitchenManifest) - The workspace's identity.

WriteAsync(string, KitchenManifest, CancellationToken)

public static Task WriteAsync(string path, KitchenManifest manifest, CancellationToken cancellationToken = default);

Writes a .ktn.

Parameters

  • path (string) - Destination path.
  • manifest (KitchenManifest) - The workspace's identity.
  • cancellationToken (CancellationToken) - Cancels the write.

Returns. A task that completes when it is written.