2021-10-07 08:52:19 +02:00
|
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace EDJournal {
|
2021-08-25 18:24:44 +02:00
|
|
|
|
public class RedeemVoucherEntry : Entry {
|
|
|
|
|
protected override void Initialise() {
|
2021-10-07 08:52:19 +02:00
|
|
|
|
Amount = JSON.Value<int>("Amount");
|
|
|
|
|
Type = JSON.Value<string>("Type");
|
|
|
|
|
|
|
|
|
|
/* according to API, there should be a Factions structure */
|
|
|
|
|
JToken factions = JSON.GetValue("Factions");
|
|
|
|
|
if (factions != null) {
|
|
|
|
|
foreach (JObject faction in factions.Children<JObject>()) {
|
|
|
|
|
string faction_name = faction.Value<string>("Faction");
|
|
|
|
|
if (faction_name == null || faction_name.Length <= 0) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
Factions.Add(faction_name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* but there also might be just a Faction entry */
|
|
|
|
|
string single_faction = JSON.Value<string>("Faction");
|
|
|
|
|
if (single_faction != null) {
|
|
|
|
|
Factions.Add(single_faction);
|
|
|
|
|
}
|
2021-08-25 18:24:44 +02:00
|
|
|
|
}
|
|
|
|
|
|
2021-10-07 08:52:19 +02:00
|
|
|
|
public int Amount { get; set; } = 0;
|
|
|
|
|
public string Type { get; set; } = "Bounty";
|
|
|
|
|
public List<string> Factions { get; set; } = new List<string>();
|
2021-08-25 18:24:44 +02:00
|
|
|
|
}
|
|
|
|
|
}
|