Table of Contents

Interface ISavedStateEntries

Namespace
SkyrimForge
Assembly
SkyrimForge.dll

The text and form IDs a plugin stores under keys it chooses.

public interface ISavedStateEntries
Extension Methods

Remarks

IPerPluginSavedState is the whole of one plugin's store, and GetFormEntries(FormId<Form>) gives the part belonging to one form. Both store the same two kinds.

Methods

GetFormId(string)

Reads the form ID stored under key, mapped to this session's load order. Null where nothing is stored, and where the .esm, .esp, or .esl file declaring that form is no longer loaded.

FormId<Form>? GetFormId(string key)

Parameters

key string

Returns

FormId<Form>?

Exceptions

ArgumentNullException

key is null.

GetFormIdKeys()

Returns a copy of the keys that have form IDs, in no order.

IReadOnlyCollection<string> GetFormIdKeys()

Returns

IReadOnlyCollection<string>

GetString(string)

Reads the text stored under key, and null where nothing is stored.

string? GetString(string key)

Parameters

key string

Returns

string

Exceptions

ArgumentNullException

key is null.

GetStringKeys()

Returns a copy of the keys that have text, in no order.

IReadOnlyCollection<string> GetStringKeys()

Returns

IReadOnlyCollection<string>

SetFormId(string, FormId<Form>?)

Stores a form's ID under key, to be written into the next save. Null drops the key.

void SetFormId(string key, FormId<Form>? formId)

Parameters

key string
formId FormId<Form>?

Remarks

A form ID encodes the load-order position of the .esm, .esp, or .esl file declaring it, so the number shifts when the files loaded before that file change. SKSE maps a stored ID through the load order the save recorded. The same number written through SetString(string, string?) skips that mapping and comes to name a different form.

Exceptions

ArgumentNullException

key is null.

SetString(string, string?)

Stores value under key, to be written into the next save. Null drops the key.

void SetString(string key, string? value)

Parameters

key string
value string

Remarks

A FormId<TForm> that System.Text.Json writes into the text, at any depth, is mapped through the load order the save recorded, as SetFormId(string, FormId<Form>?) describes. A form whose .esm, .esp, or .esl file is no longer loaded becomes a JSON null, and a dictionary entry keyed by one is removed. A form ID written as a number is not mapped.

Exceptions

ArgumentNullException

key is null.