Location Data and CleanUp

This commit is contained in:
BubbaGumpShrump 2025-01-15 22:14:25 -05:00
parent 855963ef39
commit 4c51e15fbd
4 changed files with 33 additions and 2 deletions

View file

@ -7,7 +7,7 @@ namespace AutoTrackR2
/// <summary> /// <summary>
/// Interaction logic for App.xaml /// Interaction logic for App.xaml
/// </summary> /// </summary>
public partial class App : Application public partial class App : System.Windows.Application
{ {
} }
} }

View file

@ -6,6 +6,7 @@
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<UseWindowsForms>false</UseWindowsForms>
<Configurations>Debug;Release;Test</Configurations> <Configurations>Debug;Release;Test</Configurations>
<Platforms>AnyCPU;x64</Platforms> <Platforms>AnyCPU;x64</Platforms>
<ApplicationIcon>AutoTrackR2.ico</ApplicationIcon> <ApplicationIcon>AutoTrackR2.ico</ApplicationIcon>

View file

@ -483,8 +483,37 @@ function Read-LogEntry {
} }
} }
<#
# Monitor the log file and process new lines as they are added # Monitor the log file and process new lines as they are added
Get-Content -Path $logFilePath -Wait -Tail 0 | ForEach-Object { Get-Content -Path $logFilePath -Wait -Tail 0 | ForEach-Object {
Read-LogEntry $_ Read-LogEntry $_
} }
#> #>
# 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()
}

View file

@ -11,6 +11,7 @@ namespace AutoTrackR2
{ {
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private Dictionary<string, bool> tabStates = new Dictionary<string, bool> private Dictionary<string, bool> tabStates = new Dictionary<string, bool>
{ {
{ "HomeTab", true }, // HomeTab is selected by default { "HomeTab", true }, // HomeTab is selected by default