add location message

This commit is contained in:
Florian Stinglmayr 2021-11-15 18:39:12 +01:00
parent 73f7aca172
commit 8d6411b25b
4 changed files with 32 additions and 0 deletions

View File

@ -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) },

View File

@ -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";

29
LocationEntry.cs Normal file
View File

@ -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<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") ?? "";
}
}
}
}

View File

@ -54,6 +54,7 @@
<Compile Include="JournalException.cs" />
<Compile Include="JournalFile.cs" />
<Compile Include="JournalStream.cs" />
<Compile Include="LocationEntry.cs" />
<Compile Include="MarketSellEntry.cs" />
<Compile Include="MissionAbandonedEntry.cs" />
<Compile Include="MissionAcceptedEntry.cs" />