2021-11-15 18:39:12 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
|
|
|
|
|
namespace EDJournal {
|
|
|
|
|
public class LocationEntry : Entry {
|
|
|
|
|
public string StarSystem { get; set; }
|
|
|
|
|
public string SystemFaction { get; set; }
|
|
|
|
|
public string StationName { get; set; }
|
|
|
|
|
public ulong SystemAddress { get; set; }
|
|
|
|
|
public string Body { get; set; }
|
|
|
|
|
public bool Docked { get; set; }
|
|
|
|
|
|
2022-02-12 19:49:11 +01:00
|
|
|
|
public List<Faction> SystemFactions { get; set; } = new List<Faction>();
|
|
|
|
|
|
2021-11-15 18:39:12 +01:00
|
|
|
|
protected override void Initialise() {
|
|
|
|
|
StarSystem = JSON.Value<string>("StarSystem") ?? "";
|
|
|
|
|
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
|
|
|
|
Docked = JSON.Value<bool?>("Docked") ?? false;
|
|
|
|
|
StationName = JSON.Value<string>("StationName") ?? "";
|
|
|
|
|
|
|
|
|
|
JObject systemfaction = JSON.Value<JObject>("SystemFaction");
|
|
|
|
|
if (systemfaction != null) {
|
|
|
|
|
SystemFaction = systemfaction.Value<string>("Name") ?? "";
|
|
|
|
|
}
|
2022-02-12 19:49:11 +01:00
|
|
|
|
|
|
|
|
|
JArray 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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-15 18:39:12 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|