Compare commits

...

3 Commits

7 changed files with 25 additions and 3 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
/bin/Release
/bin/Debug
/packages/Newtonsoft.Json.13.0.1
/.vs/edjournal/v17/.suo

16
CommanderEntry.cs Normal file
View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EDJournal {
public class CommanderEntry : Entry {
public string Name { get; set; }
public string FID { get; set; }
protected override void Initialise() {
Name = JSON.Value<string>("Name") ?? "";
FID = JSON.Value<string>("FID") ?? "";
}
}
}

View File

@ -13,6 +13,7 @@ namespace EDJournal {
public class Entry {
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
{ Events.Bounty, typeof(BountyEntry) },
{ Events.Commander, typeof(CommanderEntry) },
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
{ Events.Died, typeof(DiedEntry) },
{ Events.Docked, typeof(DockedEntry) },

View File

@ -1,6 +1,7 @@
namespace EDJournal {
public class Events {
public static readonly string Bounty = "Bounty";
public static readonly string Commander = "Commander";
public static readonly string CommitCrime = "CommitCrime";
public static readonly string Died = "Died";
public static readonly string Docked = "Docked";

View File

@ -6,6 +6,8 @@ namespace EDJournal {
protected override void Initialise() {
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
StarSystem = JSON.Value<string>("StarSystem");
StarPos = JSON.Value<JArray>("StarPos").ToObject<long[]>();
var faction = JSON.Value<JObject>("SystemFaction");
if (faction != null) {
SystemFaction = faction.Value<string>("Name");
@ -21,12 +23,10 @@ namespace EDJournal {
}
}
}
public long[] StarPos { get; set; }
public string StarSystem { get; set; }
public string SystemFaction { get; set; }
public ulong SystemAddress { get; set; }
public List<Faction> SystemFactions { get; set; } = new List<Faction>();
}
}

View File

@ -13,6 +13,7 @@ namespace EDJournal {
public ulong SystemAddress { get; set; }
public string Body { get; set; }
public bool Docked { get; set; }
public long[] StarPos { get; set; }
public List<Faction> SystemFactions { get; set; } = new List<Faction>();
@ -21,6 +22,7 @@ namespace EDJournal {
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
Docked = JSON.Value<bool?>("Docked") ?? false;
StationName = JSON.Value<string>("StationName") ?? "";
StarPos = JSON.Value<JArray>("StarPos").ToObject<long[]>();
JObject systemfaction = JSON.Value<JObject>("SystemFaction");
if (systemfaction != null) {

View File

@ -42,6 +42,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="BountyEntry.cs" />
<Compile Include="CommanderEntry.cs" />
<Compile Include="CommitCrimeEntry.cs" />
<Compile Include="Credits.cs" />
<Compile Include="CrimeTypes.cs" />