add a new entry subclass for MarketBuy

This commit is contained in:
Florian Stinglmayr 2022-01-12 16:19:26 +01:00
parent f870052d84
commit e3e67b0849
4 changed files with 24 additions and 0 deletions

View File

@ -20,6 +20,7 @@ namespace EDJournal {
{ Events.FSDJump, typeof(FSDJumpEntry) }, { Events.FSDJump, typeof(FSDJumpEntry) },
{ Events.HullDamage, typeof(HullDamageEntry) }, { Events.HullDamage, typeof(HullDamageEntry) },
{ Events.Location, typeof(LocationEntry) }, { Events.Location, typeof(LocationEntry) },
{ Events.MarketBuy, typeof(MarketBuyEntry) },
{ Events.MarketSell, typeof(MarketSellEntry) }, { Events.MarketSell, typeof(MarketSellEntry) },
{ Events.MissionAbandoned, typeof(MissionAbandonedEntry) }, { Events.MissionAbandoned, typeof(MissionAbandonedEntry) },
{ Events.MissionAccepted, typeof(MissionAcceptedEntry) }, { Events.MissionAccepted, typeof(MissionAcceptedEntry) },

View File

@ -9,6 +9,7 @@
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 Location = "Location"; public static readonly string Location = "Location";
public static readonly string MarketBuy = "MarketBuy";
public static readonly string MarketSell = "MarketSell"; public static readonly string MarketSell = "MarketSell";
public static readonly string MissionAbandoned = "MissionAbandoned"; public static readonly string MissionAbandoned = "MissionAbandoned";
public static readonly string MissionAccepted = "MissionAccepted"; public static readonly string MissionAccepted = "MissionAccepted";

21
MarketBuyEntry.cs Normal file
View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EDJournal {
public class MarketBuyEntry : Entry {
public string Type { get; set; }
public int Count { get; set; }
public int BuyPrice { get; set; }
public int TotalCost { get; set; }
protected override void Initialise() {
Type = JSON.Value<string>("Type") ?? "";
Count = JSON.Value<int?>("Count") ?? 0;
BuyPrice = JSON.Value<int?>("BuyPrice") ?? 0;
TotalCost = JSON.Value<int?>("TotalCost") ?? 0;
}
}
}

View File

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