Table of Contents

Class DirectoryToObjectLoaderExtensions

Namespace
DirectoryToObject
Assembly
DirectoryToObject.dll

Extension methods for interface IDirectoryToObjectLoader.

public static class DirectoryToObjectLoaderExtensions
Inheritance
DirectoryToObjectLoaderExtensions
Inherited Members

Methods

LoadDirectoryIntoJsonArrayAsync(IDirectoryToObjectLoader, IFileSystemDirectory, string?, StringComparer?)

Load a directory specified by its path in the file system into a JsonArray. If the propertyForKeys parameter is specified, the contents of the directory must be directories or files that will load as JsonObject, so that the key of each value is written to the named property. The keys (usually file names) are sorted deterministically before inserting them in the array. By default, the sort uses Ordinal to establish the order. However, this can be overridden by specifying a different comparer in the parameter.

public static Task<JsonArray> LoadDirectoryIntoJsonArrayAsync(this IDirectoryToObjectLoader loader, IFileSystemDirectory directory, string? propertyForKeys = null, StringComparer? comparer = null)

Parameters

loader IDirectoryToObjectLoader
directory IFileSystemDirectory

The file system directory (by its IFileSystemDirectory abstraction) to load.

propertyForKeys string

The name of the JSON object property to write keys to. If null, the keys are not written anywhere.

comparer StringComparer

The comparer to establish the order of items in the array by sorting object keys. If null, defaults to Ordinal.

Returns

Task<JsonArray>

A task resolving to the JsonArray containing the directory's loaded contents.

LoadFileSystemPathIntoJsonArrayAsync(IDirectoryToObjectLoader, string, string?, StringComparer?)

Load a directory specified by its path in the file system into a JsonArray. If the parameter is specified, the contents of the directory must be directories or files that will load as JsonObject, so that the key of each value is written to the named property. The keys (usually file names) are sorted deterministically before inserting them in the array. By default, the sort uses Ordinal to establish the order. However, this can be overridden by specifying a different comparer in the parameter.

public static Task<JsonArray> LoadFileSystemPathIntoJsonArrayAsync(this IDirectoryToObjectLoader loader, string path, string? propertyForKeys = null, StringComparer? comparer = null)

Parameters

loader IDirectoryToObjectLoader
path string

The path to the file system directory to load.

propertyForKeys string

The name of the JSON object property to write keys to. If null, the keys are not written anywhere.

comparer StringComparer

The comparer to establish the order of items in the array by sorting object keys. If null, defaults to Ordinal.

Returns

Task<JsonArray>

A task resolving to the JsonArray containing the directory's loaded contents.

LoadFileSystemPathIntoJsonObjectAsync(IDirectoryToObjectLoader, string)

Load a directory specified by its path in the file system into a JsonObject.

public static Task<JsonObject> LoadFileSystemPathIntoJsonObjectAsync(this IDirectoryToObjectLoader loader, string path)

Parameters

loader IDirectoryToObjectLoader
path string

The path to the file system directory to load.

Returns

Task<JsonObject>

A task resolving to the JsonObject containing the directory's loaded contents.