DotNet.Astronomy.Class.SystemAddress - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

EliteDangerousAlmanac / Astronomy / SystemAddress

Class: SystemAddress

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:50

The 64-bit number the game identifies a system by.

Remarks

The address packs, from the lowest bit up, the size class, then the boxel's place along each axis split into a sector index and an offset inside that sector, and last the system's own number. How wide each field is depends on the size class, which is why every step here reads that first.

A second layout, which some community tools write, carries the same information in a different order. DecodeModulated and EncodeModulated read and write that one.

An address is a ulong throughout, because its fields reach bit 55 and the value routinely passes what a floating-point number holds exactly. A journal event reports the address as a whole number, and a stored address as a decimal string, which TryParse reads.

Fields

SectorInternalSize

const SectorInternalSize: int = 40960

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:53

The edge of one sector in internal units, which is 1280 light years.

UnitsPerLightYear

const UnitsPerLightYear: int = 32

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:56

The internal units in one light year.

Methods

BoxelInternalSize()

static BoxelInternalSize(sizeClass): int

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:69

Reads the edge of a boxel of one size class, in internal units.

Parameters

sizeClass

int

The size class, zero through seven.

Returns

int

The edge in internal units, 320 through 40960.

Remarks

Divide by UnitsPerLightYear for light years.

Exceptions

ArgumentOutOfRangeException

The size class is outside zero through seven.

Decode()

static Decode(id64): DecodedSystemAddress

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:104

Reads the parts one system address holds.

Parameters

id64

ulong

The system address.

Returns

DecodedSystemAddress

The size class, the sector, the boxel code, the sequence and the boxel.

DecodeModulated()

static DecodeModulated(id64): DecodedSystemAddress

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:138

Reads the parts one modulated system address holds.

Parameters

id64

ulong

The modulated system address.

Returns

DecodedSystemAddress

The same parts Decode answers.

Remarks

The modulated layout carries the same system in a different order, and some community tools and data dumps write it. A journal, EDSM, EDDN and Spansh all write the usual layout, which Decode reads.

Encode()

static Encode(parts, origin): ulong

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:172

Writes the parts of a system name and its region origin as a system address.

Parameters

parts

SystemNameParts

The parts of the name, as SystemName.Parse answers.

origin

NamingRegionOrigin

The region's origin, as NamingRegionOrigins.Resolve answers.

Returns

ulong

The system address.

Exceptions

ArgumentNullException

The parts or the origin are absent.

ArgumentOutOfRangeException

The size class, a letter or the first index is outside its range, the origin has a coordinate below zero, the name's boxel or sector falls outside the layout, or the sequence does not fit the field its size class leaves for it.

EncodeModulated()

static EncodeModulated(parts, origin): ulong

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:212

Writes the parts of a system name and its region origin as a modulated address.

Parameters

parts

SystemNameParts

The parts of the name, as SystemName.Parse answers.

origin

NamingRegionOrigin

The region's origin, as NamingRegionOrigins.Resolve answers.

Returns

ulong

The modulated system address.

Remarks

Write the usual layout with Encode unless a tool asks for this one.

Exceptions

ArgumentNullException

The parts or the origin are absent.

ArgumentOutOfRangeException

A field is outside its range, or the sequence does not fit the 15 bits the modulated layout leaves for it.

Parse()

static Parse(address): ulong

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:94

Reads a decimal system address, and refuses text that states none.

Parameters

address

string

The address as digits.

Returns

ulong

The address.

Exceptions

ArgumentNullException

The text is absent.

FormatException

The text is not a decimal number the 64-bit range holds.

ToAbsoluteBoxel()

static ToAbsoluteBoxel(sizeClass, boxelCode, origin): AbsoluteBoxel

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:255

Reads where one boxel code sits, counted from the galaxy corner.

Parameters

sizeClass

int

The size class, zero through seven.

boxelCode

int

The base-26 boxel code, as SystemName.ToBoxelCode answers.

origin

NamingRegionOrigin

The region's origin in internal units.

Returns

AbsoluteBoxel

The boxel's place on the grid of boxels of its size.

Remarks

A boxel code counts from the region's origin taken down to the boxel grid, so this is the inverse of ToBoxelCode. It refuses rather than write a wrong address.

Exceptions

ArgumentNullException

The origin is absent.

ArgumentOutOfRangeException

The size class is outside zero through seven, the origin has a coordinate below zero, or the code or the sector it lands in falls outside the address layout.

ToBoxelCode()

static ToBoxelCode(sizeClass, boxel, origin): int?

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:321

Reads the boxel code one boxel carries inside one region.

Parameters

sizeClass

int

The size class, zero through seven.

boxel

AbsoluteBoxel

The boxel's place, as Decode answers.

origin

NamingRegionOrigin

The region to count from, in internal units.

Returns

int?

The base-26 boxel code inside that region, or null where the boxel lies outside the region or the origin has a coordinate below zero.

Remarks

A region the game names by hand starts somewhere other than its procedural sector, so the same boxel carries a different code under it. This reads that code.

Exceptions

ArgumentNullException

The boxel or the origin are absent.

ArgumentOutOfRangeException

The size class is outside zero through seven.

TryParse()

static TryParse(address, id64): bool

Defined in: dotnet/src/EliteDangerousAlmanac/Astronomy/SystemAddress.cs:79

Reads a decimal system address.

Parameters

address

string?

The address as digits, from stored data or a query string.

id64

out ulong

The address, where the text states one.

Returns

bool

true where the text is a 64-bit decimal address.

⚠️ **GitHub.com Fallback** ⚠️