completely refactor log generation to avoid duplicate code
This commit is contained in:
parent
d79b26e5c9
commit
054376ef63
@ -1,5 +1,83 @@
|
|||||||
namespace EliteBGS.BGS {
|
using System;
|
||||||
public interface IDiscordLogGenerator {
|
using System.Linq;
|
||||||
string GenerateDiscordLog(Report report);
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using EliteBGS.BGS.LogGenerator;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS {
|
||||||
|
public class DiscordLogGenerator {
|
||||||
|
protected List<LogFormatter> formatters = new List<LogFormatter>() {
|
||||||
|
new MissionFormat(),
|
||||||
|
new FailedMissionFormat(),
|
||||||
|
new MurderFormat(),
|
||||||
|
new VoucherFormat(),
|
||||||
|
new CombatZoneFormat(),
|
||||||
|
new KillBondsFormat(),
|
||||||
|
new CartographicsFormat(),
|
||||||
|
new MicroResourcesFormat(),
|
||||||
|
new MarketBuyFormat(),
|
||||||
|
new CargoSoldFormatter(),
|
||||||
|
new VistaGenomicsFormat(),
|
||||||
|
new SearchAndRescueFormat(),
|
||||||
|
};
|
||||||
|
|
||||||
|
protected virtual string GenerateHeader() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string GenerateFooter() {
|
||||||
|
return "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string GenerateObjectiveHeader(Objective objective) {
|
||||||
|
StringBuilder log = new StringBuilder();
|
||||||
|
|
||||||
|
log.AppendFormat("**Date:** {0}\n", DateTime.Now.ToString("dd/MM/yyyy"));
|
||||||
|
log.AppendFormat("**Location:** {0}\n", objective.ToShortString());
|
||||||
|
log.AppendFormat("**Faction:** {0}\n", objective.Faction);
|
||||||
|
log.AppendLine("");
|
||||||
|
log.AppendLine("```");
|
||||||
|
|
||||||
|
return log.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual string GenerateObjectiveFooter(Objective objective) {
|
||||||
|
return "```\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual string GenerateDiscordLog(Report report) {
|
||||||
|
StringBuilder log = new StringBuilder();
|
||||||
|
var objectives = report.Objectives
|
||||||
|
.Where(x => x.IsEnabled && x.LogEntries.Count() > 0)
|
||||||
|
.ToArray()
|
||||||
|
;
|
||||||
|
|
||||||
|
if (objectives.Count() <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
log.AppendFormat("{0}\n", GenerateHeader());
|
||||||
|
|
||||||
|
foreach (Objective objective in objectives) {
|
||||||
|
StringBuilder objlog = new StringBuilder();
|
||||||
|
|
||||||
|
objlog.AppendFormat("{0}\n", GenerateObjectiveHeader(objective));
|
||||||
|
|
||||||
|
foreach (LogFormatter formatter in formatters) {
|
||||||
|
string text = formatter.GenerateLog(objective);
|
||||||
|
if (!string.IsNullOrEmpty(text)) {
|
||||||
|
objlog.AppendFormat("{0}\n", text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
objlog.AppendFormat("{0}\n", GenerateObjectiveFooter(objective));
|
||||||
|
|
||||||
|
log.AppendFormat("{0}\n", objlog.ToString().Trim());
|
||||||
|
}
|
||||||
|
|
||||||
|
log.AppendFormat("{0}\n", GenerateFooter());
|
||||||
|
|
||||||
|
return log.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,313 +1,5 @@
|
|||||||
using System;
|
namespace EliteBGS.BGS {
|
||||||
using System.Globalization;
|
public class GenericDiscordLog : DiscordLogGenerator {
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using EDJournal;
|
|
||||||
using EliteBGS.BGS.LogGenerator;
|
|
||||||
|
|
||||||
namespace EliteBGS.BGS {
|
|
||||||
public class GenericDiscordLog : IDiscordLogGenerator {
|
|
||||||
private List<LogFormatter> formatters = new List<LogFormatter>() {
|
|
||||||
new VistaGenomicsFormat(),
|
|
||||||
new SearchAndRescueFormat(),
|
|
||||||
};
|
|
||||||
|
|
||||||
private string FormatDate() {
|
|
||||||
DateTime today = DateTime.Now;
|
|
||||||
return today.ToString("dd/MM/yyyy");
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildCartoGraphics(Objective objective) {
|
|
||||||
var total = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(Cartographics)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
var pages = total.Count();
|
|
||||||
var sum = total.Sum(x => (x as Cartographics).TotalSum);
|
|
||||||
|
|
||||||
if (pages <= 0 || sum <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format("Sold {0} page(s) worth of universal cartographics\n" +
|
|
||||||
"(Total value: {1})\n\n", pages, Credits.FormatCredits(sum));
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildCargoSold(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
SellCargo[] sold = objective.LogEntries
|
|
||||||
.OfType<SellCargo>()
|
|
||||||
.ToArray()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (sold == null || sold.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (SellCargo sell in sold) {
|
|
||||||
builder.AppendFormat("{0}\n", sell.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.AppendFormat("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMicroResourcesSold(Objective objective) {
|
|
||||||
var total = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(SellMicroResources)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
var sum = total.Sum(x => (x as SellMicroResources).TotalSum);
|
|
||||||
|
|
||||||
if (sum <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format("Sold {0} worth of Micro Resources\n",
|
|
||||||
Credits.FormatCredits(sum));
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildKillBonds(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
FactionKillBonds[] bonds = objective.LogEntries
|
|
||||||
.OfType<FactionKillBonds>()
|
|
||||||
.ToArray()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (bonds == null || bonds.Length == 0) {
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FactionKillBonds bond in bonds) {
|
|
||||||
builder.AppendFormat("{0}\n", bond.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.AppendFormat("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildVouchers(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
var missions = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(Vouchers)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
|
|
||||||
if (missions == null || missions.Count() <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var mission in missions) {
|
|
||||||
var m = mission as Vouchers;
|
|
||||||
builder.AppendFormat("Handed in {0} vouchers for {1}\n", m.Type, m.Faction);
|
|
||||||
builder.AppendFormat("(Total value: {0})\n", Credits.FormatCredits(m.TotalSum));
|
|
||||||
builder.AppendFormat("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildFailedMissions(Objective objective) {
|
|
||||||
MissionFailed[] missions = objective.LogEntries.OfType<MissionFailed>().ToArray();
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
if (missions.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (MissionFailed failed in missions) {
|
|
||||||
MissionFailedEntry f = failed.Failed;
|
|
||||||
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
|
||||||
failed.Amount,
|
|
||||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
|
||||||
failed.Faction
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMissionList(Objective objective) {
|
|
||||||
Dictionary<string, Dictionary<string, int>> collated = new Dictionary<string, Dictionary<string, int>>();
|
|
||||||
StringBuilder output = new StringBuilder();
|
|
||||||
int total_influence = 0;
|
|
||||||
|
|
||||||
var missions = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(MissionCompleted)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
|
|
||||||
if (missions == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (MissionCompleted m in missions) {
|
|
||||||
if (!collated.ContainsKey(m.MissionName)) {
|
|
||||||
collated[m.MissionName] = new Dictionary<string, int>();
|
|
||||||
}
|
|
||||||
if (!collated[m.MissionName].ContainsKey(m.Influence)) {
|
|
||||||
collated[m.MissionName][m.Influence] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
++collated[m.MissionName][m.Influence];
|
|
||||||
|
|
||||||
total_influence += m.Influence.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var mission in collated) {
|
|
||||||
if (objective.Faction != null) {
|
|
||||||
output.AppendFormat("{0}\n", mission.Key);
|
|
||||||
} else {
|
|
||||||
output.AppendFormat("{0}\n", mission.Key);
|
|
||||||
}
|
|
||||||
output.Append("(");
|
|
||||||
foreach (var influence in mission.Value.OrderBy(x => x.Key.Length)) {
|
|
||||||
output.AppendFormat("Inf{0} x{1}, ", influence.Key, influence.Value);
|
|
||||||
}
|
|
||||||
output.Remove(output.Length - 2, 2); // remove last ", "
|
|
||||||
output.Append(")\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
var support = objective.LogEntries.OfType<InfluenceSupport>();
|
|
||||||
foreach (InfluenceSupport inf in support) {
|
|
||||||
output.Append(inf.ToString());
|
|
||||||
output.Append("\n");
|
|
||||||
total_influence += inf.Influence.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (support.Count() > 0) {
|
|
||||||
output.Append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (total_influence > 0) {
|
|
||||||
output.AppendFormat("Total Influence: {0}\n\n", total_influence);
|
|
||||||
}
|
|
||||||
|
|
||||||
return output.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildCombatZones(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
CombatZone[] zones = objective.LogEntries
|
|
||||||
.OfType<CombatZone>()
|
|
||||||
.ToArray()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (zones == null || zones.Length == 0) {
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (CombatZone zone in zones) {
|
|
||||||
builder.AppendFormat("{0}\n", zone.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMurders(Objective objective) {
|
|
||||||
FoulMurder[] murders = objective.LogEntries.OfType<FoulMurder>().ToArray();
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
if (murders.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FoulMurder murder in murders) {
|
|
||||||
builder.Append(murder.ToString());
|
|
||||||
builder.Append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMarketBuy(Objective objective) {
|
|
||||||
BuyCargo[] buys = objective.LogEntries.OfType<BuyCargo>().ToArray();
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
if (buys.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (BuyCargo buy in buys) {
|
|
||||||
builder.Append(buy.ToString());
|
|
||||||
builder.Append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GenerateDiscordLog(Report report) {
|
|
||||||
StringBuilder log = new StringBuilder();
|
|
||||||
|
|
||||||
foreach (var objective in report.Objectives) {
|
|
||||||
if (objective.LogEntries.Count <= 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!objective.IsEnabled) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.AppendFormat("**Date:** {0}\n", FormatDate());
|
|
||||||
log.AppendFormat("**Location:** {0}\n", objective.ToShortString());
|
|
||||||
log.AppendFormat("**Faction:** {0}\n", objective.Faction);
|
|
||||||
log.Append("\n");
|
|
||||||
log.Append("```\n");
|
|
||||||
|
|
||||||
StringBuilder entries = new StringBuilder();
|
|
||||||
|
|
||||||
var missions = BuildMissionList(objective);
|
|
||||||
entries.Append(missions);
|
|
||||||
|
|
||||||
var failed = BuildFailedMissions(objective);
|
|
||||||
entries.Append(failed);
|
|
||||||
|
|
||||||
var murders = BuildMurders(objective);
|
|
||||||
entries.Append(murders);
|
|
||||||
|
|
||||||
var vouchers = BuildVouchers(objective);
|
|
||||||
entries.Append(vouchers);
|
|
||||||
|
|
||||||
var zones = BuildCombatZones(objective);
|
|
||||||
entries.Append(zones);
|
|
||||||
|
|
||||||
var bonds = BuildKillBonds(objective);
|
|
||||||
entries.Append(bonds);
|
|
||||||
|
|
||||||
var carto = BuildCartoGraphics(objective);
|
|
||||||
entries.Append(carto);
|
|
||||||
|
|
||||||
var micro = BuildMicroResourcesSold(objective);
|
|
||||||
entries.Append(micro);
|
|
||||||
|
|
||||||
var buy = BuildMarketBuy(objective);
|
|
||||||
entries.Append(buy);
|
|
||||||
|
|
||||||
var sold = BuildCargoSold(objective);
|
|
||||||
entries.Append(sold);
|
|
||||||
|
|
||||||
foreach (LogFormatter formatter in formatters) {
|
|
||||||
entries.AppendFormat("{0}\n", formatter.GenerateLog(objective));
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Append(entries.ToString().Trim());
|
|
||||||
log.Append("\n```\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return log.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return "Generic Log";
|
return "Generic Log";
|
||||||
}
|
}
|
||||||
|
58
BGS/LogGenerator/CargoSoldFormatter.cs
Normal file
58
BGS/LogGenerator/CargoSoldFormatter.cs
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using EDJournal;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class CargoSoldFormatter : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
SellCargo[] sold = objective.LogEntries
|
||||||
|
.OfType<SellCargo>()
|
||||||
|
.ToArray()
|
||||||
|
;
|
||||||
|
|
||||||
|
if (sold == null || sold.Length <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This groups everything together by cargo sold, and then by market sold to.
|
||||||
|
// Dictionary<string Cargo, Dictionary<string Market, { Market, Amount, Profit }> >
|
||||||
|
var entries = sold.GroupBy(x => x.Cargo,
|
||||||
|
(key, cargos) => new {
|
||||||
|
Cargo = key,
|
||||||
|
Markets = cargos.GroupBy(y => y.Market,
|
||||||
|
(market, markets) => new {
|
||||||
|
Market = market,
|
||||||
|
Amount = markets.Sum(x => x.Amount),
|
||||||
|
Profit = markets.Sum(x => x.Profit)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
foreach (var cargo in entries) {
|
||||||
|
foreach (var market in cargo.Markets) {
|
||||||
|
builder.AppendFormat("Sold {0} {1} to the {2}",
|
||||||
|
market.Amount,
|
||||||
|
cargo.Cargo,
|
||||||
|
market.Market
|
||||||
|
);
|
||||||
|
|
||||||
|
if (market.Profit != 0) {
|
||||||
|
builder.AppendFormat(" ({0} {1})",
|
||||||
|
Credits.FormatCredits(market.Profit),
|
||||||
|
market.Profit < 0 ? "loss" : "profit"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.Append("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.AppendFormat("\n");
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
BGS/LogGenerator/CartographicsFormat.cs
Normal file
21
BGS/LogGenerator/CartographicsFormat.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using EDJournal;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class CartographicsFormat : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
var total = objective.LogEntries.OfType<Cartographics>();
|
||||||
|
var pages = total.Count();
|
||||||
|
long sum = total.Sum(x => (x as Cartographics).TotalSum);
|
||||||
|
|
||||||
|
if (pages <= 0 || sum <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Format("Sold {0} page(s) worth of universal cartographics\n" +
|
||||||
|
"(Total value: {1})\n\n",
|
||||||
|
pages, Credits.FormatCredits(sum)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
BGS/LogGenerator/CombatZoneFormat.cs
Normal file
4
BGS/LogGenerator/CombatZoneFormat.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
class CombatZoneFormat : GenericFormat<CombatZone> {
|
||||||
|
}
|
||||||
|
}
|
29
BGS/LogGenerator/FailedMissionFormat.cs
Normal file
29
BGS/LogGenerator/FailedMissionFormat.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using EDJournal;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class FailedMissionFormat : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
MissionFailed[] missions = objective.LogEntries.OfType<MissionFailed>().ToArray();
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
|
||||||
|
if (missions.Length <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MissionFailed failed in missions) {
|
||||||
|
MissionFailedEntry f = failed.Failed;
|
||||||
|
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
||||||
|
failed.Amount,
|
||||||
|
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
||||||
|
failed.Faction
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.Append("\n");
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
BGS/LogGenerator/KillBondsFormat.cs
Normal file
4
BGS/LogGenerator/KillBondsFormat.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class KillBondsFormat : GenericFormat<FactionKillBonds> {
|
||||||
|
}
|
||||||
|
}
|
4
BGS/LogGenerator/MarketBuyFormat.cs
Normal file
4
BGS/LogGenerator/MarketBuyFormat.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class MarketBuyFormat : GenericFormat<BuyCargo> {
|
||||||
|
}
|
||||||
|
}
|
18
BGS/LogGenerator/MicroResourcesFormat.cs
Normal file
18
BGS/LogGenerator/MicroResourcesFormat.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using EDJournal;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class MicroResourcesFormat : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
var total = objective.LogEntries.OfType<SellMicroResources>();
|
||||||
|
long sum = total.Sum(x => x.TotalSum);
|
||||||
|
|
||||||
|
if (total == null || total.Count() <= 0 || sum <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Format("Sold {0} worth of Micro Resources\n",
|
||||||
|
Credits.FormatCredits(sum));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
63
BGS/LogGenerator/MissionFormat.cs
Normal file
63
BGS/LogGenerator/MissionFormat.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class MissionFormat : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
Dictionary<string, Dictionary<string, int>> collated = new Dictionary<string, Dictionary<string, int>>();
|
||||||
|
StringBuilder output = new StringBuilder();
|
||||||
|
int total_influence = 0;
|
||||||
|
|
||||||
|
var missions = objective.LogEntries.OfType<MissionCompleted>();
|
||||||
|
|
||||||
|
if (missions == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MissionCompleted m in missions) {
|
||||||
|
if (!collated.ContainsKey(m.MissionName)) {
|
||||||
|
collated[m.MissionName] = new Dictionary<string, int>();
|
||||||
|
}
|
||||||
|
if (!collated[m.MissionName].ContainsKey(m.Influence)) {
|
||||||
|
collated[m.MissionName][m.Influence] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
++collated[m.MissionName][m.Influence];
|
||||||
|
|
||||||
|
total_influence += m.Influence.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var mission in collated) {
|
||||||
|
if (objective.Faction != null) {
|
||||||
|
output.AppendFormat("{0} for {1}\n", mission.Key, objective.Faction);
|
||||||
|
} else {
|
||||||
|
output.AppendFormat("{0}\n", mission.Key);
|
||||||
|
}
|
||||||
|
output.Append("(");
|
||||||
|
foreach (var influence in mission.Value.OrderBy(x => x.Key.Length)) {
|
||||||
|
output.AppendFormat("Inf{0} x{1}, ", influence.Key, influence.Value);
|
||||||
|
}
|
||||||
|
output.Remove(output.Length - 2, 2); // remove last ", "
|
||||||
|
output.Append(")\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
var support = objective.LogEntries.OfType<InfluenceSupport>();
|
||||||
|
foreach (InfluenceSupport inf in support) {
|
||||||
|
output.Append(inf.ToString());
|
||||||
|
output.Append("\n");
|
||||||
|
total_influence += inf.Influence.Length;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support.Count() > 0) {
|
||||||
|
output.Append("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (total_influence > 0) {
|
||||||
|
output.AppendFormat("Total Influence: {0}", total_influence);
|
||||||
|
}
|
||||||
|
|
||||||
|
return output.ToString().Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
BGS/LogGenerator/MurderFormat.cs
Normal file
4
BGS/LogGenerator/MurderFormat.cs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class MurderFormat : GenericFormat<FoulMurder> {
|
||||||
|
}
|
||||||
|
}
|
24
BGS/LogGenerator/VoucherFormat.cs
Normal file
24
BGS/LogGenerator/VoucherFormat.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using EDJournal;
|
||||||
|
|
||||||
|
namespace EliteBGS.BGS.LogGenerator {
|
||||||
|
public class VoucherFormat : LogFormatter {
|
||||||
|
public string GenerateLog(Objective objective) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
var missions = objective.LogEntries.OfType<Vouchers>();
|
||||||
|
|
||||||
|
if (missions == null || missions.Count() <= 0) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var m in missions) {
|
||||||
|
builder.AppendFormat("Handed in {0} vouchers for {1}\n", m.Type, m.Faction);
|
||||||
|
builder.AppendFormat("(Total value: {0})\n", Credits.FormatCredits(m.TotalSum));
|
||||||
|
builder.AppendFormat("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,18 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using EDJournal;
|
using EDJournal;
|
||||||
using EliteBGS.BGS.LogGenerator;
|
|
||||||
|
|
||||||
namespace EliteBGS.BGS {
|
namespace EliteBGS.BGS {
|
||||||
public class NonaDiscordLog : IDiscordLogGenerator {
|
public class NonaDiscordLog : DiscordLogGenerator {
|
||||||
private List<LogFormatter> formatters = new List<LogFormatter>() {
|
|
||||||
new VistaGenomicsFormat(),
|
|
||||||
new SearchAndRescueFormat(),
|
|
||||||
};
|
|
||||||
|
|
||||||
private string FormatDate() {
|
private string FormatDate() {
|
||||||
CultureInfo cultureInfo = CultureInfo.InvariantCulture;
|
CultureInfo cultureInfo = CultureInfo.InvariantCulture;
|
||||||
StringBuilder date = new StringBuilder();
|
StringBuilder date = new StringBuilder();
|
||||||
@ -36,330 +28,28 @@ namespace EliteBGS.BGS {
|
|||||||
return date.ToString();
|
return date.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private string BuildCartoGraphics(Objective objective) {
|
protected override string GenerateObjectiveHeader(Objective objective) {
|
||||||
var total = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(Cartographics)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
var pages = total.Count();
|
|
||||||
var sum = total.Sum(x => (x as Cartographics).TotalSum);
|
|
||||||
|
|
||||||
if (pages <= 0 || sum <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format("Sold {0} page(s) worth of universal cartographics\n" +
|
|
||||||
"(Total value: {1})\n\n",
|
|
||||||
pages, Credits.FormatCredits(sum)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildCargoSold(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
SellCargo[] sold = objective.LogEntries
|
|
||||||
.OfType<SellCargo>()
|
|
||||||
.ToArray()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (sold == null || sold.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// This groups everything together by cargo sold, and then by market sold to.
|
|
||||||
// Dictionary<string Cargo, Dictionary<string Market, { Market, Amount, Profit }> >
|
|
||||||
var entries = sold.GroupBy(x => x.Cargo,
|
|
||||||
(key, cargos) => new {
|
|
||||||
Cargo = key,
|
|
||||||
Markets = cargos.GroupBy(y => y.Market,
|
|
||||||
(market, markets) => new {
|
|
||||||
Market = market,
|
|
||||||
Amount = markets.Sum(x => x.Amount),
|
|
||||||
Profit = markets.Sum(x => x.Profit)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
foreach (var cargo in entries) {
|
|
||||||
foreach (var market in cargo.Markets) {
|
|
||||||
builder.AppendFormat("Sold {0} {1} to the {2}",
|
|
||||||
market.Amount,
|
|
||||||
cargo.Cargo,
|
|
||||||
market.Market
|
|
||||||
);
|
|
||||||
|
|
||||||
if (market.Profit != 0) {
|
|
||||||
builder.AppendFormat(" ({0} {1})",
|
|
||||||
Credits.FormatCredits(market.Profit),
|
|
||||||
market.Profit < 0 ? "loss" : "profit"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.AppendFormat("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMicroResourcesSold(Objective objective) {
|
|
||||||
var total = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(SellMicroResources)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
var sum = total.Sum(x => (x as SellMicroResources).TotalSum);
|
|
||||||
|
|
||||||
if (sum <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format("Sold {0} worth of Micro Resources\n",
|
|
||||||
Credits.FormatCredits(sum));
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildKillBonds(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
FactionKillBonds[] bonds = objective.LogEntries
|
|
||||||
.OfType<FactionKillBonds>()
|
|
||||||
.ToArray()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (bonds == null || bonds.Length == 0) {
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FactionKillBonds bond in bonds) {
|
|
||||||
builder.AppendFormat("{0}\n", bond.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.AppendFormat("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildVouchers(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
var missions = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(Vouchers)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
|
|
||||||
if (missions == null || missions.Count() <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var mission in missions) {
|
|
||||||
var m = mission as Vouchers;
|
|
||||||
builder.AppendFormat("Handed in {0} vouchers for {1}\n", m.Type, m.Faction);
|
|
||||||
builder.AppendFormat("(Total value: {0})\n", Credits.FormatCredits(m.TotalSum));
|
|
||||||
builder.AppendFormat("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMissionList(Objective objective) {
|
|
||||||
Dictionary<string, Dictionary<string, int>> collated = new Dictionary<string, Dictionary<string, int>>();
|
|
||||||
StringBuilder output = new StringBuilder();
|
|
||||||
int total_influence = 0;
|
|
||||||
|
|
||||||
var missions = from entries in objective.LogEntries
|
|
||||||
where entries.GetType() == typeof(MissionCompleted)
|
|
||||||
select entries
|
|
||||||
;
|
|
||||||
|
|
||||||
if (missions == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (MissionCompleted m in missions) {
|
|
||||||
if (!collated.ContainsKey(m.MissionName)) {
|
|
||||||
collated[m.MissionName] = new Dictionary<string, int>();
|
|
||||||
}
|
|
||||||
if (!collated[m.MissionName].ContainsKey(m.Influence)) {
|
|
||||||
collated[m.MissionName][m.Influence] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
++collated[m.MissionName][m.Influence];
|
|
||||||
|
|
||||||
total_influence += m.Influence.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var mission in collated) {
|
|
||||||
if (objective.Faction != null) {
|
|
||||||
output.AppendFormat("{0} for {1}\n", mission.Key, objective.Faction);
|
|
||||||
} else {
|
|
||||||
output.AppendFormat("{0}\n", mission.Key);
|
|
||||||
}
|
|
||||||
output.Append("(");
|
|
||||||
foreach (var influence in mission.Value.OrderBy(x => x.Key.Length)) {
|
|
||||||
output.AppendFormat("Inf{0} x{1}, ", influence.Key, influence.Value);
|
|
||||||
}
|
|
||||||
output.Remove(output.Length - 2, 2); // remove last ", "
|
|
||||||
output.Append(")\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
var support = objective.LogEntries.OfType<InfluenceSupport>();
|
|
||||||
foreach (InfluenceSupport inf in support) {
|
|
||||||
output.Append(inf.ToString());
|
|
||||||
output.Append("\n");
|
|
||||||
total_influence += inf.Influence.Length;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (support.Count() > 0) {
|
|
||||||
output.Append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (total_influence > 0) {
|
|
||||||
output.AppendFormat("Total Influence: {0}\n\n", total_influence);
|
|
||||||
}
|
|
||||||
|
|
||||||
return output.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildCombatZones(Objective objective) {
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
CombatZone[] zones = objective.LogEntries
|
|
||||||
.OfType<CombatZone>()
|
|
||||||
.ToArray()
|
|
||||||
;
|
|
||||||
|
|
||||||
if (zones == null || zones.Length == 0) {
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (CombatZone zone in zones) {
|
|
||||||
builder.AppendFormat("{0}\n", zone.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
private string BuildFailedMissions(Objective objective) {
|
|
||||||
MissionFailed[] missions = objective.LogEntries.OfType<MissionFailed>().ToArray();
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
if (missions.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (MissionFailed failed in missions) {
|
|
||||||
MissionFailedEntry f = failed.Failed;
|
|
||||||
builder.AppendFormat("Failed {0} mission(s) \"{1}\" targeting {2}\n",
|
|
||||||
failed.Amount,
|
|
||||||
f.HumanReadableName == null ? f.Name : f.HumanReadableName,
|
|
||||||
failed.Faction
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMurders(Objective objective) {
|
|
||||||
FoulMurder[] murders = objective.LogEntries.OfType<FoulMurder>().ToArray();
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
if (murders.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (FoulMurder murder in murders) {
|
|
||||||
builder.Append(murder.ToString());
|
|
||||||
builder.Append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private string BuildMarketBuy(Objective objective) {
|
|
||||||
BuyCargo[] buys = objective.LogEntries.OfType<BuyCargo>().ToArray();
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
if (buys.Length <= 0) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (BuyCargo buy in buys) {
|
|
||||||
builder.Append(buy.ToString());
|
|
||||||
builder.Append("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.Append("\n");
|
|
||||||
|
|
||||||
return builder.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GenerateDiscordLog(Report report) {
|
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
|
|
||||||
log.AppendFormat(":clock2: `Date:` {0}\n", FormatDate());
|
log.AppendFormat(":globe_with_meridians: `Location:` {0}\n", objective.ToShortString());
|
||||||
foreach (var objective in report.Objectives) {
|
log.Append(":clipboard: `Conducted:`\n");
|
||||||
if (objective.LogEntries.Count <= 0) {
|
log.Append("```");
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!objective.IsEnabled) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
log.AppendFormat(":globe_with_meridians: `Location:` {0}\n", objective.ToShortString());
|
|
||||||
log.Append(":clipboard: `Conducted:`\n");
|
|
||||||
log.Append("```\n");
|
|
||||||
|
|
||||||
StringBuilder entries = new StringBuilder();
|
|
||||||
|
|
||||||
var missions = BuildMissionList(objective);
|
|
||||||
entries.Append(missions);
|
|
||||||
|
|
||||||
var failed = BuildFailedMissions(objective);
|
|
||||||
entries.Append(failed);
|
|
||||||
|
|
||||||
var murders = BuildMurders(objective);
|
|
||||||
entries.Append(murders);
|
|
||||||
|
|
||||||
var vouchers = BuildVouchers(objective);
|
|
||||||
entries.Append(vouchers);
|
|
||||||
|
|
||||||
var zones = BuildCombatZones(objective);
|
|
||||||
entries.Append(zones);
|
|
||||||
|
|
||||||
var bonds = BuildKillBonds(objective);
|
|
||||||
entries.Append(bonds);
|
|
||||||
|
|
||||||
var carto = BuildCartoGraphics(objective);
|
|
||||||
entries.Append(carto);
|
|
||||||
|
|
||||||
var micro = BuildMicroResourcesSold(objective);
|
|
||||||
entries.Append(micro);
|
|
||||||
|
|
||||||
var buy = BuildMarketBuy(objective);
|
|
||||||
entries.Append(buy);
|
|
||||||
|
|
||||||
var sold = BuildCargoSold(objective);
|
|
||||||
entries.Append(sold);
|
|
||||||
|
|
||||||
foreach (LogFormatter formatter in formatters) {
|
|
||||||
string text = formatter.GenerateLog(objective);
|
|
||||||
if (!string.IsNullOrEmpty(text)) {
|
|
||||||
entries.AppendFormat("{0}\n", text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Append(entries.ToString().Trim());
|
|
||||||
log.Append("\n```\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return log.ToString();
|
return log.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string GenerateObjectiveFooter(Objective objective) {
|
||||||
|
return "```";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GenerateHeader() {
|
||||||
|
return string.Format(":clock2: `Date:` {0}", FormatDate());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string GenerateFooter() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
return "Nova Navy Log";
|
return "Nova Navy Log";
|
||||||
}
|
}
|
||||||
|
@ -85,10 +85,20 @@
|
|||||||
<Compile Include="BGS\FoulMurder.cs" />
|
<Compile Include="BGS\FoulMurder.cs" />
|
||||||
<Compile Include="BGS\GenericDiscordLog.cs" />
|
<Compile Include="BGS\GenericDiscordLog.cs" />
|
||||||
<Compile Include="BGS\InfluenceSupport.cs" />
|
<Compile Include="BGS\InfluenceSupport.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\CargoSoldFormatter.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\CartographicsFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\CombatZoneFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\FailedMissionFormat.cs" />
|
||||||
<Compile Include="BGS\LogGenerator\GenericFormat.cs" />
|
<Compile Include="BGS\LogGenerator\GenericFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\KillBondsFormat.cs" />
|
||||||
<Compile Include="BGS\LogGenerator\LogFormatter.cs" />
|
<Compile Include="BGS\LogGenerator\LogFormatter.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\MarketBuyFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\MicroResourcesFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\MissionFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\MurderFormat.cs" />
|
||||||
<Compile Include="BGS\LogGenerator\SearchAndRescueFormat.cs" />
|
<Compile Include="BGS\LogGenerator\SearchAndRescueFormat.cs" />
|
||||||
<Compile Include="BGS\LogGenerator\VistaGenomicsFormat.cs" />
|
<Compile Include="BGS\LogGenerator\VistaGenomicsFormat.cs" />
|
||||||
|
<Compile Include="BGS\LogGenerator\VoucherFormat.cs" />
|
||||||
<Compile Include="BGS\MissionFailed.cs" />
|
<Compile Include="BGS\MissionFailed.cs" />
|
||||||
<Compile Include="BGS\NonaDiscordLog.cs" />
|
<Compile Include="BGS\NonaDiscordLog.cs" />
|
||||||
<Compile Include="BGS\BuyCargo.cs" />
|
<Compile Include="BGS\BuyCargo.cs" />
|
||||||
|
@ -31,7 +31,7 @@ namespace EliteBGS {
|
|||||||
|
|
||||||
private LoadEntriesWindow loadentries = new LoadEntriesWindow();
|
private LoadEntriesWindow loadentries = new LoadEntriesWindow();
|
||||||
|
|
||||||
private static readonly List<IDiscordLogGenerator> logtypes = new List<IDiscordLogGenerator>() {
|
private static readonly List<DiscordLogGenerator> logtypes = new List<DiscordLogGenerator>() {
|
||||||
new NonaDiscordLog(),
|
new NonaDiscordLog(),
|
||||||
new GenericDiscordLog(),
|
new GenericDiscordLog(),
|
||||||
};
|
};
|
||||||
@ -49,7 +49,7 @@ namespace EliteBGS {
|
|||||||
|
|
||||||
report.OnLog += Report_OnLog;
|
report.OnLog += Report_OnLog;
|
||||||
|
|
||||||
foreach (IDiscordLogGenerator type in logtypes) {
|
foreach (DiscordLogGenerator type in logtypes) {
|
||||||
LogType.Items.Add(type);
|
LogType.Items.Add(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ namespace EliteBGS {
|
|||||||
|
|
||||||
private void GenerateDiscord_Click(object sender, RoutedEventArgs e) {
|
private void GenerateDiscord_Click(object sender, RoutedEventArgs e) {
|
||||||
try {
|
try {
|
||||||
IDiscordLogGenerator discord = LogType.SelectedItem as IDiscordLogGenerator;
|
DiscordLogGenerator discord = LogType.SelectedItem as DiscordLogGenerator;
|
||||||
string report = discord.GenerateDiscordLog(Report);
|
string report = discord.GenerateDiscordLog(Report);
|
||||||
|
|
||||||
DiscordLog.Text = report;
|
DiscordLog.Text = report;
|
||||||
|
Loading…
Reference in New Issue
Block a user