45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
|
using Newtonsoft.Json.Linq;
|
|||
|
|
|||
|
namespace EDPlayerJournal.Entries;
|
|||
|
|
|||
|
public class CarrierJump : Entry {
|
|||
|
public bool Docked { get; set; } = false;
|
|||
|
|
|||
|
public string? StationName { get; set; } = null;
|
|||
|
|
|||
|
public string? StationType { get; set; } = null;
|
|||
|
|
|||
|
public string? StarSystem { get; set; } = null;
|
|||
|
|
|||
|
public ulong SystemAddress { get; set; } = 0;
|
|||
|
|
|||
|
public string? SystemFaction { get; set; } = null;
|
|||
|
|
|||
|
public List<Faction> SystemFactions { get; set; } = new List<Faction>();
|
|||
|
|
|||
|
protected override void Initialise() {
|
|||
|
Docked = JSON.Value<bool?>("Docked") ?? false;
|
|||
|
|
|||
|
StarSystem = JSON.Value<string>("StarSystem");
|
|||
|
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
|||
|
|
|||
|
StationName = JSON.Value<string?>("StationName");
|
|||
|
StationType = JSON.Value<string?>("StationType");
|
|||
|
|
|||
|
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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|