edjournal/SellExplorationDataEntry.cs

33 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.Linq;
namespace EDJournal {
public class SellExplorationDataEntry : Entry {
private List<string> systems = new List<string>();
private List<string> discovered = new List<string>();
public long BaseValue { get; set; }
public long Bonus { get; set; }
public long TotalEarnings { get; set; }
public List<string> Systems => systems;
public List<string> Discovered => discovered;
protected override void Initialise() {
BaseValue = JSON.Value<long?>("BaseValue") ?? 0;
Bonus = JSON.Value<long?>("Bonus") ?? 0;
TotalEarnings = JSON.Value<long?>("TotalEarnings") ?? 0;
var sys = JSON.Value<JArray>("Systems");
if (sys != null) {
systems = sys.Select(x => x.ToString()).ToList<string>();
}
var dis = JSON.Value<JArray>("Discovered");
if (dis != null) {
discovered = dis.Select(x => x.ToString()).ToList<string>();
}
}
}
}