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
loaderIDirectoryToObjectLoaderdirectoryIFileSystemDirectoryThe file system directory (by its IFileSystemDirectory abstraction) to load.
propertyForKeysstringThe name of the JSON object property to write keys to. If null, the keys are not written anywhere.
comparerStringComparerThe comparer to establish the order of items in the array by sorting object keys. If null, defaults to Ordinal.
Returns
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
loaderIDirectoryToObjectLoaderpathstringThe path to the file system directory to load.
propertyForKeysstringThe name of the JSON object property to write keys to. If null, the keys are not written anywhere.
comparerStringComparerThe comparer to establish the order of items in the array by sorting object keys. If null, defaults to Ordinal.
Returns
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
loaderIDirectoryToObjectLoaderpathstringThe path to the file system directory to load.
Returns
- Task<JsonObject>
A task resolving to the JsonObject containing the directory's loaded contents.