EliteBGS/BGS/SearchAndRescue.cs

50 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using EDJournal;
namespace EliteBGS.BGS {
public class SearchAndRescue : LogEntry {
public SearchAndRescue (SearchAndRescueEntry e) {
Entries.Add(e);
}
public long Count {
get {
return Entries.OfType<SearchAndRescueEntry>().Sum(x => x.Count);
}
}
public string NameLocalised {
get {
return Entries.OfType<SearchAndRescueEntry>().First().NameLocalised;
}
}
public override int CompareTo(LogEntry o) {
if (o == null || o.GetType() != typeof(SearchAndRescue)) {
return -1;
}
SearchAndRescue other = o as SearchAndRescue;
if (other.System == System &&
other.Station == Station &&
other.Faction == Faction &&
other.NameLocalised == NameLocalised) {
return 0;
}
return -1;
}
public override string ToString() {
return string.Format("Contributed {0} {1} to Search and Rescue", Count, NameLocalised);
}
public override bool OnlyControllingFaction => true;
}
}