Florian Stinglmayr
bf401db483
This cleans up the logs, especially since failed missions don't show a lot of detailed information.
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System.Text;
|
|
using EDJournal;
|
|
|
|
namespace EliteBGS.BGS {
|
|
public class MissionFailed : LogEntry {
|
|
public MissionFailedEntry Failed { get; set; }
|
|
public MissionAcceptedEntry Accepted { get; set; }
|
|
|
|
public MissionFailed(MissionAcceptedEntry accepted) {
|
|
Accepted = accepted;
|
|
Faction = accepted.Faction;
|
|
}
|
|
|
|
public override int CompareTo(LogEntry other) {
|
|
if (other.GetType() != typeof(MissionFailed)) {
|
|
return -1;
|
|
}
|
|
|
|
MissionFailed failed = other as MissionFailed;
|
|
|
|
/* if it is the same mission name, the same faction and the same system,
|
|
* collate mission failures together */
|
|
if (failed.Failed.HumanReadableName == Failed.HumanReadableName &&
|
|
failed.Faction == Faction &&
|
|
failed.System == System) {
|
|
return 0;
|
|
}
|
|
|
|
return -1;
|
|
}
|
|
|
|
public override string ToString() {
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
if (Failed == null || Accepted == null) {
|
|
return "";
|
|
}
|
|
|
|
builder.AppendFormat("{0}x Mission failed: \"{1}\"",
|
|
Entries.Count,
|
|
Failed.HumanReadableName != null ? Failed.HumanReadableName : Failed.Name
|
|
);
|
|
|
|
return builder.ToString();
|
|
}
|
|
}
|
|
}
|