From dd4cc8ba5fb5ec2ccde3853d6cbcbbef972aad99 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Thu, 30 Sep 2021 13:28:52 +0200 Subject: [PATCH] do not remove manually added entries --- BGS/LogEntry.cs | 5 +++++ BGS/Objective.cs | 6 ++++++ BGS/Report.cs | 2 +- MainWindow.xaml.cs | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/BGS/LogEntry.cs b/BGS/LogEntry.cs index 4f1c6a7..63aaadb 100644 --- a/BGS/LogEntry.cs +++ b/BGS/LogEntry.cs @@ -11,6 +11,11 @@ namespace NonaBGS.BGS { public string Station { get; set; } public string System { get; set; } public string Faction { get; set; } + /// + /// Whether this entry was manually added. Manually added entries are not deleted + /// when a new scan is made. Instead they are preserved. + /// + public bool ManuallyAdded { get; set; } /// /// Whether this entry only benefits the controlling faction or not, default: no diff --git a/BGS/Objective.cs b/BGS/Objective.cs index e3fad67..5a35db4 100644 --- a/BGS/Objective.cs +++ b/BGS/Objective.cs @@ -16,6 +16,12 @@ namespace NonaBGS.BGS { get => entries; set => entries = value; } + public void Clear() { + if (entries == null) { + return; + } + entries.RemoveAll(x => !x.ManuallyAdded); + } public int Matches(LogEntry e) { int match_count = 0; diff --git a/BGS/Report.cs b/BGS/Report.cs index e4a3742..d9b30ca 100644 --- a/BGS/Report.cs +++ b/BGS/Report.cs @@ -54,7 +54,7 @@ namespace NonaBGS.BGS { string current_station = null; string controlling_faction = null; - this.objectives.ForEach(x => x.LogEntries.Clear()); + objectives.ForEach(x => x.Clear()); foreach (var e in relevant) { LogEntry entry = null; diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 5734fd7..89dcc83 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -264,6 +264,7 @@ namespace NonaBGS { CombatZone zone = new CombatZone(); + zone.ManuallyAdded = true; zone.Faction = objective.Faction; zone.System = objective.System; zone.Station = objective.Station;