diff --git a/AutoTrackR2/App.xaml.cs b/AutoTrackR2/App.xaml.cs index 2bd9660..115d332 100644 --- a/AutoTrackR2/App.xaml.cs +++ b/AutoTrackR2/App.xaml.cs @@ -7,7 +7,7 @@ namespace AutoTrackR2 /// <summary> /// Interaction logic for App.xaml /// </summary> - public partial class App : Application + public partial class App : System.Windows.Application { } } diff --git a/AutoTrackR2/AutoTrackR2.csproj b/AutoTrackR2/AutoTrackR2.csproj index 4d31b62..e792488 100644 --- a/AutoTrackR2/AutoTrackR2.csproj +++ b/AutoTrackR2/AutoTrackR2.csproj @@ -6,6 +6,7 @@ <Nullable>enable</Nullable> <ImplicitUsings>enable</ImplicitUsings> <UseWPF>true</UseWPF> + <UseWindowsForms>false</UseWindowsForms> <Configurations>Debug;Release;Test</Configurations> <Platforms>AnyCPU;x64</Platforms> <ApplicationIcon>AutoTrackR2.ico</ApplicationIcon> diff --git a/AutoTrackR2/KillTrackR_MainScript.ps1 b/AutoTrackR2/KillTrackR_MainScript.ps1 index e59e0d0..425e82d 100644 --- a/AutoTrackR2/KillTrackR_MainScript.ps1 +++ b/AutoTrackR2/KillTrackR_MainScript.ps1 @@ -483,8 +483,37 @@ function Read-LogEntry { } } +<# # Monitor the log file and process new lines as they are added Get-Content -Path $logFilePath -Wait -Tail 0 | ForEach-Object { Read-LogEntry $_ } -#> \ No newline at end of file +#> + +# Open the log file with shared access for reading and writing +$fileStream = [System.IO.FileStream]::new($logFilePath, [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite) +$reader = [System.IO.StreamReader]::new($fileStream, [System.Text.Encoding]::UTF8) # Ensure we're reading as UTF-8 + +try { + # Move to the end of the file to start monitoring new entries + $reader.BaseStream.Seek(0, [System.IO.SeekOrigin]::End) + + while ($true) { + # Read the next line from the file + $line = $reader.ReadLine() + + # Ensure we have new content to process + if ($line) { + # Process the line (this is where your log entry handler would go) + Read-LogEntry $line + } + + # Sleep for a brief moment to avoid high CPU usage + Start-Sleep -Milliseconds 100 + } +} +finally { + # Ensure we close the reader and file stream properly when done + $reader.Close() + $fileStream.Close() +} \ No newline at end of file diff --git a/AutoTrackR2/MainWindow.xaml.cs b/AutoTrackR2/MainWindow.xaml.cs index 0a982c1..e432e97 100644 --- a/AutoTrackR2/MainWindow.xaml.cs +++ b/AutoTrackR2/MainWindow.xaml.cs @@ -11,6 +11,7 @@ namespace AutoTrackR2 { public partial class MainWindow : Window { + private Dictionary<string, bool> tabStates = new Dictionary<string, bool> { { "HomeTab", true }, // HomeTab is selected by default