Class LibraryJson
Reads and writes the file a library is described in (LibraryDescription).
public static class LibraryJson
- Inheritance
-
LibraryJson
- Inherited Members
Remarks
The format is JSON with camel-case names and enumerations as strings: it is read by people in a review as much as by the platform. What is not stated is left out when the file is written, so a description does not grow a line for every default; comments and trailing commas are accepted when it is read, for the file that is edited by hand.
Fields
CurrentFormatVersion
The version of the format this writes. It reads it, and every version before it.
public const int CurrentFormatVersion = 4
Field Value
Remarks
- Version 4 states what
TypeNamesays of an object of a class, when it is not the class's name (TypeName). - Version 3 states the modules a library declares (Modules).
- Version 2 states a dependency as the library it was built against,
{ "name": "DAO", "guid": "{00025E04-...}", "version": "3.5" }, as well as by its name alone ("stdole"). - Version 1 states a dependency by its name alone.
OldestFormatVersion
The oldest version of the format this reads.
public const int OldestFormatVersion = 1
Field Value
Methods
Read(string)
Reads a description.
public static LibraryDescription Read(string json)
Parameters
jsonstringThe text of the file.
Returns
Exceptions
- InvalidDataException
The text is not a description this reads: it is not JSON of the format, has no name, is of a format version this does not know, or states what its format version does not have (a dependency's identity before version 2, modules before version 3, a class's type name before version 4).
Write(LibraryDescription)
Writes a description as the text of its file.
public static string Write(LibraryDescription description)
Parameters
descriptionLibraryDescriptionThe description.