EliteBGS/BGS/LogGenerator/FailedMissionFormat.cs

33 lines
1001 B
C#

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>()
.Where(x => x.IsEnabled)
.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
);
}
return builder.ToString().Trim();
}
}
}