Table of Contents

Class ContentLedgerStore

Namespace
McServerLauncher.Services
Assembly
McServerLauncher.dll

Loads and saves one server's ContentLedger.

public sealed class ContentLedgerStore
Inheritance
ContentLedgerStore
Inherited Members

Remarks

Under %APPDATA%\McServerLauncher\content<serverId>\ledger.json, beside the player history and for the same reason: it is about the app's view of the server, so it neither travels with the world nor fills its backups. Losing it costs nothing worse than dates starting again.

Constructors

ContentLedgerStore(string)

public ContentLedgerStore(string directory)

Parameters

directory string

Properties

Current

The ledger as it is now. Changed in place, then Save()d.

public ContentLedger Current { get; }

Property Value

ContentLedger

Gate

Takes the lock every change to Current has to hold.

public object Gate { get; }

Property Value

object

RootDirectory

Where every server's ledger lives. Settable so tests can point it at a temp folder.

public static string RootDirectory { get; set; }

Property Value

string

Methods

For(string)

The store for a server, shared by everything that asks for it.

public static ContentLedgerStore For(string serverId)

Parameters

serverId string

Returns

ContentLedgerStore

PruneOrphans(IEnumerable<string>)

Deletes the ledgers of servers that are no longer in the app. A removed server's id is never reused — adding it back gives it a new one — so its dates would only pile up for ever.

public static void PruneOrphans(IEnumerable<string> liveServerIds)

Parameters

liveServerIds IEnumerable<string>

Save()

Writes the ledger to disk.

public void Save()