MorkDocument Class

A Mork database: the text format of the summaries of the folders of Thunderbird (.msf) and of its old address books (.mab). It has tables of rows, and cells by column name; the dictionaries, the transactions (groups) and the updates of the file are applied when it is read.

public sealed class MorkDocument

Example

var document = MorkDocument.Load(path);
var table = document.FindTable("ns:msg:db:table:kind:msgs")!;
Assert.Equal("First", table.Rows[0]["subject"]);
Assert.Equal("Café", table.Rows[1]["subject"]);

Constructors

NameDescription
MorkDocument()

MorkDocument()

MorkDocument.cs
public MorkDocument()

No documentation is available.

Properties

NameDescription
RowsGets the rows, in the tables or not, in the order of the file.
TablesGets the tables, in the order of the file.

Gets the rows, in the tables or not, in the order of the file.

public IReadOnlyList<MorkRow> Rows { get; }

Gets the tables, in the order of the file.

public IReadOnlyList<MorkTable> Tables { get; }

Methods

NameDescription
FindTable(string)Returns the first table of a kind.
GetOrAddRow(string, string)Returns a row, and creates it when the database does not have it.
GetOrAddTable(string, string, string?)Returns a table, and creates it when the database does not have it.
Load(Stream)Reads a Mork database from a stream, until its end.
Load(ReadOnlySpan<byte>)Reads a Mork database.
Load(string)Reads a Mork database, such as an .msf file.
Save(Stream)Writes the database: a dictionary of the names of the columns and of the scopes, then the tables and the rows that are in no table.
Save(string)Writes the database in a file.

FindTable(string)

MorkDocument.cs

Returns the first table of a kind.

public MorkTable? FindTable(string kind)

Parameters

kind string
The kind, such as ns:msg:db:table:kind:msgs.

Returns

MorkTable? The table, or null when the database has none of this kind.

GetOrAddRow(string, string)

MorkDocument.cs

Returns a row, and creates it when the database does not have it.

public MorkRow GetOrAddRow(string scope, string id)

Parameters

scope string
The scope of the row.
id string
The identifier of the row in its scope, a hexadecimal number.

Returns

MorkRow The row.

GetOrAddTable(string, string, string?)

MorkDocument.cs

Returns a table, and creates it when the database does not have it.

public MorkTable GetOrAddTable(string scope, string id, string? kind = null)

Parameters

scope string
The scope of the table.
id string
The identifier of the table in its scope, a hexadecimal number.
kind string?
The kind of the table.

Returns

MorkTable The table.

Load overloads

Load(Stream)

MorkDocument.cs

Reads a Mork database from a stream, until its end.

public static MorkDocument Load(Stream stream)
Parameters
stream Stream
The stream.
Returns

MorkDocument The database.

Exceptions
InvalidEmailDataException
The content is not a Mork database.
EmailResourceLimitException
The content is larger than 512 MB.

Load(ReadOnlySpan<byte>)

MorkDocument.cs

Reads a Mork database.

public static MorkDocument Load(ReadOnlySpan<byte> data)
Parameters
data ReadOnlySpan<byte>
The content of the file.
Returns

MorkDocument The database.

Exceptions
InvalidEmailDataException
The content is not a Mork database.

Load(string)

MorkDocument.cs

Reads a Mork database, such as an .msf file.

public static MorkDocument Load(string path)
Parameters
path string
The path of the file.
Returns

MorkDocument The database.

Exceptions
InvalidEmailDataException
The content is not a Mork database.
EmailResourceLimitException
The content is larger than 512 MB.

Save overloads

Save(Stream)

MorkDocument.cs

Writes the database: a dictionary of the names of the columns and of the scopes, then the tables and the rows that are in no table.

public void Save(Stream stream)
Parameters
stream Stream
The stream.

Save(string)

MorkDocument.cs

Writes the database in a file.

public void Save(string path)
Parameters
path string
The path of the file.