allow a choice whether to collate entries
This commit is contained in:
parent
ed26c48f5f
commit
03e7fcbc15
@ -49,7 +49,7 @@ namespace EliteBGS.BGS {
|
||||
;
|
||||
}
|
||||
|
||||
public void Scan(PlayerJournal journal, DateTime start, DateTime end) {
|
||||
public void Scan(PlayerJournal journal, DateTime start, DateTime end, bool CollateEntries = true) {
|
||||
/* Log files only get rotated if you restart the game client. This means that there might
|
||||
* be - say - entries from the 4th of May in the file with a timestamp of 3rd of May. This
|
||||
* happens if you happen to play a session late into the night.
|
||||
@ -72,10 +72,10 @@ namespace EliteBGS.BGS {
|
||||
.Where(e => e.Timestamp >= start && e.Timestamp < actualend)
|
||||
.ToList()
|
||||
;
|
||||
Scan(entries);
|
||||
Scan(entries, CollateEntries);
|
||||
}
|
||||
|
||||
public void Scan(List<Entry> entries) {
|
||||
public void Scan(List<Entry> entries, bool CollateEntries = true) {
|
||||
if (entries.Count <= 0) {
|
||||
return;
|
||||
}
|
||||
@ -198,7 +198,7 @@ namespace EliteBGS.BGS {
|
||||
System = current_system,
|
||||
Faction = faction,
|
||||
});
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.MissionCompleted)) {
|
||||
MissionCompletedEntry completed = e as MissionCompletedEntry;
|
||||
MissionAcceptedEntry accepted = null;
|
||||
@ -411,7 +411,7 @@ namespace EliteBGS.BGS {
|
||||
|
||||
/* Mission failed should be collated if they are in the same system/station
|
||||
*/
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.SellExplorationData)) {
|
||||
results.Add(new Cartographics(e as SellExplorationDataEntry) {
|
||||
System = current_system,
|
||||
@ -420,7 +420,7 @@ namespace EliteBGS.BGS {
|
||||
});
|
||||
|
||||
/* colate single cartographic selling into one */
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.SellOrganicData)) {
|
||||
/* organic data sold to Vista Genomics */
|
||||
results.Add(new OrganicData(e as SellOrganicDataEntry) {
|
||||
@ -429,7 +429,7 @@ namespace EliteBGS.BGS {
|
||||
Faction = controlling_faction,
|
||||
});
|
||||
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.MultiSellExplorationData)) {
|
||||
/* For multi-sell-exploraton-data only the controlling faction of the station sold to matters.
|
||||
*/
|
||||
@ -439,7 +439,7 @@ namespace EliteBGS.BGS {
|
||||
Faction = controlling_faction
|
||||
});
|
||||
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.RedeemVoucher)) {
|
||||
RedeemVoucherEntry voucher = e as RedeemVoucherEntry;
|
||||
List<Faction> current_factions = new List<Faction>();
|
||||
@ -470,7 +470,7 @@ namespace EliteBGS.BGS {
|
||||
});
|
||||
}
|
||||
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.SellMicroResources)) {
|
||||
results.Add(new SellMicroResources(e as SellMicroResourcesEntry) {
|
||||
Faction = controlling_faction,
|
||||
@ -490,7 +490,7 @@ namespace EliteBGS.BGS {
|
||||
System = current_system,
|
||||
});
|
||||
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.SearchAndRescue)) {
|
||||
results.Add(new SearchAndRescue(e as SearchAndRescueEntry) {
|
||||
Faction = controlling_faction,
|
||||
@ -498,7 +498,7 @@ namespace EliteBGS.BGS {
|
||||
System = current_system,
|
||||
});
|
||||
|
||||
collate = true;
|
||||
collate = CollateEntries;
|
||||
} else if (e.Is(Events.MarketSell)) {
|
||||
MarketSellEntry sell = e as MarketSellEntry;
|
||||
long profit = 0;
|
||||
|
@ -50,6 +50,8 @@
|
||||
<Label Content="To:" Height="26.2857142857143" VerticalAlignment="Top"/>
|
||||
<DatePicker x:Name="enddate" Height="26.2857142857143" VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
|
||||
<CheckBox x:Name="collate" Margin="1" Content="Collate entries" IsChecked="True" IsThreeState="False"/>
|
||||
<Separator Margin="1" VerticalAlignment="Center" MinWidth="1" HorizontalAlignment="Center" MinHeight="22"/>
|
||||
<Button x:Name="ManuallyParse" Content="Manually Parse JSON" Click="ManuallyParse_Click" />
|
||||
</ToolBar>
|
||||
<TreeView x:Name="entries" Margin="0,0,0,0" Grid.ColumnSpan="3" Grid.Row="2" KeyUp="entries_KeyUp">
|
||||
|
@ -110,10 +110,11 @@ namespace EliteBGS {
|
||||
|
||||
private void ParseJournal_Click(object sender, RoutedEventArgs e) {
|
||||
try {
|
||||
bool collate = (this.collate.IsChecked ?? true);
|
||||
journal.Open(); // Load all files
|
||||
var start = startdate.SelectedDate ?? DateTime.Now;
|
||||
var end = enddate.SelectedDate ?? DateTime.Now;
|
||||
report.Scan(journal, start, end);
|
||||
report.Scan(journal, start, end, collate);
|
||||
RefreshObjectives();
|
||||
} catch (Exception exception) {
|
||||
Log("Something went terribly wrong while parsing the E:D player journal.");
|
||||
|
Loading…
Reference in New Issue
Block a user