36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace EDPlayerJournal.Entries;
|
|
public class FSDJumpEntry : Entry {
|
|
protected override void Initialise() {
|
|
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
|
StarSystem = JSON.Value<string>("StarSystem");
|
|
|
|
var pos = JSON.Value<JArray>("SarPos");
|
|
if (pos != null) {
|
|
StarPos = pos.ToObject<long[]>();
|
|
}
|
|
|
|
var faction = JSON.Value<JObject>("SystemFaction");
|
|
if (faction != null) {
|
|
SystemFaction = faction.Value<string>("Name");
|
|
}
|
|
|
|
var factions = JSON.Value<JArray>("Factions");
|
|
if (factions != null) {
|
|
foreach (JObject system_faction in factions) {
|
|
Faction? f = Faction.FromJSON(system_faction);
|
|
if (f != null) {
|
|
SystemFactions.Add(f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public long[]? StarPos { get; set; }
|
|
public string? StarSystem { get; set; }
|
|
public string? SystemFaction { get; set; }
|
|
public ulong SystemAddress { get; set; }
|
|
public List<Faction> SystemFactions { get; set; } = new List<Faction>();
|
|
}
|