diff --git a/.gitignore b/.gitignore index 9491a2f..ec1bbfc 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,7 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd + +### Rider ### +.idea/ \ No newline at end of file diff --git a/AutoTrackR2/ConfigPage.xaml b/AutoTrackR2/ConfigPage.xaml index 2d98288..252ee6b 100644 --- a/AutoTrackR2/ConfigPage.xaml +++ b/AutoTrackR2/ConfigPage.xaml @@ -4,6 +4,7 @@ Height="410" Width="626"> + <Grid Background="{DynamicResource BackgroundLightBrush}"> <!-- Main Layout Grid --> <Grid Margin="0,0,5,7"> diff --git a/AutoTrackR2/ConfigPage.xaml.cs b/AutoTrackR2/ConfigPage.xaml.cs index 9191f75..3803453 100644 --- a/AutoTrackR2/ConfigPage.xaml.cs +++ b/AutoTrackR2/ConfigPage.xaml.cs @@ -515,6 +515,7 @@ namespace AutoTrackR2 private void SaveButton_Click(object sender, RoutedEventArgs e) { + ConfigManager.ApiKey = ApiKey.Password; ConfigManager.ApiUrl = ApiUrl.Text; ConfigManager.LogFile = LogFilePath.Text; @@ -523,7 +524,6 @@ namespace AutoTrackR2 ConfigManager.VideoRecord = (int)VideoRecordSlider.Value; ConfigManager.OfflineMode = (int)OfflineModeSlider.Value; ConfigManager.Theme = (int)ThemeSlider.Value; - // Save the current config values ConfigManager.SaveConfig(); // Start the flashing effect diff --git a/AutoTrackR2/HomePage.xaml.cs b/AutoTrackR2/HomePage.xaml.cs index 3d4b897..9015e65 100644 --- a/AutoTrackR2/HomePage.xaml.cs +++ b/AutoTrackR2/HomePage.xaml.cs @@ -12,10 +12,12 @@ using AutoTrackR2.LogEventHandlers; using System.Timers; using System.Linq; + namespace AutoTrackR2; public partial class HomePage : UserControl { + private LogHandler? _logHandler; private KillHistoryManager _killHistoryManager; private bool _UIEventsRegistered = false; @@ -164,7 +166,6 @@ public partial class HomePage : UserControl if (actorDeathData.VictimPilot != LocalPlayerData.Username) { var playerData = await WebHandler.GetPlayerData(actorDeathData.VictimPilot); - if (playerData != null) { var killData = new KillData @@ -391,7 +392,6 @@ public partial class HomePage : UserControl VisualTreeHelper.GetDpi(this).PixelsPerDip ); } - // Apply the adjusted font size textBlock.FontSize = fontSize; } diff --git a/AutoTrackR2/LogEventHandlers/VehicleDestructionEvent.cs b/AutoTrackR2/LogEventHandlers/VehicleDestructionEvent.cs index 786f46f..5f2a20b 100644 --- a/AutoTrackR2/LogEventHandlers/VehicleDestructionEvent.cs +++ b/AutoTrackR2/LogEventHandlers/VehicleDestructionEvent.cs @@ -19,7 +19,6 @@ public struct VehicleDestructionData public class VehicleDestructionEvent : ILogEventHandler { public Regex Pattern { get; } - public VehicleDestructionEvent() { Pattern = new Regex(""" diff --git a/AutoTrackR2/LogHandler.cs b/AutoTrackR2/LogHandler.cs index ae62e25..9941419 100644 --- a/AutoTrackR2/LogHandler.cs +++ b/AutoTrackR2/LogHandler.cs @@ -12,7 +12,6 @@ public class LogEntry { public DateTime Timestamp { get; set; } public required string? Message { get; set; } - } enum GameProcessState @@ -45,7 +44,7 @@ public class LogHandler new JumpDriveStateChangedEvent(), new RequestJumpFailedEvent() ]; - + public LogHandler(string? logPath) { if (string.IsNullOrEmpty(logPath)) @@ -72,7 +71,6 @@ public class LogHandler // Ensures that any deaths already in log aren't sent to the APIs until the monitor thread is running _eventHandlers.Add(new ActorDeathEvent()); - StartMonitoring(); } @@ -155,7 +153,6 @@ public class LogHandler var process = Process.GetProcesses().FirstOrDefault(p => p.MainWindowTitle == "Star Citizen"); GameProcessState newGameProcessState = process != null ? GameProcessState.Running : GameProcessState.NotRunning; - if (newGameProcessState == GameProcessState.Running && _gameProcessState == GameProcessState.NotRunning) { // Game process went from NotRunning to Running, so reload the Game.log file @@ -167,7 +164,6 @@ public class LogHandler _fileStream = new FileStream(_logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); _reader = new StreamReader(_fileStream); } - _gameProcessState = newGameProcessState; } } \ No newline at end of file diff --git a/AutoTrackR2/MainWindow.xaml.cs b/AutoTrackR2/MainWindow.xaml.cs index 8c0a4e9..2fccd24 100644 --- a/AutoTrackR2/MainWindow.xaml.cs +++ b/AutoTrackR2/MainWindow.xaml.cs @@ -189,6 +189,27 @@ namespace AutoTrackR2 public static int VideoRecord { get; set; } public static int OfflineMode { get; set; } public static int Theme { get; set; } + + static ConfigManager() + { + LoadConfig(); + + // Set default values + // AppData\Local\AutoTrackR2\Kill-log.csv + KillHistoryFile = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "AutoTrackR2", + "Kill-log.csv" + ); + + AHKScriptFolder = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "AutoTrackR2" + ); + + VisorWipeScript = "visorwipe.ahk"; + VideoRecordScript = "videorecord.ahk"; + } static ConfigManager() {