Kitchen¶
Namespace Nfty.Core.Formats in assembly Nfty.Core.
The Kitchen workspace: a .ktn file that names the folder it sits in. Membership is discovered by scanning that folder, never recorded in the manifest. A recorded list goes stale the moment a file is renamed, moved or deleted outside the app, and the Kitchen then describes a workspace that no longer exists. Scanning makes the filesystem the single source of truth and means moving a file in or out needs no reconciliation.
Fields¶
Extension¶
The workspace file extension.
Methods¶
Create(string, KitchenManifest)¶
Creates a Kitchen: writes path and ensures its folder exists. The folder IS the workspace, so a .ktn without one is not a meaningful state.
Parameters
path(string) - Where to write the.ktn; its folder becomes the workspace.manifest(KitchenManifest) - The workspace's identity.
Open(string)¶
Opens a Kitchen and lists what its folder holds. Only the immediate directory is scanned. Recursing would make a Kitchen opened at a high level swallow everything beneath it, and nested Kitchens are explicitly out of scope — a workspace inside a workspace doubles every path rule and buys nothing here.
Parameters
path(string) - Path to the.ktn.
Returns. The manifest plus what the folder holds, as paths.
Exceptions
InvalidDataException- The path has no containing folder, or the Kitchen manifest is unreadable.
OpenAsync(string, CancellationToken)¶
public static Task<KitchenContents> OpenAsync(string path, CancellationToken cancellationToken = default);
Opens a Kitchen and lists what its folder holds.
Parameters
path(string) - Path to the.ktn.cancellationToken(CancellationToken) - Cancels the read.
Returns. The manifest plus what the folder holds, as paths.
Exceptions
InvalidDataException- The path has no containing folder, or the Kitchen manifest is unreadable.
TryFindIn(string)¶
Looks for the .ktn a folder is a workspace for, and says which of the three outcomes it is.
A folder holding more than one .ktn is KitchenLookup.Ambiguous rather than "the first one wins": picking silently would give two Kitchens the same contents and neither would be wrong. That is a state only the user can resolve, so a caller has to be able to tell them about it — which a bare null cannot.
Parameters
directory(string) - The folder to look in.
Returns. The outcome, and the path when — and only when — it is KitchenLookup.Found.