Compare commits

..

No commits in common. "1693d8882dc99addd91dc80704d34c7f8f7b0f19" and "5405d31ed15ea921c9cceda9e0dba79aaf28d413" have entirely different histories.

View File

@ -11,10 +11,8 @@ using System.Globalization;
using System.Diagnostics; using System.Diagnostics;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using Avalonia.Input; using Avalonia.Input;
using MsBox.Avalonia;
namespace EliteBGS; namespace EliteBGS;
@ -59,9 +57,9 @@ public partial class MainWindow : Window {
LogType.SelectedIndex = 0; LogType.SelectedIndex = 0;
} }
this.NoInfluenceSupport.IsChecked = Config.Global.IgnoreInfluenceSupport; this.NoInfluenceSupport.IsOn = Config.Global.IgnoreInfluenceSupport;
this.NoMarketBuy.IsChecked = Config.Global.IgnoreMarketBuy; this.NoMarketBuy.IsOn = Config.Global.IgnoreMarketBuy;
this.NoFleetCarrier.IsChecked = Config.Global.IgnoreFleetCarrier; this.NoFleetCarrier.IsOn = Config.Global.IgnoreFleetCarrier;
/* /*
// Apply theme // Apply theme
@ -153,8 +151,8 @@ public partial class MainWindow : Window {
// HOCHKULTUR // HOCHKULTUR
startdate.Culture = enddate.Culture = CultureInfo.GetCultureInfo("de-AT"); startdate.Culture = enddate.Culture = CultureInfo.GetCultureInfo("de-AT");
startdate.SelectedDate = today; startdate.SelectedDateTime = today;
enddate.SelectedDate = tomorrow; enddate.SelectedDateTime = tomorrow;
} }
private void TreeView_CheckBox_Updated(object sender, RoutedEventArgs args) { private void TreeView_CheckBox_Updated(object sender, RoutedEventArgs args) {
@ -215,10 +213,7 @@ public partial class MainWindow : Window {
} }
private void HandleEntries(List<Entry> entries) { private void HandleEntries(List<Entry> entries) {
HandleEntries(entries, HandleEntries(entries, startdate.SelectedDateTime ?? DateTime.Now, enddate.SelectedDateTime ?? DateTime.Now);
startdate.SelectedDate?.Date ?? DateTime.Now,
enddate.SelectedDate?.Date ?? DateTime.Now
);
} }
private void Loadentries_EntriesLoaded(List<Entry> lines) { private void Loadentries_EntriesLoaded(List<Entry> lines) {
@ -229,26 +224,21 @@ public partial class MainWindow : Window {
try { try {
TransactionParser parser = new TransactionParser(); TransactionParser parser = new TransactionParser();
DateTime start = startdate.SelectedDate?.Date ?? DateTime.Now; DateTime start = startdate.SelectedDateTime ?? DateTime.Now;
DateTime end = enddate.SelectedDate?.Date ?? DateTime.Now; DateTime end = enddate.SelectedDateTime ?? DateTime.Now;
journal.Open(); // Load all files journal.Open(); // Load all files
// Log files only get rotated if you restart the game // Log files only get rotated if you restart the game client. This means that there might
// client. This means that there might be - say - entries // be - say - entries from the 4th of May in the file with a timestamp of 3rd of May. This
// from the 4th of May in the file with a timestamp of 3rd // happens if you happen to play a session late into the night.
// of May. This happens if you happen to play a session // At first I tried extracting the first and last line of a file to see the date range, but
// late into the night. At first I tried extracting the // if you have a lot of files this becomes quite slow, and quite the memory hog (as journal
// first and last line of a file to see the date range, // files have to be read in their entirety to check this). So we assume that you can't play
// but if you have a lot of files this becomes quite slow, // three days straight, and keep the code fast.
// and quite the memory hog (as journal files have to be
// read in their entirety to check this). So we assume
// that you can't play three days straight, and keep the
// code fast.
DateTime actualstart = start.AddDays(-3); DateTime actualstart = start.AddDays(-3);
DateTime actualend = end.AddDays(1); DateTime actualend = end.AddDays(1);
List<Entry> entries = journal.Files List<Entry> entries = journal.Files
.Where(f => f.NormalisedDateTime >= actualstart && .Where(f => f.NormalisedDateTime >= actualstart && f.NormalisedDateTime <= actualend)
f.NormalisedDateTime <= actualend)
.SelectMany(e => e.Entries) .SelectMany(e => e.Entries)
.ToList() .ToList()
; ;
@ -328,11 +318,15 @@ public partial class MainWindow : Window {
} }
private void browsejournallocation_Click(object sender, RoutedEventArgs e) { private void browsejournallocation_Click(object sender, RoutedEventArgs e) {
// **TODO** var dialog = new VistaFolderBrowserDialog();
//Config.Global.JournalLocation = dialog.SelectedPath; if ((bool)!dialog.ShowDialog()) {
//journallocation.Text = Config.Global.JournalLocation; return;
//journal = new PlayerJournal(Config.Global.JournalLocation); }
Config.Global.JournalLocation = dialog.SelectedPath;
journallocation.Text = Config.Global.JournalLocation;
journal = new PlayerJournal(Config.Global.JournalLocation);
} }
private Objective GetObjectiveFromControl(object sender) { private Objective GetObjectiveFromControl(object sender) {
@ -402,12 +396,8 @@ public partial class MainWindow : Window {
Config.SaveGlobal(); Config.SaveGlobal();
} catch (Exception error) { } catch (Exception error) {
var box = MessageBoxManager var box = MessageBoxManager
.GetMessageBoxStandard( .GetMessageBoxStandard("There was an error saving your settings" + error.Message);
"Error", box.Show();
"There was an error saving your settings" + error.Message
);
var result = box.ShowAsPopupAsync(this);
result.Wait();
} }
} }
@ -519,14 +509,14 @@ public partial class MainWindow : Window {
} }
private void ResetTime_Click(object sender, RoutedEventArgs e) { private void ResetTime_Click(object sender, RoutedEventArgs e) {
DateTime? d = startdate.SelectedDate?.Date; DateTime? d = startdate.SelectedDateTime;
if (d != null) { if (d != null) {
startdate.SelectedDate = ResetTimeToZero(d.Value); startdate.SelectedDateTime = ResetTimeToZero(d.Value);
} }
d = enddate.SelectedDate; d = enddate.SelectedDateTime;
if (d != null) { if (d != null) {
enddate.SelectedDate = ResetTimeToZero(d.Value); enddate.SelectedDateTime = ResetTimeToZero(d.Value);
} }
} }
@ -543,12 +533,12 @@ public partial class MainWindow : Window {
} }
private void UpdateTheme() { private void UpdateTheme() {
//ThemeManager.Current.ChangeTheme(this, Config.Global.FullTheme); ThemeManager.Current.ChangeTheme(this, Config.Global.FullTheme);
} }
private void SwitchTheme_Toggled(object sender, RoutedEventArgs e) { private void SwitchTheme_Toggled(object sender, RoutedEventArgs e) {
ToggleSwitch toggle = sender as ToggleSwitch; ToggleSwitch toggle = sender as ToggleSwitch;
if ((bool)toggle.IsChecked) { if (toggle.IsOn) {
Config.Global.Theme = "Dark"; Config.Global.Theme = "Dark";
} else { } else {
Config.Global.Theme = "Light"; Config.Global.Theme = "Light";
@ -576,15 +566,15 @@ public partial class MainWindow : Window {
*/ */
private void NoInfluenceSupport_Toggled(object sender, RoutedEventArgs e) { private void NoInfluenceSupport_Toggled(object sender, RoutedEventArgs e) {
Config.Global.IgnoreInfluenceSupport = (bool)this.NoInfluenceSupport.IsChecked; Config.Global.IgnoreInfluenceSupport = this.NoInfluenceSupport.IsOn;
} }
private void NoMarketBuy_Toggled(object sender, RoutedEventArgs e) { private void NoMarketBuy_Toggled(object sender, RoutedEventArgs e) {
Config.Global.IgnoreMarketBuy = (bool)this.NoMarketBuy.IsChecked; Config.Global.IgnoreMarketBuy = this.NoMarketBuy.IsOn;
} }
private void NoFleetCarrier_Toggled(object sender, RoutedEventArgs e) { private void NoFleetCarrier_Toggled(object sender, RoutedEventArgs e) {
Config.Global.IgnoreFleetCarrier = (bool)this.NoFleetCarrier.IsChecked; Config.Global.IgnoreFleetCarrier = this.NoFleetCarrier.IsOn;
} }
private void OpenInExplorer_Click(object sender, RoutedEventArgs e) { private void OpenInExplorer_Click(object sender, RoutedEventArgs e) {
@ -685,13 +675,12 @@ public partial class MainWindow : Window {
} catch (Exception) { } catch (Exception) {
var box = MessageBoxManager var box = MessageBoxManager
.GetMessageBoxStandard( .GetMessageBoxStandard(
"Sorry!",
"The log could not be split into discord appropriate length.\n" + "The log could not be split into discord appropriate length.\n" +
"This happens with the bigger logs formats if you do lots of things in one system.\n" + "This happens with the bigger logs formats if you do lots of things in one system.\n" +
"Try posting the log in the OneLine format. " "Try posting the log in the OneLine format.",
"Sorry!"
); );
var result = box.ShowAsPopupAsync(this); box.Show();
result.Wait();
return; return;
} }