Compare commits
40 Commits
df6b5bf10d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 84a26ad956 | |||
| f2778df092 | |||
| 1dd78d04b8 | |||
| 8f9e1b1429 | |||
| 3a5d4dd60f | |||
| 2bef2a6c81 | |||
| 9b31077a11 | |||
| 86bd9f76c1 | |||
| 1dd95aff82 | |||
| bace2f1db5 | |||
| fa8fdbceeb | |||
| 9c978a03d5 | |||
| 0ec8689210 | |||
| f367b99fa8 | |||
| 2c848505cb | |||
| bc0d4265d9 | |||
| e8df57b55a | |||
| 6784eba6c6 | |||
| 2813a19186 | |||
| 69f76ba3fb | |||
| 47d3fd778e | |||
| 08e342991c | |||
| 0e691b2116 | |||
| 5b9213cc92 | |||
| be1f0b72e3 | |||
| 47fcbdb071 | |||
| 420d377fa9 | |||
| 41a7782a7c | |||
| 325e9ad1a7 | |||
| b74b35d8c4 | |||
| 7684438ce2 | |||
| 47cb08b799 | |||
| 370cd09866 | |||
| 96dc1a5c2f | |||
| 98d7900fce | |||
| ff41f79dd8 | |||
| 4e14f781d8 | |||
| d82d672df6 | |||
| 6dbc466713 | |||
| 2f07a8f2a9 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,3 +7,4 @@
|
|||||||
/bin/Release
|
/bin/Release
|
||||||
/bin/Debug
|
/bin/Debug
|
||||||
/packages/Newtonsoft.Json.13.0.1
|
/packages/Newtonsoft.Json.13.0.1
|
||||||
|
/.vs/edjournal/v17/.suo
|
||||||
|
|||||||
16
CommanderEntry.cs
Normal file
16
CommanderEntry.cs
Normal 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") ?? "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +1,23 @@
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class CommitCrimeEntry : Entry {
|
public class CommitCrimeEntry : Entry {
|
||||||
private string crimetype = "assault";
|
public string CrimeType { get; set; }
|
||||||
private string faction;
|
public string Faction { get; set; }
|
||||||
private string victim;
|
public string Victim { get; set; }
|
||||||
private int bounty = 0;
|
public string VictimLocalised { get; set; }
|
||||||
|
public long Bounty { get; set; }
|
||||||
public string CrimeType => crimetype;
|
public long Fine { get; set; }
|
||||||
public string Faction => faction;
|
|
||||||
public string Victim => victim;
|
|
||||||
public int Bounty => bounty;
|
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
crimetype = JSON.Value<string>("CrimeType") ?? "assault";
|
CrimeType = JSON.Value<string>("CrimeType") ?? "assault";
|
||||||
faction = JSON.Value<string>("Faction") ?? "";
|
Faction = JSON.Value<string>("Faction") ?? "";
|
||||||
victim = JSON.Value<string>("Victim") ?? "";
|
Victim = JSON.Value<string>("Victim") ?? "";
|
||||||
bounty = JSON.Value<int?>("Bounty") ?? 0;
|
VictimLocalised = JSON.Value<string>("Victim_Localised") ?? "";
|
||||||
|
Bounty = JSON.Value<long?>("Bounty") ?? 0;
|
||||||
|
Fine = JSON.Value<long?>("Fine") ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsMurder {
|
||||||
|
get { return CrimeType?.CompareTo(CrimeTypes.Murder) == 0 || CrimeType?.CompareTo(CrimeTypes.OnFootMurder) == 0; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
14
Credits.cs
14
Credits.cs
@@ -3,13 +3,25 @@
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class Credits {
|
public class Credits {
|
||||||
public static string FormatCredits(int amount) {
|
public static string FormatCredits(int amount) {
|
||||||
|
return FormatCredits((long)amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string FormatCredits(long amount) {
|
||||||
var format = new CultureInfo(CultureInfo.CurrentCulture.Name, true).NumberFormat;
|
var format = new CultureInfo(CultureInfo.CurrentCulture.Name, true).NumberFormat;
|
||||||
format.NumberGroupSeparator = ",";
|
format.NumberGroupSeparator = ",";
|
||||||
|
format.NumberDecimalSeparator = ".";
|
||||||
format.NumberGroupSizes = new int[1] { 3 };
|
format.NumberGroupSizes = new int[1] { 3 };
|
||||||
format.NumberDecimalDigits = 0;
|
format.NumberDecimalDigits = 0;
|
||||||
if (amount > 0 && (amount % 1000000) == 0) {
|
if (amount > 0 && (amount % 1000000000) == 0) {
|
||||||
|
amount /= 1000000000;
|
||||||
|
return string.Format("{0}M CR", amount.ToString("N", format));
|
||||||
|
} else if (amount > 0 && (amount % 1000000) == 0) {
|
||||||
amount /= 1000000;
|
amount /= 1000000;
|
||||||
return string.Format("{0}M CR", amount.ToString("N", format));
|
return string.Format("{0}M CR", amount.ToString("N", format));
|
||||||
|
} else if (amount > 0 && (amount % 100000) == 0) {
|
||||||
|
double am = ((double)amount) / 1000000;
|
||||||
|
format.NumberDecimalDigits = 1;
|
||||||
|
return string.Format("{0}M CR", am.ToString("N", format));
|
||||||
} else if (amount > 0 && (amount % 1000) == 0) {
|
} else if (amount > 0 && (amount % 1000) == 0) {
|
||||||
amount /= 1000;
|
amount /= 1000;
|
||||||
return string.Format("{0}K CR", amount.ToString("N", format));
|
return string.Format("{0}K CR", amount.ToString("N", format));
|
||||||
|
|||||||
11
CrimeTypes.cs
Normal file
11
CrimeTypes.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace EDJournal {
|
||||||
|
public class CrimeTypes {
|
||||||
|
public static readonly string Assault = "assault";
|
||||||
|
public static readonly string Murder = "murder";
|
||||||
|
public static readonly string OnFootArcCutterUse = "onFoot_arcCutterUse";
|
||||||
|
public static readonly string OnFootDataTransfer = "onFoot_dataTransfer";
|
||||||
|
public static readonly string OnFootIdentityTheft = "onFoot_identityTheft";
|
||||||
|
public static readonly string OnFootMurder = "onFoot_murder";
|
||||||
|
public static readonly string Piracy = "piracy";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,11 +4,13 @@ namespace EDJournal {
|
|||||||
public class DockedEntry : Entry {
|
public class DockedEntry : Entry {
|
||||||
public string StationName { get; set; }
|
public string StationName { get; set; }
|
||||||
public string StarSystem { get; set; }
|
public string StarSystem { get; set; }
|
||||||
|
public ulong SystemAddress { get; set; }
|
||||||
public string StationFaction { get; set; }
|
public string StationFaction { get; set; }
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
StationName = JSON.Value<string>("StationName") ?? "";
|
StationName = JSON.Value<string>("StationName") ?? "";
|
||||||
StarSystem = JSON.Value<string>("StarSystem") ?? "";
|
StarSystem = JSON.Value<string>("StarSystem") ?? "";
|
||||||
|
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
||||||
JObject faction = JSON.Value<JObject>("StationFaction");
|
JObject faction = JSON.Value<JObject>("StationFaction");
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
StationFaction = faction.Value<string>("Name") ?? "";
|
StationFaction = faction.Value<string>("Name") ?? "";
|
||||||
|
|||||||
5
Entry.cs
5
Entry.cs
@@ -13,12 +13,14 @@ namespace EDJournal {
|
|||||||
public class Entry {
|
public class Entry {
|
||||||
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
|
private static readonly Dictionary<string, Type> classes = new Dictionary<string, Type> {
|
||||||
{ Events.Bounty, typeof(BountyEntry) },
|
{ Events.Bounty, typeof(BountyEntry) },
|
||||||
|
{ Events.Commander, typeof(CommanderEntry) },
|
||||||
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
|
{ Events.CommitCrime, typeof(CommitCrimeEntry) },
|
||||||
{ Events.Died, typeof(DiedEntry) },
|
{ Events.Died, typeof(DiedEntry) },
|
||||||
{ Events.Docked, typeof(DockedEntry) },
|
{ Events.Docked, typeof(DockedEntry) },
|
||||||
{ Events.FactionKillBond, typeof(FactionKillBondEntry) },
|
{ Events.FactionKillBond, typeof(FactionKillBondEntry) },
|
||||||
{ Events.FSDJump, typeof(FSDJumpEntry) },
|
{ Events.FSDJump, typeof(FSDJumpEntry) },
|
||||||
{ Events.HullDamage, typeof(HullDamageEntry) },
|
{ Events.HullDamage, typeof(HullDamageEntry) },
|
||||||
|
{ Events.LoadGame, typeof(LoadGameEntry) },
|
||||||
{ Events.Location, typeof(LocationEntry) },
|
{ Events.Location, typeof(LocationEntry) },
|
||||||
{ Events.MarketBuy, typeof(MarketBuyEntry) },
|
{ Events.MarketBuy, typeof(MarketBuyEntry) },
|
||||||
{ Events.MarketSell, typeof(MarketSellEntry) },
|
{ Events.MarketSell, typeof(MarketSellEntry) },
|
||||||
@@ -29,7 +31,10 @@ namespace EDJournal {
|
|||||||
{ Events.MissionRedirected, typeof(MissionRedirectedEntry) },
|
{ Events.MissionRedirected, typeof(MissionRedirectedEntry) },
|
||||||
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
|
{ Events.MultiSellExplorationData, typeof(MultiSellExplorationDataEntry) },
|
||||||
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
|
{ Events.RedeemVoucher, typeof(RedeemVoucherEntry) },
|
||||||
|
{ Events.SearchAndRescue, typeof(SearchAndRescueEntry) },
|
||||||
|
{ Events.SellExplorationData, typeof(SellExplorationDataEntry) },
|
||||||
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
|
{ Events.SellMicroResources, typeof(SellMicroResourcesEntry) },
|
||||||
|
{ Events.SellOrganicData, typeof(SellOrganicDataEntry) },
|
||||||
{ Events.ShieldState, typeof(ShieldStateEntry) },
|
{ Events.ShieldState, typeof(ShieldStateEntry) },
|
||||||
{ Events.ShipTargeted, typeof(ShipTargetedEntry) },
|
{ Events.ShipTargeted, typeof(ShipTargetedEntry) },
|
||||||
{ Events.UnderAttack, typeof(UnderAttackEntry) },
|
{ Events.UnderAttack, typeof(UnderAttackEntry) },
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class Events {
|
public class Events {
|
||||||
public static readonly string Bounty = "Bounty";
|
public static readonly string Bounty = "Bounty";
|
||||||
|
public static readonly string Commander = "Commander";
|
||||||
public static readonly string CommitCrime = "CommitCrime";
|
public static readonly string CommitCrime = "CommitCrime";
|
||||||
public static readonly string Died = "Died";
|
public static readonly string Died = "Died";
|
||||||
public static readonly string Docked = "Docked";
|
public static readonly string Docked = "Docked";
|
||||||
@@ -8,6 +9,7 @@
|
|||||||
public static readonly string FighterDestroyed = "FighterDestroyed";
|
public static readonly string FighterDestroyed = "FighterDestroyed";
|
||||||
public static readonly string FSDJump = "FSDJump";
|
public static readonly string FSDJump = "FSDJump";
|
||||||
public static readonly string HullDamage = "HullDamage";
|
public static readonly string HullDamage = "HullDamage";
|
||||||
|
public static readonly string LoadGame = "LoadGame";
|
||||||
public static readonly string Location = "Location";
|
public static readonly string Location = "Location";
|
||||||
public static readonly string MarketBuy = "MarketBuy";
|
public static readonly string MarketBuy = "MarketBuy";
|
||||||
public static readonly string MarketSell = "MarketSell";
|
public static readonly string MarketSell = "MarketSell";
|
||||||
@@ -18,7 +20,10 @@
|
|||||||
public static readonly string MissionRedirected = "MissionRedirected";
|
public static readonly string MissionRedirected = "MissionRedirected";
|
||||||
public static readonly string MultiSellExplorationData = "MultiSellExplorationData";
|
public static readonly string MultiSellExplorationData = "MultiSellExplorationData";
|
||||||
public static readonly string RedeemVoucher = "RedeemVoucher";
|
public static readonly string RedeemVoucher = "RedeemVoucher";
|
||||||
|
public static readonly string SearchAndRescue = "SearchAndRescue";
|
||||||
|
public static readonly string SellExplorationData = "SellExplorationData";
|
||||||
public static readonly string SellMicroResources = "SellMicroResources";
|
public static readonly string SellMicroResources = "SellMicroResources";
|
||||||
|
public static readonly string SellOrganicData = "SellOrganicData";
|
||||||
public static readonly string ShieldState = "ShieldState";
|
public static readonly string ShieldState = "ShieldState";
|
||||||
public static readonly string ShipTargeted = "ShipTargeted";
|
public static readonly string ShipTargeted = "ShipTargeted";
|
||||||
public static readonly string UnderAttack = "UnderAttack";
|
public static readonly string UnderAttack = "UnderAttack";
|
||||||
|
|||||||
@@ -1,18 +1,32 @@
|
|||||||
using Newtonsoft.Json.Linq;
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class FSDJumpEntry : Entry {
|
public class FSDJumpEntry : Entry {
|
||||||
private string starsystem = null;
|
|
||||||
private string systemfaction = null;
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
starsystem = JSON.Value<string>("StarSystem");
|
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
||||||
|
StarSystem = JSON.Value<string>("StarSystem");
|
||||||
|
StarPos = JSON.Value<JArray>("StarPos").ToObject<long[]>();
|
||||||
|
|
||||||
var faction = JSON.Value<JObject>("SystemFaction");
|
var faction = JSON.Value<JObject>("SystemFaction");
|
||||||
if (faction != null) {
|
if (faction != null) {
|
||||||
systemfaction = faction.Value<string>("Name");
|
SystemFaction = faction.Value<string>("Name");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
public string StarSystem => starsystem;
|
|
||||||
|
|
||||||
public string SystemFaction => systemfaction;
|
JArray factions = JSON.Value<JArray>("Factions");
|
||||||
|
if (factions != null) {
|
||||||
|
foreach (JObject system_faction in factions) {
|
||||||
|
Faction f = Faction.FromJSON(system_faction);
|
||||||
|
if (f != null) {
|
||||||
|
SystemFactions.Add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
102
Faction.cs
Normal file
102
Faction.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace EDJournal {
|
||||||
|
public class FactionState {
|
||||||
|
public string State { get; set; }
|
||||||
|
public long Trend { get; set; }
|
||||||
|
|
||||||
|
public static FactionState FromJSON(JObject j) {
|
||||||
|
if (j == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
FactionState s = new FactionState() {
|
||||||
|
State = j.Value<string>("State") ?? "",
|
||||||
|
Trend = j.Value<long?>("Trend") ?? 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(s.State)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Faction {
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string FactionState { get; set; }
|
||||||
|
public string Government { get; set; }
|
||||||
|
public double Influence { get; set; }
|
||||||
|
public string Allegiance { get; set; }
|
||||||
|
public string Happiness { get; set; }
|
||||||
|
public string HappinessLocalised { get; set; }
|
||||||
|
public double MyReputation { get; set; }
|
||||||
|
public bool SquadronFaction { get; set; } = false;
|
||||||
|
public bool HomeSystem { get; set; } = false;
|
||||||
|
|
||||||
|
public List<FactionState> RecoveringStates { get; set; } = new List<FactionState>();
|
||||||
|
public List<FactionState> ActiveStates { get; set; } = new List<FactionState>();
|
||||||
|
public List<FactionState> PendingStates { get; set; } = new List<FactionState>();
|
||||||
|
|
||||||
|
public static Faction FromJSON(JObject j) {
|
||||||
|
if (j == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Faction f = new Faction() {
|
||||||
|
Name = j.Value<string>("Name") ?? "",
|
||||||
|
FactionState = j.Value<string>("FactionState") ?? "",
|
||||||
|
Government = j.Value<string>("Government") ?? "",
|
||||||
|
Influence = j.Value<double?>("Influence") ?? 1.0,
|
||||||
|
Allegiance = j.Value<string>("Allegiance") ?? "",
|
||||||
|
Happiness = j.Value<string>("Happiness") ?? "",
|
||||||
|
HappinessLocalised = j.Value<string>("Happiness_Localised") ?? "",
|
||||||
|
MyReputation = j.Value<double?>("MyReputation") ?? 1.0,
|
||||||
|
SquadronFaction = j.Value<bool?>("SquadronFaction") ?? false,
|
||||||
|
HomeSystem = j.Value<bool?>("HomeSystem") ?? false,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(f.Name)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
JArray recovering_states = j.Value<JArray>("RecoveringStates");
|
||||||
|
if (recovering_states != null) {
|
||||||
|
foreach (JObject s in recovering_states) {
|
||||||
|
FactionState state = EDJournal.FactionState.FromJSON(s);
|
||||||
|
if (state != null) {
|
||||||
|
f.RecoveringStates.Add(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JArray active_states = j.Value<JArray>("ActiveStates");
|
||||||
|
if (active_states != null) {
|
||||||
|
foreach (JObject s in active_states) {
|
||||||
|
FactionState state = EDJournal.FactionState.FromJSON(s);
|
||||||
|
if (state != null) {
|
||||||
|
f.ActiveStates.Add(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JArray pending_states = j.Value<JArray>("PendingStates");
|
||||||
|
if (pending_states != null) {
|
||||||
|
foreach (JObject s in pending_states) {
|
||||||
|
FactionState state = EDJournal.FactionState.FromJSON(s);
|
||||||
|
if (state != null) {
|
||||||
|
f.PendingStates.Add(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,24 +8,31 @@ using System.Globalization;
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class JournalFile : IComparable<JournalFile>
|
public class JournalFile : IComparable<JournalFile>
|
||||||
{
|
{
|
||||||
private string fullpath = null;
|
public string FullPath { get; set; }
|
||||||
private string part = null;
|
public int Part { get; set; }
|
||||||
private int intpart = 0;
|
public DateTime DateTime { get; set; }
|
||||||
private DateTime datetime;
|
public DateTime NormalisedDateTime { get; set; }
|
||||||
private DateTime normalised;
|
|
||||||
private List<Entry> entries = new List<Entry>();
|
public List<Entry> entries = new List<Entry>();
|
||||||
|
|
||||||
private static Regex fileregex = new Regex("Journal\\.(\\d+)\\.(\\d+)\\.log");
|
private static Regex fileregex = new Regex("Journal\\.(\\d+)\\.(\\d+)\\.log");
|
||||||
|
private static Regex update11regex = new Regex("Journal\\.([^\\.]+)\\.(\\d+).log");
|
||||||
private static string iso8601 = "yyyyMMddTHHmmss";
|
private static string iso8601 = "yyyyMMddTHHmmss";
|
||||||
private static string iso8601_notime = "yyyyMMdd";
|
|
||||||
|
|
||||||
public string FullPath => fullpath;
|
|
||||||
|
|
||||||
public static bool VerifyFile(string path) {
|
public static bool VerifyFile(string path) {
|
||||||
string filename = Path.GetFileName(path);
|
string filename = Path.GetFileName(path);
|
||||||
|
|
||||||
var matches = fileregex.Matches(filename);
|
var matches = fileregex.Matches(filename);
|
||||||
return matches.Count != 0;
|
if (matches.Count != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
matches = update11regex.Matches(filename);
|
||||||
|
if (matches.Count != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFilename(string path) {
|
private void SetFilename(string path) {
|
||||||
@@ -35,32 +42,50 @@ namespace EDJournal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var matches = fileregex.Matches(filename);
|
var matches = fileregex.Matches(filename);
|
||||||
if (matches.Count < 1) {
|
if (matches.Count == 0) {
|
||||||
throw new JournalException(string.Format("Invalid journal file: {0}", filename));
|
matches = update11regex.Matches(filename);
|
||||||
|
if (matches.Count == 0) {
|
||||||
|
throw new JournalException(string.Format("invalid file format: {0}", filename));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fullpath = path;
|
FullPath = path;
|
||||||
this.part = matches[0].Groups[2].ToString();
|
var groups = matches[0].Groups;
|
||||||
this.intpart = int.Parse(part);
|
string part = groups[2].ToString();
|
||||||
|
string timestamp = groups[1].ToString();
|
||||||
|
|
||||||
|
if (!timestamp.Contains("T")) {
|
||||||
|
/* pre update 11 file
|
||||||
|
*/
|
||||||
|
|
||||||
// The ISO is not quite correct on journal filenames, so build
|
// The ISO is not quite correct on journal filenames, so build
|
||||||
// a proper ISO 8601 date time stamp out of it.
|
// a proper ISO 8601 date time stamp out of it.
|
||||||
var date = new StringBuilder();
|
var date = new StringBuilder();
|
||||||
date.Append("20"); // Add the missing century in front.
|
date.Append("20"); // Add the missing century in front.
|
||||||
date.Append(matches[0].Groups[1].ToString());
|
date.Append(timestamp);
|
||||||
date.Insert(8, "T"); // Add the "T" separating date and time
|
date.Insert(8, "T"); // Add the "T" separating date and time
|
||||||
this.datetime = DateTime.ParseExact(date.ToString(), iso8601, CultureInfo.InvariantCulture);
|
|
||||||
this.normalised = DateTime.Parse(this.datetime.ToShortDateString());
|
timestamp = date.ToString();
|
||||||
|
} else {
|
||||||
|
/* post update 11 file, remove dashes
|
||||||
|
*/
|
||||||
|
timestamp = timestamp.Replace("-", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.DateTime = DateTime.ParseExact(timestamp, iso8601, CultureInfo.InvariantCulture);
|
||||||
|
this.Part = int.Parse(part);
|
||||||
|
this.NormalisedDateTime = DateTime.Parse(DateTime.ToShortDateString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int CompareTo(JournalFile other) {
|
public int CompareTo(JournalFile other) {
|
||||||
if (datetime == null || other.datetime == null) {
|
if (DateTime == null || other.DateTime == null) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
var comp = DateTime.Compare(datetime, other.datetime);
|
var comp = DateTime.Compare(DateTime, other.DateTime);
|
||||||
if (comp == 0) {
|
if (comp == 0) {
|
||||||
/* If we have the exact same datetime we compare by parts.
|
/* If we have the exact same datetime we compare by parts.
|
||||||
*/
|
*/
|
||||||
return intpart - other.intpart;
|
return Part - other.Part;
|
||||||
} else {
|
} else {
|
||||||
return comp;
|
return comp;
|
||||||
}
|
}
|
||||||
@@ -70,18 +95,6 @@ namespace EDJournal {
|
|||||||
SetFilename(path);
|
SetFilename(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime Timestamp {
|
|
||||||
get { return datetime; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime NormalisedTimestamp {
|
|
||||||
get { return normalised; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public int Part {
|
|
||||||
get { return intpart; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<Entry> Entries {
|
public IEnumerable<Entry> Entries {
|
||||||
get {
|
get {
|
||||||
if (entries == null || entries.Count == 0) {
|
if (entries == null || entries.Count == 0) {
|
||||||
@@ -101,7 +114,7 @@ namespace EDJournal {
|
|||||||
/* This needs to be done this way, otherwise, if the game is still running the journal files cannot
|
/* This needs to be done this way, otherwise, if the game is still running the journal files cannot
|
||||||
* be accessed. And it is very much convenient to generate logs while the game is still running.
|
* be accessed. And it is very much convenient to generate logs while the game is still running.
|
||||||
*/
|
*/
|
||||||
using (var fs = new FileStream(this.fullpath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
|
using (var fs = new FileStream(FullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) {
|
||||||
using (var sr = new StreamReader(fs, Encoding.UTF8)) {
|
using (var sr = new StreamReader(fs, Encoding.UTF8)) {
|
||||||
string line = null;
|
string line = null;
|
||||||
while ((line = sr.ReadLine()) != null) {
|
while ((line = sr.ReadLine()) != null) {
|
||||||
@@ -112,6 +125,10 @@ namespace EDJournal {
|
|||||||
|
|
||||||
entries.Clear();
|
entries.Clear();
|
||||||
foreach(var line in lines) {
|
foreach(var line in lines) {
|
||||||
|
// Skip empty lines
|
||||||
|
if (line.Trim().Length == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Entry entry = Entry.Parse(line);
|
Entry entry = Entry.Parse(line);
|
||||||
entries.Add(entry);
|
entries.Add(entry);
|
||||||
}
|
}
|
||||||
|
|||||||
52
LoadGameEntry.cs
Normal file
52
LoadGameEntry.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace EDJournal {
|
||||||
|
public class LoadGameEntry : Entry {
|
||||||
|
public string Commander { get; set; }
|
||||||
|
public string FID { get; set; }
|
||||||
|
public bool Horizons { get; set; }
|
||||||
|
public bool Odyssey { get; set; }
|
||||||
|
public string Ship { get; set; }
|
||||||
|
public long ShipID { get; set; }
|
||||||
|
public bool StartLanded { get; set; }
|
||||||
|
public bool StartDead { get; set; }
|
||||||
|
public string GameMode { get; set; }
|
||||||
|
public string Group { get; set; }
|
||||||
|
public long Credits { get; set; }
|
||||||
|
public long Loan { get; set; }
|
||||||
|
public string ShipName { get; set; }
|
||||||
|
public string ShipIdent { get; set; }
|
||||||
|
public double FuelLevel { get; set; }
|
||||||
|
public double FuelCapacity { get; set; }
|
||||||
|
|
||||||
|
protected override void Initialise() {
|
||||||
|
Commander = JSON.Value<string>("Commander") ?? "";
|
||||||
|
FID = JSON.Value<string>("FID") ?? "";
|
||||||
|
// Game
|
||||||
|
Horizons = JSON.Value<bool?>("Horizons") ?? false;
|
||||||
|
Odyssey = JSON.Value<bool?>("Odyssey") ?? false;
|
||||||
|
// Ships
|
||||||
|
Ship = JSON.Value<string>("Ship") ?? "";
|
||||||
|
ShipID = JSON.Value<long?>("ShipID") ?? 0;
|
||||||
|
ShipName = JSON.Value<string>("ShipName") ?? "";
|
||||||
|
ShipIdent = JSON.Value<string>("ShipIdent") ?? "";
|
||||||
|
// Fuel
|
||||||
|
FuelLevel = JSON.Value<double?>("FuelLevel") ?? 0.0;
|
||||||
|
FuelCapacity = JSON.Value<double?>("FuelCapacity") ?? 0.0;
|
||||||
|
// Landed/Dead
|
||||||
|
StartLanded = JSON.Value<bool?>("StartLanded") ?? false;
|
||||||
|
StartDead = JSON.Value<bool?>("StartDead") ?? false;
|
||||||
|
// GameMode
|
||||||
|
GameMode = JSON.Value<string>("GameMode") ?? "";
|
||||||
|
// Group
|
||||||
|
Group = JSON.Value<string>("Group") ?? "";
|
||||||
|
// Wealth
|
||||||
|
Credits = JSON.Value<long?>("Credits") ?? 0;
|
||||||
|
Loan = JSON.Value<long?>("Loan") ?? 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,17 +13,31 @@ namespace EDJournal {
|
|||||||
public ulong SystemAddress { get; set; }
|
public ulong SystemAddress { get; set; }
|
||||||
public string Body { get; set; }
|
public string Body { get; set; }
|
||||||
public bool Docked { get; set; }
|
public bool Docked { get; set; }
|
||||||
|
public long[] StarPos { get; set; }
|
||||||
|
|
||||||
|
public List<Faction> SystemFactions { get; set; } = new List<Faction>();
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
StarSystem = JSON.Value<string>("StarSystem") ?? "";
|
StarSystem = JSON.Value<string>("StarSystem") ?? "";
|
||||||
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
SystemAddress = JSON.Value<ulong?>("SystemAddress") ?? 0;
|
||||||
Docked = JSON.Value<bool?>("Docked") ?? false;
|
Docked = JSON.Value<bool?>("Docked") ?? false;
|
||||||
StationName = JSON.Value<string>("StationName") ?? "";
|
StationName = JSON.Value<string>("StationName") ?? "";
|
||||||
|
StarPos = JSON.Value<JArray>("StarPos").ToObject<long[]>();
|
||||||
|
|
||||||
JObject systemfaction = JSON.Value<JObject>("SystemFaction");
|
JObject systemfaction = JSON.Value<JObject>("SystemFaction");
|
||||||
if (systemfaction != null) {
|
if (systemfaction != null) {
|
||||||
SystemFaction = systemfaction.Value<string>("Name") ?? "";
|
SystemFaction = systemfaction.Value<string>("Name") ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JArray factions = JSON.Value<JArray>("Factions");
|
||||||
|
if (factions != null) {
|
||||||
|
foreach (JObject system_faction in factions) {
|
||||||
|
Faction f = Faction.FromJSON(system_faction);
|
||||||
|
if (f != null) {
|
||||||
|
SystemFactions.Add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,15 +7,17 @@ using System.Threading.Tasks;
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class MarketBuyEntry : Entry {
|
public class MarketBuyEntry : Entry {
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public int Count { get; set; }
|
public string TypeLocalised { get; set; }
|
||||||
public int BuyPrice { get; set; }
|
public long Count { get; set; }
|
||||||
public int TotalCost { get; set; }
|
public long BuyPrice { get; set; }
|
||||||
|
public long TotalCost { get; set; }
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
Type = JSON.Value<string>("Type") ?? "";
|
Type = JSON.Value<string>("Type") ?? "";
|
||||||
Count = JSON.Value<int?>("Count") ?? 0;
|
TypeLocalised = JSON.Value<string>("Type_Localised") ?? "";
|
||||||
BuyPrice = JSON.Value<int?>("BuyPrice") ?? 0;
|
Count = JSON.Value<long?>("Count") ?? 0;
|
||||||
TotalCost = JSON.Value<int?>("TotalCost") ?? 0;
|
BuyPrice = JSON.Value<long?>("BuyPrice") ?? 0;
|
||||||
|
TotalCost = JSON.Value<long?>("TotalCost") ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Localised name of the cargo sold, may be null.
|
||||||
|
/// </summary>
|
||||||
|
public string TypeLocalised { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// Price per unit
|
/// Price per unit
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int SellPrice { get; set; }
|
public int SellPrice { get; set; }
|
||||||
@@ -35,6 +39,7 @@
|
|||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
Type = JSON.Value<string>("Type") ?? "";
|
Type = JSON.Value<string>("Type") ?? "";
|
||||||
|
TypeLocalised = JSON.Value<string>("Type_Localised") ?? "";
|
||||||
TotalSale = JSON.Value<int?>("TotalSale") ?? 0;
|
TotalSale = JSON.Value<int?>("TotalSale") ?? 0;
|
||||||
Count = JSON.Value<int?>("Count") ?? 0;
|
Count = JSON.Value<int?>("Count") ?? 0;
|
||||||
AvgPricePaid = JSON.Value<int?>("AvgPricePaid") ?? 0;
|
AvgPricePaid = JSON.Value<int?>("AvgPricePaid") ?? 0;
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
|
|
||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class MissionAbandonedEntry : Entry {
|
public class MissionAbandonedEntry : Entry {
|
||||||
private int missionid = 0;
|
public ulong MissionID { get; set; }
|
||||||
public int MissionID => missionid;
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
missionid = JSON.Value<int?>("MissionID") ?? 0;
|
MissionID = JSON.Value<ulong?>("MissionID") ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,33 +1,24 @@
|
|||||||
|
|
||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class MissionAcceptedEntry : Entry {
|
public class MissionAcceptedEntry : Entry {
|
||||||
private string faction = null;
|
public string Faction { get; set; }
|
||||||
private string targetfaction = null;
|
public string TargetFaction { get; set; }
|
||||||
private string name = null;
|
public string Name { get; set; }
|
||||||
private string localisedname = null;
|
public string LocalisedName { get; set; }
|
||||||
private string localisedtargettype = null;
|
public string LocalisedTargetType { get; set; }
|
||||||
private int killcount = 0;
|
public int KillCount { get; set; }
|
||||||
private int missionid = 0;
|
public ulong MissionID { get; set; }
|
||||||
private int reward = 0;
|
public long Reward { get; set; }
|
||||||
|
|
||||||
public string Faction => faction;
|
|
||||||
public string TargetFaction => targetfaction;
|
|
||||||
public string Name => name;
|
|
||||||
public string LocalisedName => localisedname;
|
|
||||||
public string LocalisedTargetType => localisedtargettype;
|
|
||||||
public int KillCount => killcount;
|
|
||||||
public int MissionID => missionid;
|
|
||||||
public int Reward => reward;
|
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
faction = JSON.Value<string>("Faction") ?? "";
|
Faction = JSON.Value<string>("Faction") ?? "";
|
||||||
targetfaction = JSON.Value<string>("TargetFaction") ?? "";
|
TargetFaction = JSON.Value<string>("TargetFaction") ?? "";
|
||||||
name = JSON.Value<string>("Name") ?? "";
|
Name = JSON.Value<string>("Name") ?? "";
|
||||||
localisedname = JSON.Value<string>("LocalisedName") ?? "";
|
LocalisedName = JSON.Value<string>("LocalisedName") ?? "";
|
||||||
localisedtargettype = JSON.Value<string>("TargetType_Localised") ?? "";
|
LocalisedTargetType = JSON.Value<string>("TargetType_Localised") ?? "";
|
||||||
killcount = JSON.Value<int?>("KillCount") ?? 0;
|
KillCount = JSON.Value<int?>("KillCount") ?? 0;
|
||||||
missionid = JSON.Value<int?>("MissionID") ?? 0;
|
MissionID = JSON.Value<ulong?>("MissionID") ?? 0;
|
||||||
reward = JSON.Value<int?>("Reward") ?? 0;
|
Reward = JSON.Value<long?>("Reward") ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,78 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class MissionCompletedEntry : Entry {
|
public class MissionCompletedEntry : Entry {
|
||||||
private Dictionary<string, string> influences = new Dictionary<string, string>();
|
private Dictionary<string, Dictionary<ulong, string>> influences = new Dictionary<string, Dictionary<ulong, string>>();
|
||||||
|
private List<string> affected = new List<string>();
|
||||||
private string readable_name = null;
|
private string readable_name = null;
|
||||||
private bool readable_name_generated = false;
|
private bool readable_name_generated = false;
|
||||||
private string name = null;
|
|
||||||
private string commodity = null;
|
public Dictionary<string, Dictionary<ulong, string>> Influences => influences;
|
||||||
private int count = 0;
|
|
||||||
private int donated = 0;
|
|
||||||
private int id = 0;
|
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
id = JSON.Value<int?>("MissionID") ?? 0;
|
MissionID = JSON.Value<ulong?>("MissionID") ?? 0;
|
||||||
name = JSON.Value<string>("Name");
|
Name = JSON.Value<string>("Name");
|
||||||
|
Faction = JSON.Value<string>("Faction") ?? "";
|
||||||
|
TargetFaction = JSON.Value<string>("TargetFaction") ?? "";
|
||||||
if (JSON.ContainsKey("Commodity_Localised")) {
|
if (JSON.ContainsKey("Commodity_Localised")) {
|
||||||
commodity = JSON.Value<string>("Commodity_Localised");
|
Commodity = JSON.Value<string>("Commodity_Localised");
|
||||||
}
|
}
|
||||||
if (JSON.ContainsKey("Count")) {
|
if (JSON.ContainsKey("Count")) {
|
||||||
count = JSON.Value<int>("Count");
|
Count = JSON.Value<int>("Count");
|
||||||
}
|
}
|
||||||
if (JSON.ContainsKey("Donated")) {
|
if (JSON.ContainsKey("Donated")) {
|
||||||
donated = JSON.Value<int>("Donated");
|
Donated = JSON.Value<int>("Donated");
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeHumanReadableName();
|
MakeHumanReadableName();
|
||||||
|
BuildInfluenceList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name => name;
|
private void BuildInfluenceList() {
|
||||||
public string Commodity => commodity;
|
influences.Clear();
|
||||||
public int Count => count;
|
affected.Clear();
|
||||||
public int MissionID => id;
|
|
||||||
|
var effects = JSON.Value<JArray>("FactionEffects");
|
||||||
|
foreach (var effect in effects.Children<JObject>()) {
|
||||||
|
string faction = effect.Value<string>("Faction");
|
||||||
|
affected.Add(faction);
|
||||||
|
|
||||||
|
var influence = effect.Value<JArray>("Influence");
|
||||||
|
if (influence == null || influence.Count == 0) {
|
||||||
|
// No influence reward, happens sometimes, but we have to accept it
|
||||||
|
influences.Add(faction, new Dictionary<ulong, string>());
|
||||||
|
} else {
|
||||||
|
foreach (var infl in influence.Children<JObject>()) {
|
||||||
|
infl.TryGetValue("Influence", out JToken result);
|
||||||
|
infl.TryGetValue("SystemAddress", out JToken systemaddr);
|
||||||
|
if (result != null && result.Type == JTokenType.String &&
|
||||||
|
systemaddr != null && systemaddr.Type == JTokenType.Integer) {
|
||||||
|
ulong system = systemaddr.ToObject<ulong?>() ?? 0;
|
||||||
|
string inf = result.ToString();
|
||||||
|
|
||||||
|
if (!influences.ContainsKey(faction)) {
|
||||||
|
influences.Add(faction, new Dictionary<ulong, string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!influences[faction].ContainsKey(system)) {
|
||||||
|
influences[faction].Add(system, inf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Commodity { get; set; }
|
||||||
|
public int Count { get; set; }
|
||||||
|
public int Donated { get; set; }
|
||||||
|
public ulong MissionID { get; set; }
|
||||||
|
public string Faction { get; set; }
|
||||||
|
public string TargetFaction { get; set; }
|
||||||
|
|
||||||
private void MakeHumanReadableName() {
|
private void MakeHumanReadableName() {
|
||||||
if (readable_name != null || Name == null) {
|
if (readable_name != null || Name == null) {
|
||||||
@@ -60,12 +100,12 @@ namespace EDJournal {
|
|||||||
builder.Append(readable);
|
builder.Append(readable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count > 0 && commodity != null) {
|
if (Count > 0 && Commodity != null) {
|
||||||
builder.AppendFormat(" ({0} {1})", count, commodity);
|
builder.AppendFormat(" ({0} {1})", Count, Commodity);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (donated > 0) {
|
if (Donated > 0) {
|
||||||
builder.AppendFormat(" ({0})", Credits.FormatCredits(donated));
|
builder.AppendFormat(" ({0})", Credits.FormatCredits(Donated));
|
||||||
}
|
}
|
||||||
|
|
||||||
readable_name = builder.ToString().Trim();
|
readable_name = builder.ToString().Trim();
|
||||||
@@ -85,34 +125,27 @@ namespace EDJournal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string[] AffectedFactions => affected.ToArray();
|
||||||
|
|
||||||
public string GetInfluenceForFaction(string faction) {
|
public string GetInfluenceForFaction(string faction) {
|
||||||
if (influences.ContainsKey(faction)) {
|
if (!influences.ContainsKey(faction)) {
|
||||||
return influences[faction];
|
|
||||||
}
|
|
||||||
|
|
||||||
var effects = JSON.Value<JArray>("FactionEffects");
|
|
||||||
foreach (var effect in effects.Children<JObject>()) {
|
|
||||||
if (effect.GetValue("Faction").ToString() != faction) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var influence = effect.Value<JArray>("Influence");
|
|
||||||
if (influence == null || influence.Count == 0) {
|
|
||||||
// No influence reward, happens on courier missions sometimes.
|
|
||||||
// There is always one point of rep, even if the mission won't state it
|
|
||||||
influences.Add(faction, "+");
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var infl in influence.Children<JObject>()) {
|
|
||||||
infl.TryGetValue("Influence", out JToken result);
|
|
||||||
if (result != null && result.Type == JTokenType.String) {
|
|
||||||
influences.Add(faction, result.ToString());
|
|
||||||
return result.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var inf = influences[faction];
|
||||||
|
return string.Join("", inf.Values);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetInfluenceForFaction(string faction, ulong systemaddr) {
|
||||||
|
if (!influences.ContainsKey(faction)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!influences[faction].ContainsKey(systemaddr)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return influences[faction][systemaddr];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class MissionFailedEntry : Entry {
|
public class MissionFailedEntry : Entry {
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public int MissionID { get; set; }
|
public ulong MissionID { get; set; }
|
||||||
public int Fine { get; set; }
|
public int Fine { get; set; }
|
||||||
|
|
||||||
public string HumanReadableName {
|
public string HumanReadableName {
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
Name = JSON.Value<string>("Name") ?? "";
|
Name = JSON.Value<string>("Name") ?? "";
|
||||||
MissionID = JSON.Value<int?>("MissionID") ?? 0;
|
MissionID = JSON.Value<ulong?>("MissionID") ?? 0;
|
||||||
Fine = JSON.Value<int?>("Fine") ?? 0;
|
Fine = JSON.Value<int?>("Fine") ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +1,46 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Missions>
|
<Missions>
|
||||||
|
<Mission Name="Chain_FindThePirateLord_name">Assassination (Pirate Lord) (Chain)</Mission>
|
||||||
<Mission Name="Chain_RegainFooting_name">Regain Footing (Chain)</Mission>
|
<Mission Name="Chain_RegainFooting_name">Regain Footing (Chain)</Mission>
|
||||||
|
<Mission Name="Chain_SalvageJustice_name">Assassination (Legal) (Chain)</Mission>
|
||||||
<Mission Name="Mission_Altruism_name">Donate</Mission>
|
<Mission Name="Mission_Altruism_name">Donate</Mission>
|
||||||
<Mission Name="Mission_AltruismCredits_Bust_name">Donate Credits (Bust)</Mission>
|
<Mission Name="Mission_AltruismCredits_Bust_name">Donate Credits (Bust)</Mission>
|
||||||
|
<Mission Name="Mission_AltruismCredits_Famine_name">Donate Credits (Famine)</Mission>
|
||||||
<Mission Name="Mission_AltruismCredits_name">Donate Credits</Mission>
|
<Mission Name="Mission_AltruismCredits_name">Donate Credits</Mission>
|
||||||
|
<Mission Name="Mission_Assassinate_Illegal_BLOPS_name">Assassination (Illegal)</Mission>
|
||||||
<Mission Name="Mission_Assassinate_Legal_Corporate_name">Corporate Assassination (Legal)</Mission>
|
<Mission Name="Mission_Assassinate_Legal_Corporate_name">Corporate Assassination (Legal)</Mission>
|
||||||
<Mission Name="Mission_Assassinate_name">Assassination</Mission>
|
<Mission Name="Mission_Assassinate_name">Assassination</Mission>
|
||||||
|
<Mission Name="Mission_Assassinate_Planetary_name">Assassination (Planetary Scan)</Mission>
|
||||||
<Mission Name="Mission_Collect_Bust_name">Provide (Bust)</Mission>
|
<Mission Name="Mission_Collect_Bust_name">Provide (Bust)</Mission>
|
||||||
<Mission Name="Mission_Collect_CivilLiberty_name">Provide (Civil Liberty)</Mission>
|
<Mission Name="Mission_Collect_CivilLiberty_name">Provide (Civil Liberty)</Mission>
|
||||||
<Mission Name="Mission_Collect_CivilUnrest_name">Provide (Civil Unrest)</Mission>
|
<Mission Name="Mission_Collect_CivilUnrest_name">Provide (Civil Unrest)</Mission>
|
||||||
<Mission Name="Mission_Collect_Famine_name">Provide (Famine)</Mission>
|
<Mission Name="Mission_Collect_Famine_name">Provide (Famine)</Mission>
|
||||||
<Mission Name="Mission_Collect_Industrial_name">Provide (Industrial)</Mission>
|
<Mission Name="Mission_Collect_Industrial_name">Provide (Industrial)</Mission>
|
||||||
<Mission Name="Mission_Collect_name">Provide</Mission>
|
<Mission Name="Mission_Collect_name">Provide</Mission>
|
||||||
|
<Mission Name="Mission_Collect_RankEmp_name">Provide (Imperial Navy)</Mission>
|
||||||
|
<Mission Name="Mission_Collect_Retreat_name">Provide (Retreat)</Mission>
|
||||||
<Mission Name="Mission_Courier_Democracy_name">Courier (Democracy)</Mission>
|
<Mission Name="Mission_Courier_Democracy_name">Courier (Democracy)</Mission>
|
||||||
<Mission Name="Mission_Courier_Elections_name">Courier (Elections)</Mission>
|
<Mission Name="Mission_Courier_Elections_name">Courier (Elections)</Mission>
|
||||||
<Mission Name="Mission_Courier_Expansion_name">Courier (Expansion)</Mission>
|
<Mission Name="Mission_Courier_Expansion_name">Courier (Expansion)</Mission>
|
||||||
<Mission Name="Mission_Courier_Famine_name">Courier (Famine)</Mission>
|
<Mission Name="Mission_Courier_Famine_name">Courier (Famine)</Mission>
|
||||||
<Mission Name="Mission_Courier_Lockdown_name">Courier (Lockdown)</Mission>
|
<Mission Name="Mission_Courier_Lockdown_name">Courier (Lockdown)</Mission>
|
||||||
<Mission Name="Mission_Courier_name">Courier</Mission>
|
<Mission Name="Mission_Courier_name">Courier</Mission>
|
||||||
<Mission Name="Mission_Courier_RankEmp_name">Courier (Empire)</Mission>
|
<Mission Name="Mission_Courier_RankEmp_name">Courier (Imperial Navy)</Mission>
|
||||||
<Mission Name="Mission_Delivery_Agriculture_name">Delivery (Agriculture)</Mission>
|
<Mission Name="Mission_Delivery_Agriculture_name">Delivery (Agriculture)</Mission>
|
||||||
<Mission Name="Mission_Delivery_Boom_name">Delivery (Boom)</Mission>
|
<Mission Name="Mission_Delivery_Boom_name">Delivery (Boom)</Mission>
|
||||||
<Mission Name="Mission_Delivery_Democracy_name">Delivery (Democracy)</Mission>
|
<Mission Name="Mission_Delivery_Democracy_name">Delivery (Democracy)</Mission>
|
||||||
<Mission Name="Mission_Delivery_Investment_name">Delivery (Investment)</Mission>
|
<Mission Name="Mission_Delivery_Investment_name">Delivery (Investment)</Mission>
|
||||||
<Mission Name="Mission_Delivery_name">Delivery</Mission>
|
<Mission Name="Mission_Delivery_name">Delivery</Mission>
|
||||||
<Mission Name="Mission_Delivery_RankEmp_name">Delivery (Imperial Rank)</Mission>
|
<Mission Name="Mission_Delivery_RankEmp_name">Delivery (Imperial Navy)</Mission>
|
||||||
<Mission Name="Mission_Delivery_Retreat_name">Delivery (Retreat)</Mission>
|
<Mission Name="Mission_Delivery_Retreat_name">Delivery (Retreat)</Mission>
|
||||||
|
<Mission Name="Mission_DeliveryWing_name">Delivery (Wing)</Mission>
|
||||||
|
<Mission Name="Mission_DeliveryWing_War_name">Delivery (Wing) (War)</Mission>
|
||||||
<Mission Name="Mission_Hack_BLOPS_Boom_name">Hack Surface Installation (Boom)</Mission>
|
<Mission Name="Mission_Hack_BLOPS_Boom_name">Hack Surface Installation (Boom)</Mission>
|
||||||
|
<Mission Name="Mission_Hack_BLOPS_Elections_name">Hack Surface Installation (Elections)</Mission>
|
||||||
<Mission Name="Mission_Hack_BLOPS_Expansion_name">Hack Surface Installation (Expansion)</Mission>
|
<Mission Name="Mission_Hack_BLOPS_Expansion_name">Hack Surface Installation (Expansion)</Mission>
|
||||||
<Mission Name="MISSION_Hack_BLOPS_name">Hack Surface Installation</Mission>
|
<Mission Name="MISSION_Hack_BLOPS_name">Hack Surface Installation</Mission>
|
||||||
<Mission Name="Mission_HackMegaship_name">Hack Megaship</Mission>
|
<Mission Name="Mission_HackMegaship_name">Hack Megaship</Mission>
|
||||||
|
<Mission Name="Mission_LongDistanceExpedition_Explorer_Boom_name">Long Distance Expedition (Boom)</Mission>
|
||||||
<Mission Name="Mission_LongDistanceExpedition_name">Long Distance Expedition</Mission>
|
<Mission Name="Mission_LongDistanceExpedition_name">Long Distance Expedition</Mission>
|
||||||
<Mission Name="Mission_Massacre_Conflict_CivilWar_name">Massacre (Civil War)</Mission>
|
<Mission Name="Mission_Massacre_Conflict_CivilWar_name">Massacre (Civil War)</Mission>
|
||||||
<Mission Name="Mission_Massacre_name">Massacre</Mission>
|
<Mission Name="Mission_Massacre_name">Massacre</Mission>
|
||||||
@@ -41,7 +52,10 @@
|
|||||||
<Mission Name="Mission_OnFoot_Collect_Contact_MB_name">On Foot Collect</Mission>
|
<Mission Name="Mission_OnFoot_Collect_Contact_MB_name">On Foot Collect</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Collect_MB_name">On Foot Collection</Mission>
|
<Mission Name="Mission_OnFoot_Collect_MB_name">On Foot Collection</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Delivery_Contact_MB_name">On Foot Delivery (Contact)</Mission>
|
<Mission Name="Mission_OnFoot_Delivery_Contact_MB_name">On Foot Delivery (Contact)</Mission>
|
||||||
|
<Mission Name="Mission_OnFoot_Hack_Upload_Covert_MB_name">On Foot Hack (Covert Upload)</Mission>
|
||||||
|
<Mission Name="Mission_OnFoot_Hack_Upload_MB_name">On Foot Hack (Upload)</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Heist_POI_MB_name">On Foot Heist (POI)</Mission>
|
<Mission Name="Mission_OnFoot_Heist_POI_MB_name">On Foot Heist (POI)</Mission>
|
||||||
|
<Mission Name="Mission_OnFoot_Massacre_MB_name">On Foot Massacre</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Onslaught_MB_name">On Foot Onslaught</Mission>
|
<Mission Name="Mission_OnFoot_Onslaught_MB_name">On Foot Onslaught</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Onslaught_Offline_MB_name">On Foot Onslaught (Offline)</Mission>
|
<Mission Name="Mission_OnFoot_Onslaught_Offline_MB_name">On Foot Onslaught (Offline)</Mission>
|
||||||
<Mission Name="Mission_OnFoot_ProductionHeist_Covert_MB_name">On Foot Production Heist (Covert)</Mission>
|
<Mission Name="Mission_OnFoot_ProductionHeist_Covert_MB_name">On Foot Production Heist (Covert)</Mission>
|
||||||
@@ -50,14 +64,20 @@
|
|||||||
<Mission Name="Mission_OnFoot_RebootRestore_MB_name">On Foot Reboot/Restore</Mission>
|
<Mission Name="Mission_OnFoot_RebootRestore_MB_name">On Foot Reboot/Restore</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Sabotage_Production_Covert_MB_name">On Foot Sabotage Production (Covert)</Mission>
|
<Mission Name="Mission_OnFoot_Sabotage_Production_Covert_MB_name">On Foot Sabotage Production (Covert)</Mission>
|
||||||
<Mission Name="Mission_OnFoot_Salvage_MB_name">On Foot Salvage</Mission>
|
<Mission Name="Mission_OnFoot_Salvage_MB_name">On Foot Salvage</Mission>
|
||||||
|
<Mission Name="Mission_OnFoot_SalvageIllegal_MB_name">On Foot Salvage (Illegal)</Mission>
|
||||||
|
<Mission Name="Mission_PassengerBulk_AIDWORKER_ARRIVING">Aid Workers Seeking Transport</Mission>
|
||||||
|
<Mission Name="Mission_PassengerVIP">Passenger (VIP)</Mission>
|
||||||
|
<Mission Name="Mission_PassengerVIP_Criminal_BOOM_name">Passenger Criminal (VIP) (Boom)</Mission>
|
||||||
<Mission Name="Mission_PassengerVIP_name">Passenger (VIP)</Mission>
|
<Mission Name="Mission_PassengerVIP_name">Passenger (VIP)</Mission>
|
||||||
<Mission Name="Mission_PassengerVIP_Scientist_FAMINE_name">Passenger (VIP) (Famine)</Mission>
|
<Mission Name="Mission_PassengerVIP_Scientist_FAMINE_name">Passenger Scientist (VIP) (Famine)</Mission>
|
||||||
|
<Mission Name="Mission_PassengerVIP_Tourist_BOOM_name">Passenger Tourist (VIP) (Boom)</Mission>
|
||||||
<Mission Name="Mission_Rescue_Planet_name">Planet Rescue</Mission>
|
<Mission Name="Mission_Rescue_Planet_name">Planet Rescue</Mission>
|
||||||
<Mission Name="MISSION_Salvage_CivilUnrest_name">Salvage (Civil Unrest)</Mission>
|
<Mission Name="MISSION_Salvage_CivilUnrest_name">Salvage (Civil Unrest)</Mission>
|
||||||
<Mission Name="MISSION_Salvage_Expansion_name">Salvage (Expansion)</Mission>
|
<Mission Name="MISSION_Salvage_Expansion_name">Salvage (Expansion)</Mission>
|
||||||
<Mission Name="MISSION_Salvage_Illegal_name">Salvage (Illegal)</Mission>
|
<Mission Name="MISSION_Salvage_Illegal_name">Salvage (Illegal)</Mission>
|
||||||
<Mission Name="Mission_Salvage_name">Salvage</Mission>
|
<Mission Name="Mission_Salvage_name">Salvage</Mission>
|
||||||
<Mission Name="Mission_Salvage_RankEmp_name">Salvage (Imperial Navy)</Mission>
|
<Mission Name="Mission_Salvage_RankEmp_name">Salvage (Imperial Navy)</Mission>
|
||||||
|
<Mission Name="MISSION_Salvage_Refinery_name">Salvage (Refinery)</Mission>
|
||||||
<Mission Name="MISSION_Salvage_Retreat_name">Salvage (Retreat)</Mission>
|
<Mission Name="MISSION_Salvage_Retreat_name">Salvage (Retreat)</Mission>
|
||||||
<Mission Name="MISSION_Scan_name">Scan</Mission>
|
<Mission Name="MISSION_Scan_name">Scan</Mission>
|
||||||
<Mission Name="Mission_Sightseeing_Criminal_FAMINE_name">Sightseeing (Criminal) (Famine)</Mission>
|
<Mission Name="Mission_Sightseeing_Criminal_FAMINE_name">Sightseeing (Criminal) (Famine)</Mission>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace EDJournal {
|
|||||||
|
|
||||||
public JournalFile GetLastFile() {
|
public JournalFile GetLastFile() {
|
||||||
var lastfile = Files
|
var lastfile = Files
|
||||||
.OrderBy(x => x.Timestamp)
|
.OrderBy(x => x.DateTime)
|
||||||
.Last()
|
.Last()
|
||||||
;
|
;
|
||||||
return lastfile;
|
return lastfile;
|
||||||
@@ -62,5 +62,28 @@ namespace EDJournal {
|
|||||||
|
|
||||||
journalfiles.Sort();
|
journalfiles.Sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Entry FindMostRecent(string entry) {
|
||||||
|
var entries = journalfiles
|
||||||
|
.OrderByDescending(x => x.DateTime)
|
||||||
|
.ToArray()
|
||||||
|
;
|
||||||
|
|
||||||
|
if (entries == null || entries.Length == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(JournalFile file in entries) {
|
||||||
|
Entry found = file.Entries
|
||||||
|
.OrderByDescending(x => x.Timestamp)
|
||||||
|
.First(x => x.Event == entry)
|
||||||
|
;
|
||||||
|
if (found != null) {
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,15 @@ namespace EDJournal {
|
|||||||
if (factions != null) {
|
if (factions != null) {
|
||||||
foreach (JObject faction in factions.Children<JObject>()) {
|
foreach (JObject faction in factions.Children<JObject>()) {
|
||||||
string faction_name = faction.Value<string>("Faction");
|
string faction_name = faction.Value<string>("Faction");
|
||||||
|
long faction_bounty = faction.Value<long?>("Amount") ?? 0;
|
||||||
if (faction_name == null || faction_name.Length <= 0) {
|
if (faction_name == null || faction_name.Length <= 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Factions.Add(faction_name);
|
Factions.Add(faction_name);
|
||||||
|
if (!FactionBounties.ContainsKey(faction_name)) {
|
||||||
|
FactionBounties[faction_name] = 0;
|
||||||
|
}
|
||||||
|
FactionBounties[faction_name] += faction_bounty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,11 +28,16 @@ namespace EDJournal {
|
|||||||
string single_faction = JSON.Value<string>("Faction");
|
string single_faction = JSON.Value<string>("Faction");
|
||||||
if (single_faction != null) {
|
if (single_faction != null) {
|
||||||
Factions.Add(single_faction);
|
Factions.Add(single_faction);
|
||||||
|
if (!FactionBounties.ContainsKey(single_faction)) {
|
||||||
|
FactionBounties[single_faction] = 0;
|
||||||
|
}
|
||||||
|
FactionBounties[single_faction] += Amount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Amount { get; set; } = 0;
|
public int Amount { get; set; } = 0;
|
||||||
public string Type { get; set; } = "Bounty";
|
public string Type { get; set; } = "Bounty";
|
||||||
public List<string> Factions { get; set; } = new List<string>();
|
public List<string> Factions { get; set; } = new List<string>();
|
||||||
|
public Dictionary<string, long> FactionBounties { get; set; } = new Dictionary<string, long>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
SearchAndRescueEntry.cs
Normal file
19
SearchAndRescueEntry.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
namespace EDJournal {
|
||||||
|
public class SearchAndRescueEntry : Entry {
|
||||||
|
public long MarketID { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string NameLocalised { get; set; }
|
||||||
|
public long Count { get; set; }
|
||||||
|
public long Reward { get; set; }
|
||||||
|
|
||||||
|
protected override void Initialise() {
|
||||||
|
MarketID = JSON.Value<long?>("MarketID") ?? 0;
|
||||||
|
Name = JSON.Value<string>("Name") ?? "";
|
||||||
|
NameLocalised = JSON.Value<string>("Name_Localised");
|
||||||
|
Count = JSON.Value<long?>("Count") ?? 0;
|
||||||
|
Reward = JSON.Value<long?>("Reward") ?? 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
32
SellExplorationDataEntry.cs
Normal file
32
SellExplorationDataEntry.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
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>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
50
SellOrganicDataEntry.cs
Normal file
50
SellOrganicDataEntry.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace EDJournal {
|
||||||
|
public class BioData {
|
||||||
|
public string Genus { get; set; }
|
||||||
|
public string GenusLocalised { get; set; }
|
||||||
|
public string Species { get; set; }
|
||||||
|
public string SpeciesLocalised { get; set; }
|
||||||
|
public long Value { get; set; }
|
||||||
|
public long Bonus { get; set; }
|
||||||
|
public long TotalValue => Value + Bonus;
|
||||||
|
}
|
||||||
|
public class SellOrganicDataEntry : Entry {
|
||||||
|
public long MarketID { get; set; }
|
||||||
|
public List<BioData> BioData { get; set; }
|
||||||
|
|
||||||
|
protected override void Initialise() {
|
||||||
|
MarketID = JSON.Value<long?>("MarketID") ?? 0;
|
||||||
|
|
||||||
|
var biodata = JSON.Value<JArray>("BioData");
|
||||||
|
BioData = new List<BioData>();
|
||||||
|
|
||||||
|
if (biodata == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (JObject item in biodata) {
|
||||||
|
BioData data = new BioData {
|
||||||
|
Bonus = item.Value<long?>("Bonus") ?? 0,
|
||||||
|
Value = item.Value<long?>("Value") ?? 0,
|
||||||
|
Species = item.Value<string>("Species") ?? "",
|
||||||
|
Genus = item.Value<string>("Genus") ?? "",
|
||||||
|
GenusLocalised = item.Value<string>("Genus_Localised") ?? "",
|
||||||
|
SpeciesLocalised = item.Value<string>("Species_Localised") ?? ""
|
||||||
|
};
|
||||||
|
|
||||||
|
BioData.Add(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public long TotalValue {
|
||||||
|
get { return BioData.Sum(x => x.TotalValue); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +1,31 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace EDJournal {
|
namespace EDJournal {
|
||||||
public class ShipTargetedEntry : Entry {
|
public class ShipTargetedEntry : Entry {
|
||||||
private string ship = null;
|
public string Ship { get; set; }
|
||||||
private string pilot = null;
|
public long ScanStage { get; set; }
|
||||||
private string rank = null;
|
public string PilotName { get; set; }
|
||||||
private double shield = 0.0;
|
public string PilotNameLocalised { get; set; }
|
||||||
private double hull = 0.0;
|
public string PilotRank { get; set; }
|
||||||
private int bounty = 0;
|
public double ShieldHealth { get; set; }
|
||||||
private string legalstatus = null;
|
public double HullHealth { get; set; }
|
||||||
private string faction = null;
|
public long Bounty { get; set; }
|
||||||
|
public string LegalStatus { get; set; }
|
||||||
public string Ship => ship;
|
public string Faction { get; set; }
|
||||||
public string Pilot => pilot;
|
public string Power { get; set; }
|
||||||
public string Rank => rank;
|
|
||||||
public double ShieldHealth => shield;
|
|
||||||
public double HullHealth => hull;
|
|
||||||
public int Bounty => bounty;
|
|
||||||
public string LegalStatus => legalstatus;
|
|
||||||
public string Faction => faction;
|
|
||||||
|
|
||||||
protected override void Initialise() {
|
protected override void Initialise() {
|
||||||
ship = JSON.Value<string>("Ship_Localised") ?? "";
|
ScanStage = JSON.Value<long?>("ScanStage") ?? 0;
|
||||||
pilot = JSON.Value<string>("PilotName_Localised") ?? "";
|
Ship = JSON.Value<string>("Ship_Localised") ?? "";
|
||||||
rank = JSON.Value<string>("PilotRank") ?? "";
|
PilotName = JSON.Value<string>("PilotName") ?? "";
|
||||||
shield = JSON.Value<double?>("ShieldHealth") ?? 0.0;
|
PilotNameLocalised = JSON.Value<string>("PilotName_Localised") ?? "";
|
||||||
hull = JSON.Value<double?>("HullHealth") ?? 0.0;
|
PilotRank = JSON.Value<string>("PilotRank") ?? "";
|
||||||
bounty = JSON.Value<int?>("Bounty") ?? 0;
|
ShieldHealth = JSON.Value<double?>("ShieldHealth") ?? 0.0;
|
||||||
legalstatus = JSON.Value<string>("LegalStatus") ?? "Clean";
|
HullHealth = JSON.Value<double?>("HullHealth") ?? 0.0;
|
||||||
faction = JSON.Value<string>("Faction") ?? "";
|
Bounty = JSON.Value<long?>("Bounty") ?? 0;
|
||||||
|
LegalStatus = JSON.Value<string>("LegalStatus") ?? "Clean";
|
||||||
|
Faction = JSON.Value<string>("Faction") ?? "";
|
||||||
|
Power = JSON.Value<string>("Power") ?? "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,13 +42,16 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BountyEntry.cs" />
|
<Compile Include="BountyEntry.cs" />
|
||||||
|
<Compile Include="CommanderEntry.cs" />
|
||||||
<Compile Include="CommitCrimeEntry.cs" />
|
<Compile Include="CommitCrimeEntry.cs" />
|
||||||
<Compile Include="Credits.cs" />
|
<Compile Include="Credits.cs" />
|
||||||
|
<Compile Include="CrimeTypes.cs" />
|
||||||
<Compile Include="DiedEntry.cs" />
|
<Compile Include="DiedEntry.cs" />
|
||||||
<Compile Include="DockedEntry.cs" />
|
<Compile Include="DockedEntry.cs" />
|
||||||
<Compile Include="EliteDangerous.cs" />
|
<Compile Include="EliteDangerous.cs" />
|
||||||
<Compile Include="Entry.cs" />
|
<Compile Include="Entry.cs" />
|
||||||
<Compile Include="Events.cs" />
|
<Compile Include="Events.cs" />
|
||||||
|
<Compile Include="Faction.cs" />
|
||||||
<Compile Include="FactionKillBondEntry.cs" />
|
<Compile Include="FactionKillBondEntry.cs" />
|
||||||
<Compile Include="FSDJumpEntry.cs" />
|
<Compile Include="FSDJumpEntry.cs" />
|
||||||
<Compile Include="HullDamageEntry.cs" />
|
<Compile Include="HullDamageEntry.cs" />
|
||||||
@@ -56,6 +59,7 @@
|
|||||||
<Compile Include="JournalException.cs" />
|
<Compile Include="JournalException.cs" />
|
||||||
<Compile Include="JournalFile.cs" />
|
<Compile Include="JournalFile.cs" />
|
||||||
<Compile Include="JournalStream.cs" />
|
<Compile Include="JournalStream.cs" />
|
||||||
|
<Compile Include="LoadGameEntry.cs" />
|
||||||
<Compile Include="LocationEntry.cs" />
|
<Compile Include="LocationEntry.cs" />
|
||||||
<Compile Include="MarketBuyEntry.cs" />
|
<Compile Include="MarketBuyEntry.cs" />
|
||||||
<Compile Include="MarketSellEntry.cs" />
|
<Compile Include="MarketSellEntry.cs" />
|
||||||
@@ -68,7 +72,10 @@
|
|||||||
<Compile Include="PlayerJournal.cs" />
|
<Compile Include="PlayerJournal.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="RedeemVoucherEntry.cs" />
|
<Compile Include="RedeemVoucherEntry.cs" />
|
||||||
|
<Compile Include="SearchAndRescueEntry.cs" />
|
||||||
|
<Compile Include="SellExplorationDataEntry.cs" />
|
||||||
<Compile Include="SellMicroResourcesEntry.cs" />
|
<Compile Include="SellMicroResourcesEntry.cs" />
|
||||||
|
<Compile Include="SellOrganicDataEntry.cs" />
|
||||||
<Compile Include="ShieldStateEntry.cs" />
|
<Compile Include="ShieldStateEntry.cs" />
|
||||||
<Compile Include="ShipTargetedEntry.cs" />
|
<Compile Include="ShipTargetedEntry.cs" />
|
||||||
<Compile Include="UnderAttackEntry.cs" />
|
<Compile Include="UnderAttackEntry.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user