drop station from list, it doesn't matter
This commit is contained in:
parent
03e7fcbc15
commit
19513d50e9
@ -33,7 +33,7 @@ namespace EliteBGS.BGS {
|
|||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
|
|
||||||
log.AppendFormat("**Date:** {0}\n", DateTime.Now.ToString("dd/MM/yyyy"));
|
log.AppendFormat("**Date:** {0}\n", DateTime.Now.ToString("dd/MM/yyyy"));
|
||||||
log.AppendFormat("**Location:** {0}\n", objective.ToShortString());
|
log.AppendFormat("**Location:** {0}\n", objective.ToLocationString());
|
||||||
log.AppendFormat("**Faction:** {0}\n", objective.Faction);
|
log.AppendFormat("**Faction:** {0}\n", objective.Faction);
|
||||||
log.AppendLine("");
|
log.AppendLine("");
|
||||||
log.AppendLine("```");
|
log.AppendLine("```");
|
||||||
|
@ -33,7 +33,7 @@ namespace EliteBGS.BGS {
|
|||||||
protected override string GenerateObjectiveHeader(Objective objective) {
|
protected override string GenerateObjectiveHeader(Objective objective) {
|
||||||
StringBuilder log = new StringBuilder();
|
StringBuilder log = new StringBuilder();
|
||||||
|
|
||||||
log.AppendFormat(":globe_with_meridians: `Location:` {0}\n", objective.ToShortString());
|
log.AppendFormat(":globe_with_meridians: `Location:` {0}\n", objective.ToLocationString());
|
||||||
log.Append(":clipboard: `Conducted:`\n");
|
log.Append(":clipboard: `Conducted:`\n");
|
||||||
log.Append("```");
|
log.Append("```");
|
||||||
|
|
||||||
|
@ -5,37 +5,30 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace EliteBGS.BGS {
|
namespace EliteBGS.BGS {
|
||||||
public class Objective : IComparable<Objective> {
|
public class Objective : IComparable<Objective> {
|
||||||
private string system;
|
|
||||||
private string station;
|
|
||||||
private string faction;
|
|
||||||
|
|
||||||
private List<LogEntry> entries = new List<LogEntry>();
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsEnabled { get; set; }
|
public bool IsEnabled { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public List<LogEntry> Children {
|
public List<LogEntry> Children { get; } = new List<LogEntry>();
|
||||||
get => entries;
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public string Name => this.ToString();
|
public string Name {
|
||||||
|
get { return this.ToString(); }
|
||||||
|
}
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public bool IsExpanded { get; set; }
|
public bool IsExpanded { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public List<LogEntry> LogEntries {
|
public List<LogEntry> LogEntries {
|
||||||
get => entries;
|
get => Children;
|
||||||
set => entries = value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear() {
|
public void Clear() {
|
||||||
if (entries == null) {
|
if (LogEntries == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
entries.RemoveAll(x => !x.ManuallyAdded);
|
LogEntries.RemoveAll(x => !x.ManuallyAdded);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ManuallyAdded { get; set; }
|
public bool ManuallyAdded { get; set; }
|
||||||
@ -49,8 +42,8 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.Faction != null && faction != null) {
|
if (e.Faction != null && Faction != null) {
|
||||||
if (string.Compare(e.Faction, faction, true) != 0) {
|
if (string.Compare(e.Faction, Faction, true) != 0) {
|
||||||
/* if we have a faction, and it doesn't match we don't care.
|
/* if we have a faction, and it doesn't match we don't care.
|
||||||
* faction is the most important comparision, so if it doesn't match
|
* faction is the most important comparision, so if it doesn't match
|
||||||
* it is not the right objective
|
* it is not the right objective
|
||||||
@ -62,18 +55,13 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* system and station only add to the match strength though */
|
/* system and station only add to the match strength though */
|
||||||
if (e.System != null && system != null) {
|
if (e.System != null && System != null) {
|
||||||
if (string.Compare(e.System, system, true) == 0) {
|
if (string.Compare(e.System, System, true) == 0) {
|
||||||
++match_count;
|
++match_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if system and faction already match, station is not so important */
|
/* station does not matter */
|
||||||
if (e.Station != null && station != null) {
|
|
||||||
if (string.Compare(e.Station, station, true) == 0) {
|
|
||||||
++match_count;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return match_count;
|
return match_count;
|
||||||
}
|
}
|
||||||
@ -86,51 +74,36 @@ namespace EliteBGS.BGS {
|
|||||||
|
|
||||||
public bool IsValid => System != null && Faction != null;
|
public bool IsValid => System != null && Faction != null;
|
||||||
|
|
||||||
public string System {
|
public string System { get; set; }
|
||||||
get { return system; }
|
|
||||||
set { system = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Station {
|
public string Station { get; set; }
|
||||||
get { return station; }
|
|
||||||
set { station = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Faction {
|
public string Faction { get; set; }
|
||||||
get { return faction; }
|
|
||||||
set { faction = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() {
|
public override string ToString() {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
if (system != null && system.Length > 0) {
|
if (!string.IsNullOrEmpty(System)) {
|
||||||
str.AppendFormat("System: {0}", system);
|
str.AppendFormat("System: {0}", System);
|
||||||
}
|
}
|
||||||
if (station != null && station.Length > 0) {
|
if (!string.IsNullOrEmpty(Faction)) {
|
||||||
if (str.Length > 0) {
|
if (str.Length > 0) {
|
||||||
str.Append(", ");
|
str.Append(", ");
|
||||||
}
|
}
|
||||||
str.AppendFormat("Station: {0}", station);
|
str.AppendFormat("Faction: {0}", Faction);
|
||||||
}
|
|
||||||
if (faction != null && faction.Length > 0) {
|
|
||||||
if (str.Length > 0) {
|
|
||||||
str.Append(", ");
|
|
||||||
}
|
|
||||||
str.AppendFormat("Faction: {0}", faction);
|
|
||||||
}
|
}
|
||||||
return str.ToString();
|
return str.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ToShortString() {
|
public string ToLocationString() {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
if (system != null && system.Length > 0) {
|
if (!string.IsNullOrEmpty(System)) {
|
||||||
str.AppendFormat("{0}", system);
|
str.AppendFormat("{0}", System);
|
||||||
}
|
}
|
||||||
if (station != null && station.Length > 0) {
|
if (!string.IsNullOrEmpty(Station)) {
|
||||||
if (str.Length > 0) {
|
if (str.Length > 0) {
|
||||||
str.Append(", ");
|
str.Append(", ");
|
||||||
}
|
}
|
||||||
str.AppendFormat("{0}", station);
|
str.AppendFormat("{0}", Station);
|
||||||
}
|
}
|
||||||
return str.ToString();
|
return str.ToString();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user