Class WorkspaceFile
The .rdworkspace of a workspace: the folders of its projects, and the files of its root folder that are in it (RD-VBAL §2.2.2).
public sealed record WorkspaceFile : IEquatable<WorkspaceFile>
- Inheritance
-
WorkspaceFile
- Implements
- Inherited Members
Remarks
A folder is a workspace when it holds a .rdworkspace that can be read, and it is then the workspace's root. Each of its Folders is
directly under the root and holds a project's .rdproj (ProjectFile), as a Visual Basic 6 project group (.vbg) lists its
projects. It is written { "Folders": [ "NavalLib", "NavalConsole" ], "Files": [ "README.md" ] }.
It is read leniently, as a file written by hand needs, and is never refused for what a member holds: a list that is null, or not a list, reads as
empty, and an item that is not a string, or is empty or blank, is left out. The members this model does not know are written back as they were read
(ExtensionData).
Fields
FileName
The name of the file, at the workspace root.
public const string FileName = ".rdworkspace"
Field Value
Properties
ExtensionData
The members of the file this model does not know, as they were read, which are written back.
[JsonExtensionData]
public Dictionary<string, JsonElement>? ExtensionData { get; init; }
Property Value
Files
The files of the workspace root that are in the workspace, by their names, in the order the file lists them, such as a README.md or a license.
[JsonConverter(typeof(WorkspaceNamesJsonConverter))]
public string[] Files { get; init; }
Property Value
- string[]
Folders
The folders of the workspace's projects, by their names, each directly under the workspace root, in the order the file lists them.
[JsonConverter(typeof(WorkspaceNamesJsonConverter))]
public string[] Folders { get; init; }
Property Value
- string[]
Methods
ReadAsync(Stream, CancellationToken)
Reads a .rdworkspace: UTF-8, with or without a byte order mark, its member names matched case-sensitively.
public static Task<WorkspaceFile> ReadAsync(Stream stream, CancellationToken token = default)
Parameters
streamStreamThe file's content.
tokenCancellationTokenCancels the read.
Returns
- Task<WorkspaceFile>
The workspace the file describes.
Exceptions
- JsonException
The file is not JSON, or not a JSON object; the exception says where.
WithFolder(string)
The workspace with folder added last to its folders, unless it already lists it in any letter case.
public WorkspaceFile WithFolder(string folder)
Parameters
folderstringThe name of the folder, directly under the workspace root.
Returns
WithoutFolder(string)
The workspace without folder, listed in any letter case.
public WorkspaceFile WithoutFolder(string folder)
Parameters
folderstringThe name of the folder.