add setting to ignore influence support

This commit is contained in:
Florian Stinglmayr 2023-03-29 18:40:36 +02:00
parent f666a2c7c5
commit e39dd6ffda
3 changed files with 32 additions and 3 deletions

View File

@ -163,6 +163,7 @@
<TabItem Header="Settings"> <TabItem Header="Settings">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
@ -201,6 +202,19 @@
<ComboBox x:Name="Colour" IsEditable="False" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Width="Auto" SelectionChanged="Colour_SelectionChanged"/> <ComboBox x:Name="Colour" IsEditable="False" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" Width="Auto" SelectionChanged="Colour_SelectionChanged"/>
</Grid> </Grid>
</GroupBox> </GroupBox>
<GroupBox Header="Advanced Parsing Options" Grid.Row="2" VerticalAlignment="Top" Width="Auto" Grid.ColumnSpan="3" Margin="0,5,0,0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<mah:ToggleSwitch x:Name="NoInfluenceSupport" Grid.Row="1" Grid.ColumnSpan="2" Content="Ignore secondary influence support given out by certain missions" Toggled="NoInfluenceSupport_Toggled"/>
</Grid>
</GroupBox>
</Grid> </Grid>
</TabItem> </TabItem>
<TabItem Header="Event Log"> <TabItem Header="Event Log">

View File

@ -58,6 +58,8 @@ public partial class MainWindow : MetroWindow {
LogType.SelectedIndex = 0; LogType.SelectedIndex = 0;
} }
this.NoInfluenceSupport.IsOn = Config.Global.IgnoreInfluenceSupport;
// Apply theme // Apply theme
try { try {
AddCustomThemes(); AddCustomThemes();
@ -165,8 +167,12 @@ public partial class MainWindow : MetroWindow {
private void HandleEntries(List<Entry> entries, DateTime start, DateTime end) { private void HandleEntries(List<Entry> entries, DateTime start, DateTime end) {
try { try {
TransactionParser parser = new TransactionParser(); TransactionParser parser = new();
List<Transaction> transactions = parser.Parse(entries); TransactionParserOptions options = new();
options.IgnoreInfluenceSupport = Config.Global.IgnoreInfluenceSupport;
List<Transaction> transactions = parser.Parse(entries, options);
// Filter the transactions down to the given time frame // Filter the transactions down to the given time frame
transactions = transactions transactions = transactions
@ -520,4 +526,8 @@ public partial class MainWindow : MetroWindow {
Process.Start(info); Process.Start(info);
e.Handled = true; e.Handled = true;
} }
private void NoInfluenceSupport_Toggled(object sender, RoutedEventArgs e) {
Config.Global.IgnoreInfluenceSupport = this.NoInfluenceSupport.IsOn;
}
} }

View File

@ -34,7 +34,7 @@ namespace EliteBGS.Util {
} }
} }
} }
public string Colour { public string Colour {
get { get {
return colour; return colour;
@ -48,6 +48,11 @@ namespace EliteBGS.Util {
} }
} }
/// <summary>
/// Whether we ignore influence support scenarios form parsing.
/// </summary>
public bool IgnoreInfluenceSupport { get; set; } = false;
[JsonIgnore] [JsonIgnore]
public string FullTheme { public string FullTheme {
get { return Theme + "." + Colour; } get { return Theme + "." + Colour; }