DotNet.Ships.Class.Slef - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
EliteDangerousAlmanac / Ships / Slef
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:35
The Ship Loadout Export Format: a strict reader, a tolerant inspector and a writer.
SLEF is the community interchange format for a fitted ship, which EDSY, Coriolis, Inara and others all read and write. It is the game journal's Loadout event wrapped in an envelope that records which application exported it:
[{ "header": { "appName": "EDSY", "appVersion": "..." },
"data": { "event": "Loadout", "Ship": "explorer_nx", "Modules": [ ... ] } }]The top level is an array, so several builds travel together. This class carries the record shapes only, so it reads no ship, module or blueprint catalogue.
The specification is Inara's, at https://inara.cz/elite/inara-impexp-slef/.
staticFindModifier(module,label):double?
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:227
Reads one engineering modifier off a fitted module by its journal label.
The fitted module.
string?
The stat's journal name, such as FSDOptimalMass. It is matched with the surrounding whitespace removed and the case folded.
double?
The modifier's numeric value, or null when the module is not engineered, states no modifiers at all, carries no such modifier, or carries one that is not numeric.
ArgumentNullException
module is null.
staticInspect(json):SlefInspection
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:72
Inspects a SLEF payload without losing the entries it cannot read.
string
The export's JSON text.
Every valid entry, and one diagnostic for each entry that was rejected.
ArgumentNullException
json is null.
JsonException
json is not valid JSON.
staticInspect(root):SlefInspection
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:86
Inspects an already-parsed SLEF payload.
JsonElement
The payload. The accepted shapes, in order of leniency, are the standard array of envelopes, a single envelope, and a bare journal Loadout event, which is given an empty header of its own.
Every valid entry, and one diagnostic for each entry that was rejected.
staticParse(json):IReadOnlyList<SlefEntry>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:112
Reads a SLEF payload, refusing the whole export over one bad entry.
string
The export's JSON text.
IReadOnlyList<SlefEntry>
The entries, in export order. It is never empty.
ArgumentNullException
json is null.
JsonException
json is not valid JSON.
FormatException
The payload holds no entry, or an entry, a header, a loadout, a module or an engineering field is malformed. Use Inspect to recover the valid entries of a mixed payload instead.
staticParse(root):IReadOnlyList<SlefEntry>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:120
Reads an already-parsed SLEF payload, refusing it over one bad entry.
JsonElement
The payload, in any of the shapes Inspect takes.
IReadOnlyList<SlefEntry>
The entries, in export order. It is never empty.
FormatException
The payload holds no entry, or one of its fields is malformed.
staticStringify(slef):string
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:188
Writes a SLEF export as compact JSON.
IReadOnlyList<SlefEntry>
The entries, as Wrap answers them.
string
The JSON text, which is what the clipboard exchange these exports travel by wants.
ArgumentNullException
slef is null.
staticStringify(slef,indent):string
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:200
Writes a SLEF export as indented JSON, for a file a person reads.
IReadOnlyList<SlefEntry>
The entries to write.
int
The spaces one indent level costs, from 1 to 127.
string
The JSON text.
ArgumentNullException
slef is null.
ArgumentOutOfRangeException
indent is outside 1 to 127.
staticWrap(data,header):IReadOnlyList<SlefEntry>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:131
Wraps one loadout in a SLEF envelope.
The loadout to export.
Which exporting application to credit. SLEF attribution belongs to the application producing the export, so a caller states its own name and version.
IReadOnlyList<SlefEntry>
The export, holding the one entry.
ArgumentNullException
An argument is null.
FormatException
The header or the loadout is malformed.
staticWrap(data,header):IReadOnlyList<SlefEntry>
Defined in: dotnet/src/EliteDangerousAlmanac/Ships/Slef.cs:150
Wraps several loadouts in one SLEF export.
IReadOnlyList<LoadoutEvent>
The loadouts to export. They travel as separate entries, which is what the format's array top level is for.
Which exporting application to credit.
IReadOnlyList<SlefEntry>
The export, one entry per loadout, in the order given.
Every entry is checked by the walker a read uses, so anything this answers reads back.
ArgumentNullException
An argument is null.
ArgumentException
data is empty. A read rejects an empty export, so writing one would break the promise that everything this produces reads back.
FormatException
The header or one of the loadouts is malformed.