using Newtonsoft.Json.Linq; namespace EDPlayerJournal.Entries; public class Killer { public string? Name { get; set; } public string? Rank { get; set; } public string? Ship { get; set; } } public class DiedEntry : Entry { private readonly List killers = new List(); public List Killers => killers; public Killer? Killer => killers.Count > 0 ? killers[0] : null; public bool WasWing => killers.Count > 1; protected override void Initialise() { var wing = JSON.Value("Killers"); if (wing != null) { /* a wing killed us */ foreach (JObject child in wing.Children()) { Killer killer = new Killer { Name = child.Value("Name"), Rank = child.Value("Rank"), Ship = child.Value("Ship") }; killers.Add(killer); } } else { /* a single ship killed us */ Killer killer = new Killer { Name = JSON.Value("KillerName"), Rank = JSON.Value("KillerRank"), Ship = JSON.Value("KillerShip") }; killers.Add(killer); } } }