From 8d6411b25bb93a6ea8917c1e487c2a23ad883106 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Mon, 15 Nov 2021 18:39:12 +0100 Subject: [PATCH] add location message --- Entry.cs | 1 + Events.cs | 1 + LocationEntry.cs | 29 +++++++++++++++++++++++++++++ edjournal.csproj | 1 + 4 files changed, 32 insertions(+) create mode 100644 LocationEntry.cs diff --git a/Entry.cs b/Entry.cs index 81facaf..40b82ae 100644 --- a/Entry.cs +++ b/Entry.cs @@ -19,6 +19,7 @@ namespace EDJournal { { Events.FactionKillBond, typeof(FactionKillBondEntry) }, { Events.FSDJump, typeof(FSDJumpEntry) }, { Events.HullDamage, typeof(HullDamageEntry) }, + { Events.Location, typeof(LocationEntry) }, { Events.MarketSell, typeof(MarketSellEntry) }, { Events.MissionAbandoned, typeof(MissionAbandonedEntry) }, { Events.MissionAccepted, typeof(MissionAcceptedEntry) }, diff --git a/Events.cs b/Events.cs index b9566f7..09cfffb 100644 --- a/Events.cs +++ b/Events.cs @@ -8,6 +8,7 @@ public static readonly string FighterDestroyed = "FighterDestroyed"; public static readonly string FSDJump = "FSDJump"; public static readonly string HullDamage = "HullDamage"; + public static readonly string Location = "Location"; public static readonly string MarketSell = "MarketSell"; public static readonly string MissionAbandoned = "MissionAbandoned"; public static readonly string MissionAccepted = "MissionAccepted"; diff --git a/LocationEntry.cs b/LocationEntry.cs new file mode 100644 index 0000000..81e93c2 --- /dev/null +++ b/LocationEntry.cs @@ -0,0 +1,29 @@ +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; } + + protected override void Initialise() { + StarSystem = JSON.Value("StarSystem") ?? ""; + SystemAddress = JSON.Value("SystemAddress") ?? 0; + Docked = JSON.Value("Docked") ?? false; + StationName = JSON.Value("StationName") ?? ""; + + JObject systemfaction = JSON.Value("SystemFaction"); + if (systemfaction != null) { + SystemFaction = systemfaction.Value("Name") ?? ""; + } + } + } +} diff --git a/edjournal.csproj b/edjournal.csproj index c111d3f..7976723 100644 --- a/edjournal.csproj +++ b/edjournal.csproj @@ -54,6 +54,7 @@ +