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; } public long[] StarPos { get; set; } public List SystemFactions { get; set; } = new List(); protected override void Initialise() { StarSystem = JSON.Value("StarSystem") ?? ""; SystemAddress = JSON.Value("SystemAddress") ?? 0; Docked = JSON.Value("Docked") ?? false; StationName = JSON.Value("StationName") ?? ""; StarPos = JSON.Value("StarPos").ToObject(); JObject systemfaction = JSON.Value("SystemFaction"); if (systemfaction != null) { SystemFaction = systemfaction.Value("Name") ?? ""; } JArray factions = JSON.Value("Factions"); if (factions != null) { foreach (JObject system_faction in factions) { Faction f = Faction.FromJSON(system_faction); if (f != null) { SystemFactions.Add(f); } } } } } }