Merge pull request from DorkNormalize/bob-fork

Bob fork
This commit is contained in:
DorkNormalize 2025-04-06 18:11:42 -07:00 committed by GitHub
commit f8849daa79
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 1261 additions and 524 deletions

71
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,71 @@
name: Build and Package
on:
push:
branches: [default]
pull_request:
branches: [default]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Extract version
id: version
run: |
$version = (Select-String -Path "AutoTrackR2/UpdatePage.xaml.cs" -Pattern 'currentVersion = "(.+?)"' | Select-Object -First 1).Matches.Groups[1].Value
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: "9.0.x"
- name: Restore dependencies
run: dotnet restore AutoTrackR2.sln
- name: Build
run: dotnet build AutoTrackR2.sln --configuration Release --no-restore
- name: List build output directories
run: |
Write-Host "Listing build output directories:"
Get-ChildItem -Recurse -Directory -Filter "Release" | ForEach-Object { Write-Host $_.FullName }
- name: Create artifacts directory
run: mkdir artifacts
- name: Copy build output
run: |
$releaseDir = Get-ChildItem -Recurse -Directory -Filter "Release" | Select-Object -First 1
if ($releaseDir) {
Write-Host "Copying from: $($releaseDir.FullName)"
Copy-Item "$($releaseDir.FullName)\*" "artifacts\" -Recurse
} else {
Write-Host "No Release directory found"
exit 1
}
- name: Upload application artifact
uses: actions/upload-artifact@v4
with:
name: AutoTrackR2-${{ steps.version.outputs.version }}
path: artifacts/
retention-days: 5
- name: Upload visorwipe script
uses: actions/upload-artifact@v4
with:
name: visorwipe.ahk
path: AutoTrackR2/scripts/visorwipe.ahk
retention-days: 5
- name: Upload videorecord script
uses: actions/upload-artifact@v4
with:
name: videorecord.ahk
path: AutoTrackR2/scripts/videorecord.ahk
retention-days: 5

View file

@ -15,20 +15,30 @@
<Color x:Key="TextColor">#FFFFFF</Color> <Color x:Key="TextColor">#FFFFFF</Color>
<Color x:Key="AltTextColor">#A88F2C</Color> <Color x:Key="AltTextColor">#A88F2C</Color>
<SolidColorBrush x:Key="TextBrush" Color="{DynamicResource TextColor}" /> <SolidColorBrush x:Key="TextBrush"
<SolidColorBrush x:Key="AccentBrush" Color="{DynamicResource AccentColor}" /> Color="{DynamicResource TextColor}"/>
<SolidColorBrush x:Key="BackgroundDarkBrush" Color="{DynamicResource BackgroundDarkColor}" /> <SolidColorBrush x:Key="AccentBrush"
<SolidColorBrush x:Key="BackgroundLightBrush" Color="{DynamicResource BackgroundLightColor}" /> Color="{DynamicResource AccentColor}"/>
<SolidColorBrush x:Key="AltTextBrush" Color="{DynamicResource AltTextColor}" /> <SolidColorBrush x:Key="BackgroundDarkBrush"
Color="{DynamicResource BackgroundDarkColor}"/>
<SolidColorBrush x:Key="BackgroundLightBrush"
Color="{DynamicResource BackgroundLightColor}"/>
<SolidColorBrush x:Key="AltTextBrush"
Color="{DynamicResource AltTextColor}"/>
<!-- Define the Style for Window --> <!-- Define the Style for Window -->
<Style TargetType="Window" x:Key="CustomWindowStyle"> <Style TargetType="Window"
x:Key="CustomWindowStyle">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Window"> <ControlTemplate TargetType="Window">
<Border BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="10" Background="{DynamicResource BackgroundLightBrush}"> <Border BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2"
CornerRadius="10"
Background="{DynamicResource BackgroundLightBrush}">
<Grid> <Grid>
<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> <ContentPresenter HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"/>
</Grid> </Grid>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
@ -37,62 +47,99 @@
</Style> </Style>
<!-- Tab Button Style --> <!-- Tab Button Style -->
<Style x:Key="TabButtonStyle" TargetType="Button"> <Style x:Key="TabButtonStyle"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/> TargetType="Button">
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}"/> <Setter Property="Foreground"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="2"/> <Setter Property="Background"
<Setter Property="Cursor" Value="Hand"/> Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="Padding" Value="10"/> <Setter Property="BorderBrush"
<Setter Property="Margin" Value="5"/> Value="{DynamicResource AccentBrush}"/>
<Setter Property="FontFamily" Value="{StaticResource Orbitron}"/> <Setter Property="BorderThickness"
Value="2"/>
<Setter Property="Cursor"
Value="Hand"/>
<Setter Property="Padding"
Value="10"/>
<Setter Property="Margin"
Value="5"/>
<Setter Property="FontFamily"
Value="{StaticResource Orbitron}"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5"> <Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<!-- ContentPresenter will automatically inherit Foreground from Button --> <!-- ContentPresenter will automatically inherit Foreground from Button -->
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /> <ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<!-- General Button Style --> <!-- General Button Style -->
<Style x:Key="DisabledButtonStyle" TargetType="Button"> <Style x:Key="DisabledButtonStyle"
<Setter Property="Foreground" Value="Gray"/> TargetType="Button">
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}"/> <Setter Property="Foreground"
<Setter Property="BorderBrush" Value="Gray"/> Value="Gray"/>
<Setter Property="BorderThickness" Value="2"/> <Setter Property="Background"
<Setter Property="FontWeight" Value="Bold"/> Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="Cursor" Value="Hand"/> <Setter Property="BorderBrush"
<Setter Property="Padding" Value="5"/> Value="Gray"/>
<Setter Property="BorderThickness"
Value="2"/>
<Setter Property="FontWeight"
Value="Bold"/>
<Setter Property="Cursor"
Value="Hand"/>
<Setter Property="Padding"
Value="5"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5"> <Border Background="{DynamicResource BackgroundDarkBrush}"
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<Style x:Key="ButtonStyle" TargetType="Button"> <Style x:Key="ButtonStyle"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/> TargetType="Button">
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}"/> <Setter Property="Foreground"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="2"/> <Setter Property="Background"
<Setter Property="FontWeight" Value="Bold"/> Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="Cursor" Value="Hand"/> <Setter Property="BorderBrush"
<Setter Property="Padding" Value="5"/> Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="2"/>
<Setter Property="FontWeight"
Value="Bold"/>
<Setter Property="Cursor"
Value="Hand"/>
<Setter Property="Padding"
Value="5"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5"> <Border Background="{DynamicResource BackgroundDarkBrush}"
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
@ -100,69 +147,141 @@
</Style> </Style>
<!-- Title Bar Button Style --> <!-- Title Bar Button Style -->
<Style x:Key="TitleButtonStyle" TargetType="Button"> <Style x:Key="TitleButtonStyle"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/> TargetType="Button">
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}"/> <Setter Property="Foreground"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness" Value="2"/> <Setter Property="Background"
<Setter Property="FontWeight" Value="Bold"/> Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="Cursor" Value="Hand"/> <Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="2"/>
<Setter Property="FontWeight"
Value="Bold"/>
<Setter Property="Cursor"
Value="Hand"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Button"> <ControlTemplate TargetType="Button">
<Border Background="{DynamicResource BackgroundDarkBrush}" <Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}" BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2" BorderThickness="2"
CornerRadius="5" CornerRadius="5"
Margin="0,1,4,1"> Margin="0,1,4,1">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> <ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
<!-- Custom style for text blocks --> <!-- Custom style for text blocks -->
<Style x:Key="RoundedTextBlock" TargetType="TextBlock"> <Style x:Key="RoundedTextBlock"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" /> TargetType="TextBlock">
<Setter Property="FontFamily" Value="{StaticResource Roboto}" /> <Setter Property="Foreground"
<Setter Property="Background" Value="Transparent" /> Value="{DynamicResource TextBrush}"/>
<Setter Property="FontSize" Value="14" /> <Setter Property="FontFamily"
<Setter Property="Padding" Value="10,0,10,0" /> Value="{StaticResource Roboto}"/>
<Setter Property="VerticalAlignment" Value="Center" /> <Setter Property="Background"
<Setter Property="HorizontalAlignment" Value="Stretch" /> Value="Transparent"/>
<Setter Property="FontSize"
Value="14"/>
<Setter Property="Padding"
Value="10,0,10,0"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="HorizontalAlignment"
Value="Stretch"/>
</Style> </Style>
<!-- Wrap TextBlock in Border to apply rounded corners --> <!-- Wrap TextBlock in Border to apply rounded corners -->
<Style x:Key="RoundedTextBlockWithBorder" TargetType="Border"> <Style x:Key="RoundedTextBlockWithBorder"
<Setter Property="Background" Value="{DynamicResource BackgroundLightBrush}"/> TargetType="Border">
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> <Setter Property="Background"
<Setter Property="BorderThickness" Value="2"/> Value="{DynamicResource BackgroundLightBrush}"/>
<Setter Property="CornerRadius" Value="5"/> <Setter Property="BorderBrush"
<Setter Property="Padding" Value="0"/> Value="{DynamicResource AccentBrush}"/>
<Setter Property="Margin" Value="0,10,0,0"/> <Setter Property="BorderThickness"
Value="2"/>
<Setter Property="CornerRadius"
Value="5"/>
<Setter Property="Padding"
Value="0"/>
<Setter Property="Margin"
Value="0,10,0,0"/>
</Style> </Style>
<!-- Custom Style for Rounded TextBox --> <!-- Custom Style for Rounded TextBox -->
<Style x:Key="RoundedTextBox" TargetType="TextBox"> <Style x:Key="RoundedTextBox"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}"/> TargetType="TextBox">
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}"/> <Setter Property="Foreground"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> Value="{DynamicResource TextBrush}"/>
<Setter Property="FontFamily" Value="{StaticResource Roboto}"/> <Setter Property="Background"
<Setter Property="Height" Value="30"/> Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="Padding" Value="5"/> <Setter Property="BorderBrush"
<Setter Property="VerticalContentAlignment" Value="Center"/> Value="{DynamicResource AccentBrush}"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="FontFamily"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> Value="{StaticResource Roboto}"/>
<Setter Property="BorderThickness" Value="2"/> <Setter Property="Height"
Value="30"/>
<Setter Property="Padding"
Value="5"/>
<Setter Property="VerticalContentAlignment"
Value="Center"/>
<Setter Property="HorizontalAlignment"
Value="Stretch"/>
<Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="2"/>
<!-- The actual border with rounded corners --> <!-- The actual border with rounded corners -->
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="TextBox"> <ControlTemplate TargetType="TextBox">
<Border Background="{DynamicResource BackgroundDarkBrush}" <Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}" BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="{TemplateBinding BorderThickness}" BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5"> CornerRadius="5">
<ScrollViewer x:Name="PART_ContentHost"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Custom Style for Rounded PasswordBox -->
<Style x:Key="RoundedPasswordBox"
TargetType="PasswordBox">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="Background"
Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="FontFamily"
Value="{StaticResource Roboto}"/>
<Setter Property="Height"
Value="30"/>
<Setter Property="Padding"
Value="5"/>
<Setter Property="VerticalContentAlignment"
Value="Center"/>
<Setter Property="HorizontalAlignment"
Value="Stretch"/>
<Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="2"/>
<!-- The actual border with rounded corners -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="PasswordBox">
<Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="5">
<ScrollViewer x:Name="PART_ContentHost"/> <ScrollViewer x:Name="PART_ContentHost"/>
</Border> </Border>
</ControlTemplate> </ControlTemplate>
@ -171,39 +290,57 @@
</Style> </Style>
<!-- Custom Style for Slider --> <!-- Custom Style for Slider -->
<Style x:Key="ThreePositionSlider" TargetType="Slider"> <Style x:Key="ThreePositionSlider"
<Setter Property="Height" Value="40" /> TargetType="Slider">
<Setter Property="Width" Value="160" /> <Setter Property="Height"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" /> Value="40"/>
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}" /> <Setter Property="Width"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" /> Value="160"/>
<Setter Property="BorderThickness" Value="2" /> <Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="Background"
Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="2"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Slider"> <ControlTemplate TargetType="Slider">
<Grid Width="200" Height="30" HorizontalAlignment="Left" Margin="58,-6,0,0"> <Grid Width="200"
Height="30"
HorizontalAlignment="Left"
Margin="58,-6,0,0">
<!-- Track Background --> <!-- Track Background -->
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="15" Margin="0,0,-5,-4" /> <Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2"
CornerRadius="15"
Margin="0,0,-5,-4"/>
<!-- Track --> <!-- Track -->
<Track x:Name="PART_Track"> <Track x:Name="PART_Track">
<Track.Thumb> <Track.Thumb>
<Thumb x:Name="PART_Thumb" <Thumb x:Name="PART_Thumb"
Width="22" Width="22"
Height="22" Height="22"
Margin="6,4,1,0"> Margin="6,4,1,0">
<Thumb.Template> <Thumb.Template>
<ControlTemplate TargetType="Thumb"> <ControlTemplate TargetType="Thumb">
<Ellipse Fill="{DynamicResource AccentBrush}" /> <Ellipse Fill="{DynamicResource AccentBrush}"/>
</ControlTemplate> </ControlTemplate>
</Thumb.Template> </Thumb.Template>
</Thumb> </Thumb>
</Track.Thumb> </Track.Thumb>
<Track.DecreaseRepeatButton> <Track.DecreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False"/> <RepeatButton Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</Track.DecreaseRepeatButton> </Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton> <Track.IncreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False"/> <RepeatButton Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</Track.IncreaseRepeatButton> </Track.IncreaseRepeatButton>
</Track> </Track>
</Grid> </Grid>
@ -213,39 +350,56 @@
</Style> </Style>
<!-- Toggle Slider Style --> <!-- Toggle Slider Style -->
<Style x:Key="ToggleSliderStyle" TargetType="Slider"> <Style x:Key="ToggleSliderStyle"
<Setter Property="Height" Value="40" /> TargetType="Slider">
<Setter Property="Width" Value="160" /> <Setter Property="Height"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" /> Value="40"/>
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}" /> <Setter Property="Width"
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" /> Value="160"/>
<Setter Property="BorderThickness" Value="2" /> <Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="Background"
Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="2"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Slider"> <ControlTemplate TargetType="Slider">
<Grid Width="50" Height="30" HorizontalAlignment="Left" > <Grid Width="50"
Height="30"
HorizontalAlignment="Left">
<!-- Track Background --> <!-- Track Background -->
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="15" Margin="0,0,-5,-4" /> <Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2"
CornerRadius="15"
Margin="0,0,-5,-4"/>
<!-- Track --> <!-- Track -->
<Track x:Name="PART_Track"> <Track x:Name="PART_Track">
<Track.Thumb> <Track.Thumb>
<Thumb x:Name="PART_Thumb" <Thumb x:Name="PART_Thumb"
Width="22" Width="22"
Height="22" Height="22"
Margin="6,4,1,0"> Margin="6,4,1,0">
<Thumb.Template> <Thumb.Template>
<ControlTemplate TargetType="Thumb"> <ControlTemplate TargetType="Thumb">
<Ellipse Fill="{DynamicResource AccentBrush}" /> <Ellipse Fill="{DynamicResource AccentBrush}"/>
</ControlTemplate> </ControlTemplate>
</Thumb.Template> </Thumb.Template>
</Thumb> </Thumb>
</Track.Thumb> </Track.Thumb>
<Track.DecreaseRepeatButton> <Track.DecreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False"/> <RepeatButton Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</Track.DecreaseRepeatButton> </Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton> <Track.IncreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False"/> <RepeatButton Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</Track.IncreaseRepeatButton> </Track.IncreaseRepeatButton>
</Track> </Track>
</Grid> </Grid>
@ -255,39 +409,56 @@
</Style> </Style>
<!-- False toggle theme --> <!-- False toggle theme -->
<Style x:Key="FalseToggleStyle" TargetType="Slider"> <Style x:Key="FalseToggleStyle"
<Setter Property="Height" Value="40" /> TargetType="Slider">
<Setter Property="Width" Value="160" /> <Setter Property="Height"
<Setter Property="Foreground" Value="{DynamicResource TextBrush}" /> Value="40"/>
<Setter Property="Background" Value="{DynamicResource BackgroundDarkBrush}" /> <Setter Property="Width"
<Setter Property="BorderBrush" Value="Gray" /> Value="160"/>
<Setter Property="BorderThickness" Value="2" /> <Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="Background"
Value="{DynamicResource BackgroundDarkBrush}"/>
<Setter Property="BorderBrush"
Value="Gray"/>
<Setter Property="BorderThickness"
Value="2"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="Slider"> <ControlTemplate TargetType="Slider">
<Grid Width="50" Height="30" HorizontalAlignment="Left" > <Grid Width="50"
Height="30"
HorizontalAlignment="Left">
<!-- Track Background --> <!-- Track Background -->
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="15" Margin="0,0,-5,-4" /> <Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2"
CornerRadius="15"
Margin="0,0,-5,-4"/>
<!-- Track --> <!-- Track -->
<Track x:Name="PART_Track"> <Track x:Name="PART_Track">
<Track.Thumb> <Track.Thumb>
<Thumb x:Name="PART_Thumb" <Thumb x:Name="PART_Thumb"
Width="22" Width="22"
Height="22" Height="22"
Margin="6,4,1,0"> Margin="6,4,1,0">
<Thumb.Template> <Thumb.Template>
<ControlTemplate TargetType="Thumb"> <ControlTemplate TargetType="Thumb">
<Ellipse Fill="Gray" /> <Ellipse Fill="Gray"/>
</ControlTemplate> </ControlTemplate>
</Thumb.Template> </Thumb.Template>
</Thumb> </Thumb>
</Track.Thumb> </Track.Thumb>
<Track.DecreaseRepeatButton> <Track.DecreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False"/> <RepeatButton Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</Track.DecreaseRepeatButton> </Track.DecreaseRepeatButton>
<Track.IncreaseRepeatButton> <Track.IncreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False"/> <RepeatButton Background="Transparent"
BorderBrush="Transparent"
IsHitTestVisible="False"/>
</Track.IncreaseRepeatButton> </Track.IncreaseRepeatButton>
</Track> </Track>
</Grid> </Grid>
@ -298,15 +469,21 @@
<!-- Modern Rounded ScrollBar Style --> <!-- Modern Rounded ScrollBar Style -->
<Style TargetType="ScrollBar"> <Style TargetType="ScrollBar">
<Setter Property="Width" Value="6" /> <Setter Property="Width"
Value="6"/>
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ScrollBar"> <ControlTemplate TargetType="ScrollBar">
<Grid> <Grid>
<Track Name="PART_Track" IsDirectionReversed="true" Width="6" Margin="0,0,0,0"> <Track Name="PART_Track"
IsDirectionReversed="true"
Width="6"
Margin="0,0,0,0">
<!-- Decrease Repeat Button --> <!-- Decrease Repeat Button -->
<Track.DecreaseRepeatButton> <Track.DecreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="0"> <RepeatButton Background="Transparent"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="0">
<RepeatButton.Template> <RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton"> <ControlTemplate TargetType="RepeatButton">
<Grid x:Name="RepeatButtonGrid"> <Grid x:Name="RepeatButtonGrid">
@ -314,12 +491,18 @@
<VisualStateGroup Name="CommonStates"> <VisualStateGroup Name="CommonStates">
<VisualState Name="Normal"> <VisualState Name="Normal">
<Storyboard> <Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="RepeatButtonGrid" To="1" Duration="0:0:0"/> <DoubleAnimation Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="RepeatButtonGrid"
To="1"
Duration="0:0:0"/>
</Storyboard> </Storyboard>
</VisualState> </VisualState>
<VisualState Name="MouseOver"> <VisualState Name="MouseOver">
<Storyboard> <Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="RepeatButtonGrid" To="0" Duration="0:0:0.1"/> <DoubleAnimation Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="RepeatButtonGrid"
To="0"
Duration="0:0:0.1"/>
</Storyboard> </Storyboard>
</VisualState> </VisualState>
</VisualStateGroup> </VisualStateGroup>
@ -338,10 +521,10 @@
<ControlTemplate TargetType="Thumb"> <ControlTemplate TargetType="Thumb">
<Grid> <Grid>
<Border <Border
Background="{DynamicResource AccentBrush}" Background="{DynamicResource AccentBrush}"
BorderBrush="{DynamicResource AccentBrush}" BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="0" BorderThickness="0"
CornerRadius="3" /> CornerRadius="3"/>
</Grid> </Grid>
</ControlTemplate> </ControlTemplate>
</Thumb.Template> </Thumb.Template>
@ -350,7 +533,9 @@
<!-- Increase Repeat Button --> <!-- Increase Repeat Button -->
<Track.IncreaseRepeatButton> <Track.IncreaseRepeatButton>
<RepeatButton Background="Transparent" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="0"> <RepeatButton Background="Transparent"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="0">
<RepeatButton.Template> <RepeatButton.Template>
<ControlTemplate TargetType="RepeatButton"> <ControlTemplate TargetType="RepeatButton">
<Grid x:Name="RepeatButtonGrid"> <Grid x:Name="RepeatButtonGrid">
@ -358,12 +543,18 @@
<VisualStateGroup Name="CommonStates"> <VisualStateGroup Name="CommonStates">
<VisualState Name="Normal"> <VisualState Name="Normal">
<Storyboard> <Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="RepeatButtonGrid" To="1" Duration="0:0:0"/> <DoubleAnimation Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="RepeatButtonGrid"
To="1"
Duration="0:0:0"/>
</Storyboard> </Storyboard>
</VisualState> </VisualState>
<VisualState Name="MouseOver"> <VisualState Name="MouseOver">
<Storyboard> <Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="RepeatButtonGrid" To="0" Duration="0:0:0.1"/> <DoubleAnimation Storyboard.TargetProperty="Opacity"
Storyboard.TargetName="RepeatButtonGrid"
To="0"
Duration="0:0:0.1"/>
</Storyboard> </Storyboard>
</VisualState> </VisualState>
</VisualStateGroup> </VisualStateGroup>

View file

@ -1,104 +1,236 @@
<UserControl x:Class="AutoTrackR2.ConfigPage" <UserControl x:Class="AutoTrackR2.ConfigPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="410" Width="626"> Height="410"
Width="626">
<Grid Background="{DynamicResource BackgroundLightBrush}">
<!-- Main Layout Grid -->
<Grid Margin="0,0,5,7">
<Grid.RowDefinitions>
<!-- One row for the content, the other for buttons -->
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid Background="{DynamicResource BackgroundLightBrush}">
<!-- Left column for the main content area --> <!-- Main Layout Grid -->
<ColumnDefinition Width="*" /> <Grid Margin="0,0,5,7">
<!-- Right column for the buttons --> <Grid.RowDefinitions>
<ColumnDefinition Width="Auto" /> <!-- One row for the content, the other for buttons -->
</Grid.ColumnDefinitions> <RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Section for Config Fields --> <Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Center" Height="389"> <!-- Left column for the main content area -->
<!-- Log File --> <ColumnDefinition Width="*"/>
<StackPanel Margin="0,10,0,15" Orientation="Horizontal"> <!-- Right column for the buttons -->
<TextBlock Text="ⓘ" ToolTip="Set this to the Game.log file in your StarCitizen\LIVE directory." Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,0,3,5"/> <ColumnDefinition Width="Auto"/>
<TextBlock Text="Log File:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5" FontFamily="{StaticResource Roboto}"/> </Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="30,0,0,0">
<TextBox Name="LogFilePath" Width="330" Height="30" Style="{StaticResource RoundedTextBox}"/>
<Button Content="Browse" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}" Click="LogFileBrowseButton_Click"/>
</StackPanel>
</StackPanel>
<!-- API URL --> <!-- Section for Config Fields -->
<StackPanel Margin="0,0,0,15" Orientation="Horizontal"> <StackPanel Grid.Column="0"
<TextBlock Text="ⓘ" ToolTip="Need a URL? No idea what to do? Contact heavy_bob on Discord!" Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,3,3,5"/> VerticalAlignment="Center"
<TextBlock Text="API URL:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5"/> Height="389">
<StackPanel Orientation="Horizontal" Margin="30,0,0,0"> <!-- Log File -->
<TextBox Name="ApiUrl" Width="330" Height="30" Style="{StaticResource RoundedTextBox}"/> <StackPanel Margin="0,10,0,15"
<Button Content="Test" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}" Click="TestApiButton_Click"/> Orientation="Horizontal">
</StackPanel> <TextBlock Text="ⓘ"
</StackPanel> ToolTip="Set this to the Game.log file in your StarCitizen\LIVE directory."
Foreground="{DynamicResource TextBrush}"
FontSize="20"
Margin="0,0,3,5"/>
<TextBlock Text="Log File:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,5,0,5"
FontFamily="{StaticResource Roboto}"/>
<StackPanel Orientation="Horizontal"
Margin="30,0,0,0">
<TextBox Name="LogFilePath"
Width="330"
Height="30"
Style="{StaticResource RoundedTextBox}"/>
<Button Content="Browse"
Width="75"
Height="30"
FontFamily="{StaticResource Orbitron}"
Margin="5,0"
Style="{StaticResource ButtonStyle}"
Click="LogFileBrowseButton_Click"/>
</StackPanel>
</StackPanel>
<!-- API Key --> <!-- API URL -->
<StackPanel Margin="0,0,0,15" Orientation="Horizontal"> <StackPanel Margin="0,0,0,15"
<TextBlock Text="ⓘ" ToolTip="Need a key? No idea what to do? Contact heavy_bob on Discord!" Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,3,3,5"/> Orientation="Horizontal">
<TextBlock Text="API Key:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5"/> <TextBlock Text="ⓘ"
<TextBox Name="ApiKey" Width="330" Height="30" Margin="33,0,0,0" Style="{StaticResource RoundedTextBox}"/> ToolTip="Need a URL? No idea what to do? Contact heavy_bob on Discord!"
</StackPanel> Foreground="{DynamicResource TextBrush}"
FontSize="20"
Margin="0,3,3,5"/>
<TextBlock Text="API URL:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal"
Margin="30,0,0,0">
<TextBox Name="ApiUrl"
Width="330"
Height="30"
Style="{StaticResource RoundedTextBox}"/>
<Button Content="Test"
Width="75"
Height="30"
FontFamily="{StaticResource Orbitron}"
Margin="5,0"
Style="{StaticResource ButtonStyle}"
Click="TestApiButton_Click"/>
</StackPanel>
</StackPanel>
<!-- Video Path --> <!-- API Key -->
<StackPanel Margin="0,0,0,15" Orientation="Horizontal"> <StackPanel Margin="0,0,0,15"
<TextBlock Text="ⓘ" ToolTip="The directory where your clipping software saves kills. Check the README." Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,3,3,5"/> Orientation="Horizontal">
<TextBlock Text="Video Path:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,5,0,5"/> <TextBlock Text="ⓘ"
<StackPanel Orientation="Horizontal"> ToolTip="Need a key? No idea what to do? Contact heavy_bob on Discord!"
<TextBox Name="VideoPath" Width="330" Height="30" Margin="10,0,0,0" Style="{StaticResource RoundedTextBox}"/> Foreground="{DynamicResource TextBrush}"
<Button Content="Browse" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}" Click="VideoPathBrowseButton_Click"/> FontSize="20"
</StackPanel> Margin="0,3,3,5"/>
</StackPanel> <TextBlock Text="API Key:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,5,0,5"/>
<PasswordBox Name="ApiKey"
Width="330"
Height="30"
Margin="33,0,0,0"
Style="{StaticResource RoundedPasswordBox}"/>
</StackPanel>
<!-- Visor Wipe Toggle Slider --> <!-- Video Path -->
<StackPanel Margin="0,0,0,15" Orientation="Horizontal"> <StackPanel Margin="0,0,0,15"
<TextBlock Text="ⓘ" ToolTip="Perform a Visor Wipe animation on player kill. Requires AHKv2." Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,4,3,5"/> Orientation="Horizontal">
<TextBlock Text="Visor Wipe:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> <TextBlock Text="ⓘ"
<Slider Name="VisorWipeSlider" Minimum="0" Maximum="1" TickFrequency="1" IsSnapToTickEnabled="True" Value="0" Style="{StaticResource ToggleSliderStyle}" Margin="27,-4,0,0" ValueChanged="VisorWipeSlider_ValueChanged"/> ToolTip="The directory where your clipping software saves kills. Check the README."
</StackPanel> Foreground="{DynamicResource TextBrush}"
FontSize="20"
Margin="0,3,3,5"/>
<TextBlock Text="Video Path:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,5,0,5"/>
<StackPanel Orientation="Horizontal">
<TextBox Name="VideoPath"
Width="330"
Height="30"
Margin="10,0,0,0"
Style="{StaticResource RoundedTextBox}"/>
<Button Content="Browse"
Width="75"
Height="30"
FontFamily="{StaticResource Orbitron}"
Margin="5,0"
Style="{StaticResource ButtonStyle}"
Click="VideoPathBrowseButton_Click"/>
</StackPanel>
</StackPanel>
<!-- Video Record Toggle Slider --> <!-- Visor Wipe Toggle Slider -->
<StackPanel Margin="0,0,0,15" Orientation="Horizontal"> <StackPanel Margin="0,0,0,15"
<TextBlock Text="ⓘ" ToolTip="Automatically clip your last kill. Check the README for more info." Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,4,3,5"/> Orientation="Horizontal">
<TextBlock Text="Video Record:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> <TextBlock Text="ⓘ"
<Slider Name="VideoRecordSlider" Minimum="0" Maximum="1" TickFrequency="1" IsSnapToTickEnabled="True" Value="0" Style="{StaticResource ToggleSliderStyle}" Margin="10,-4,0,0" ValueChanged="VideoRecordSlider_ValueChanged"/> ToolTip="Perform a Visor Wipe animation on player kill. Requires AHKv2."
</StackPanel> Foreground="{DynamicResource TextBrush}"
FontSize="20"
Margin="0,4,3,5"/>
<TextBlock Text="Visor Wipe:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,7,0,5"/>
<Slider Name="VisorWipeSlider"
Minimum="0"
Maximum="1"
TickFrequency="1"
IsSnapToTickEnabled="True"
Value="0"
Style="{StaticResource ToggleSliderStyle}"
Margin="27,-4,0,0"
ValueChanged="VisorWipeSlider_ValueChanged"/>
</StackPanel>
<!-- Offline Mode Toggle Slider --> <!-- Video Record Toggle Slider -->
<StackPanel Margin="0,0,0,10" Orientation="Horizontal"> <StackPanel Margin="0,0,0,15"
<TextBlock Text="ⓘ" ToolTip="With Offline Mode enabled, kills will not be submitted to the configured API." Foreground="{DynamicResource TextBrush}" FontSize="20" Margin="0,4,3,5"/> Orientation="Horizontal">
<TextBlock Text="Offline Mode:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> <TextBlock Text="ⓘ"
<Slider Name="OfflineModeSlider" Minimum="0" Maximum="1" TickFrequency="1" IsSnapToTickEnabled="True" Value="0" Style="{StaticResource ToggleSliderStyle}" Margin="12,-4,0,0" ValueChanged="OfflineModeSlider_ValueChanged"/> ToolTip="Automatically clip your last kill. Check the README for more info."
</StackPanel> Foreground="{DynamicResource TextBrush}"
FontSize="20"
Margin="0,4,3,5"/>
<TextBlock Text="Video Record:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,7,0,5"/>
<Slider Name="VideoRecordSlider"
Minimum="0"
Maximum="1"
TickFrequency="1"
IsSnapToTickEnabled="True"
Value="0"
Style="{StaticResource ToggleSliderStyle}"
Margin="10,-4,0,0"
ValueChanged="VideoRecordSlider_ValueChanged"/>
</StackPanel>
<!-- 3-Position Toggle Slider --> <!-- Offline Mode Toggle Slider -->
<StackPanel Margin="0,0,0,15" Orientation="Horizontal"> <StackPanel Margin="0,0,0,10"
<TextBlock Text="Theme:" Foreground="{DynamicResource TextBrush}" FontSize="16" Margin="0,7,0,5"/> Orientation="Horizontal">
<Slider x:Name="ThemeSlider" <TextBlock Text="ⓘ"
Minimum="0" ToolTip="With Offline Mode enabled, kills will not be submitted to the configured API."
Maximum="21" Foreground="{DynamicResource TextBrush}"
Value="0" FontSize="20"
TickFrequency="1" Margin="0,4,3,5"/>
IsSnapToTickEnabled="True" <TextBlock Text="Offline Mode:"
ValueChanged="ThemeSlider_ValueChanged" Width="447" Foreground="{DynamicResource TextBrush}"
Style="{StaticResource ThreePositionSlider}" FontSize="16"
/> Margin="0,7,0,5"/>
</StackPanel> <Slider Name="OfflineModeSlider"
Minimum="0"
Maximum="1"
TickFrequency="1"
IsSnapToTickEnabled="True"
Value="0"
Style="{StaticResource ToggleSliderStyle}"
Margin="12,-4,0,0"
ValueChanged="OfflineModeSlider_ValueChanged"/>
</StackPanel>
</StackPanel> <!-- 3-Position Toggle Slider -->
<StackPanel Margin="0,0,0,15"
Orientation="Horizontal">
<TextBlock Text="Theme:"
Foreground="{DynamicResource TextBrush}"
FontSize="16"
Margin="0,7,0,5"/>
<Slider x:Name="ThemeSlider"
Minimum="0"
Maximum="21"
Value="0"
TickFrequency="1"
IsSnapToTickEnabled="True"
ValueChanged="ThemeSlider_ValueChanged"
Width="447"
Style="{StaticResource ThreePositionSlider}"/>
</StackPanel>
<!-- Save Button --> </StackPanel>
<StackPanel Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0">
<Button x:Name="SaveButton" Content="Save" Width="100" Height="40" Style="{StaticResource ButtonStyle}" FontFamily="{StaticResource Orbitron}" Click="SaveButton_Click"/> <!-- Save Button -->
</StackPanel> <StackPanel Grid.Column="2"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Margin="0,0,0,10">
<Button x:Name="SaveButton"
Content="Save"
Width="100"
Height="40"
Style="{StaticResource ButtonStyle}"
FontFamily="{StaticResource Orbitron}"
Click="SaveButton_Click"/>
</StackPanel>
</Grid>
</Grid> </Grid>
</Grid>
</UserControl> </UserControl>

View file

@ -24,10 +24,10 @@ namespace AutoTrackR2
{ {
InitializeComponent(); InitializeComponent();
this.mainWindow = mainWindow; this.mainWindow = mainWindow;
LogFilePath.Text = ConfigManager.LogFile; LogFilePath.Text = ConfigManager.LogFile;
ApiUrl.Text = ConfigManager.ApiUrl; ApiUrl.Text = ConfigManager.ApiUrl;
ApiKey.Text = ConfigManager.ApiKey; ApiKey.Password = ConfigManager.ApiKey;
VideoPath.Text = ConfigManager.VideoPath; VideoPath.Text = ConfigManager.VideoPath;
VisorWipeSlider.Value = ConfigManager.VisorWipe; VisorWipeSlider.Value = ConfigManager.VisorWipe;
VideoRecordSlider.Value = ConfigManager.VideoRecord; VideoRecordSlider.Value = ConfigManager.VideoRecord;
@ -70,7 +70,7 @@ namespace AutoTrackR2
// Set the textboxes with the loaded values // Set the textboxes with the loaded values
LogFilePath.Text = logFile; LogFilePath.Text = logFile;
ApiUrl.Text = apiUrl; ApiUrl.Text = apiUrl;
ApiKey.Text = apiKey; ApiKey.Password = apiKey;
VideoPath.Text = videoPath; VideoPath.Text = videoPath;
// Set the sliders with the loaded values // Set the sliders with the loaded values
@ -123,7 +123,7 @@ namespace AutoTrackR2
// Apply the selected theme // Apply the selected theme
ApplyTheme(themeIndex); ApplyTheme(themeIndex);
mainWindow.UpdateTabVisuals(); mainWindow.UpdateTabVisuals();
} }
@ -399,11 +399,14 @@ namespace AutoTrackR2
dialog.ValidateNames = false; dialog.ValidateNames = false;
dialog.Filter = "All files|*.*"; dialog.Filter = "All files|*.*";
if (dialog.ShowDialog() == true) if (dialog.ShowDialog() == true && dialog.FileName != null)
{ {
// Extract only the directory path from the file // Extract only the directory path from the file
string selectedFolder = Path.GetDirectoryName(dialog.FileName); string? selectedFolder = Path.GetDirectoryName(dialog.FileName);
VideoPath.Text = selectedFolder; // Set the folder path if (selectedFolder != null)
{
VideoPath.Text = selectedFolder; // Set the folder path
}
} }
} }
@ -412,6 +415,11 @@ namespace AutoTrackR2
Slider slider = (Slider)sender; Slider slider = (Slider)sender;
// Build the dynamic file path for the current user // Build the dynamic file path for the current user
if (string.IsNullOrEmpty(ConfigManager.AHKScriptFolder))
{
MessageBox.Show("AHK script folder path is not configured.", "Configuration Error", MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
string filePath = Path.Combine( string filePath = Path.Combine(
ConfigManager.AHKScriptFolder, ConfigManager.AHKScriptFolder,
"visorwipe.ahk" "visorwipe.ahk"
@ -507,7 +515,8 @@ namespace AutoTrackR2
private void SaveButton_Click(object sender, RoutedEventArgs e) private void SaveButton_Click(object sender, RoutedEventArgs e)
{ {
ConfigManager.ApiKey = ApiKey.Text;
ConfigManager.ApiKey = ApiKey.Password;
ConfigManager.ApiUrl = ApiUrl.Text; ConfigManager.ApiUrl = ApiUrl.Text;
ConfigManager.LogFile = LogFilePath.Text; ConfigManager.LogFile = LogFilePath.Text;
ConfigManager.VideoPath = VideoPath.Text; ConfigManager.VideoPath = VideoPath.Text;
@ -515,7 +524,6 @@ namespace AutoTrackR2
ConfigManager.VideoRecord = (int)VideoRecordSlider.Value; ConfigManager.VideoRecord = (int)VideoRecordSlider.Value;
ConfigManager.OfflineMode = (int)OfflineModeSlider.Value; ConfigManager.OfflineMode = (int)OfflineModeSlider.Value;
ConfigManager.Theme = (int)ThemeSlider.Value; ConfigManager.Theme = (int)ThemeSlider.Value;
// Save the current config values // Save the current config values
ConfigManager.SaveConfig(); ConfigManager.SaveConfig();
// Start the flashing effect // Start the flashing effect
@ -524,7 +532,7 @@ namespace AutoTrackR2
private void FlashSaveButton() private void FlashSaveButton()
{ {
string originalText = SaveButton.Content.ToString(); string? originalText = SaveButton.Content?.ToString() ?? string.Empty;
SaveButton.Content = "Saved"; SaveButton.Content = "Saved";
// Save button color change effect // Save button color change effect
@ -573,7 +581,7 @@ namespace AutoTrackR2
{ {
string apiUrl = ApiUrl.Text; string apiUrl = ApiUrl.Text;
string modifiedUrl = Regex.Replace(apiUrl, @"(https?://[^/]+)/?.*", "$1/test"); string modifiedUrl = Regex.Replace(apiUrl, @"(https?://[^/]+)/?.*", "$1/test");
string apiKey = ApiKey.Text; string apiKey = ApiKey.Password;
Debug.WriteLine($"Sending to {modifiedUrl}"); Debug.WriteLine($"Sending to {modifiedUrl}");
try try

View file

@ -1,48 +1,176 @@
<UserControl x:Class="AutoTrackR2.HomePage" <UserControl x:Class="AutoTrackR2.HomePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="396" Width="626"> Height="396"
<Grid Background="{DynamicResource BackgroundLightBrush}"> Width="626">
<!-- Main Layout Grid --> <Grid Background="{DynamicResource BackgroundLightBrush}">
<Grid Margin="0,0,5,7"> <!-- Main Layout Grid -->
<Grid.RowDefinitions> <Grid Margin="0,0,5,7">
<!-- One row for the content, the other for buttons --> <Grid.RowDefinitions>
<RowDefinition Height="*" /> <!-- One row for the content, the other for buttons -->
<RowDefinition Height="Auto" /> <RowDefinition Height="*"/>
</Grid.RowDefinitions> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<!-- Left column for the main content area --> <!-- Left column for the main content area -->
<ColumnDefinition /> <ColumnDefinition/>
<!-- Right column for the buttons --> <!-- Right column for the buttons -->
<ColumnDefinition Width="Auto" MinWidth="173" /> <ColumnDefinition Width="Auto"
</Grid.ColumnDefinitions> MinWidth="173"/>
</Grid.ColumnDefinitions>
<!-- Border for the kill feed section --> <!-- Border for the kill feed section -->
<!--TextBox Name="OutputTextBox" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Height="NaN" Margin="0,0,20,0" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" IsReadOnly="True" Style="{StaticResource RoundedTextBox}"/--> <!--TextBox Name="OutputTextBox" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Height="NaN" Margin="0,0,20,0" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" IsReadOnly="True" Style="{StaticResource RoundedTextBox}"/-->
<Border Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" BorderBrush="{DynamicResource AccentBrush}" BorderThickness="2" CornerRadius="5" Padding="10,0,0,0" Background="{DynamicResource BackgroundDarkBrush}" Margin="0,0,20,0"> <Border Grid.Row="0"
<ScrollViewer VerticalScrollBarVisibility="Auto" Width="419" Margin="0,0,-5,0"> Grid.Column="0"
<StackPanel Name="KillFeedStackPanel" Orientation="Vertical" Margin="0,0,0,0" Width="402" HorizontalAlignment="Left"/> Grid.RowSpan="2"
</ScrollViewer> BorderBrush="{DynamicResource AccentBrush}"
</Border> BorderThickness="2"
CornerRadius="5"
Padding="10,0,0,0"
Background="{DynamicResource BackgroundDarkBrush}"
Margin="0,0,20,0">
<ScrollViewer VerticalScrollBarVisibility="Auto"
Width="419"
Margin="0,0,-5,0">
<StackPanel Name="KillFeedStackPanel"
Orientation="Vertical"
Margin="0,0,0,0"
Width="402"
HorizontalAlignment="Left"/>
</ScrollViewer>
</Border>
<!-- StackPanel for Start and Stop buttons --> <!-- StackPanel for Start and Stop buttons -->
<Border Background="{DynamicResource BackgroundDarkBrush}" BorderBrush="{DynamicResource AccentBrush}" Grid.Row="0" Grid.Column="1" BorderThickness="2" CornerRadius="5" Margin="0,0,0,82"/> <Border Background="{DynamicResource BackgroundDarkBrush}"
<StackPanel Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Height="269" Width="152"> BorderBrush="{DynamicResource AccentBrush}"
<TextBlock Name="PilotNameTitle" Text="Pilot" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14"/> Grid.Row="0"
<TextBlock Name="PilotNameTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" TextAlignment="Center"/> Grid.Column="1"
<TextBlock Name="PlayerShipTitle" Text="Ship" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14" /> BorderThickness="2"
<TextBlock Name="PlayerShipTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" TextAlignment="Center"/> CornerRadius="5"
<TextBlock Name="GameModeTitle" Text="Game Mode" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14"/> Margin="0,0,0,82"/>
<TextBlock Name="GameModeTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" TextAlignment="Center"/> <StackPanel Grid.Column="1"
<TextBlock Name="KillTallyTitle" Text="Kill Tally" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,5,0,0" Foreground="{DynamicResource AltTextBrush}" FontSize="14"/> VerticalAlignment="Center"
<TextBlock Name="KillTallyTextBox" Text="" Width="152" Height="20" Background="Transparent" FontFamily="{StaticResource Orbitron}" Margin="0,0,0,0" Foreground="{DynamicResource TextBrush}" FontSize="10" TextAlignment="Center"/> HorizontalAlignment="Center"
<TextBox x:Name="DebugPanel" Text="" Width="152" Height="98" Background="Transparent" FontFamily="{StaticResource Orbitron}" Foreground="{DynamicResource TextBrush}" FontSize="8" BorderThickness="0" Margin="0,9,0,0"/> Height="269"
</StackPanel> Width="152">
<StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Height="120" Width="172" > <TextBlock Name="PilotNameTitle"
<Button Name="StartButton" Content="Start" Width="100" Height="40" Style="{StaticResource ButtonStyle}" FontFamily="{StaticResource Orbitron}" Margin="0,20" Click="StartButton_Click"/> Text="Pilot"
<Button Name="StopButton" Content="Stop" Width="100" Height="40" Style="{StaticResource DisabledButtonStyle}" FontFamily="{StaticResource Orbitron}" IsEnabled="False" Click="StopButton_Click"/> Width="152"
</StackPanel> Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,5,0,0"
Foreground="{DynamicResource AltTextBrush}"
FontSize="14"/>
<TextBlock Name="PilotNameTextBox"
Text=""
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,0,0,0"
Foreground="{DynamicResource TextBrush}"
FontSize="10"
TextAlignment="Center"/>
<TextBlock Name="PlayerShipTitle"
Text="Ship"
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,5,0,0"
Foreground="{DynamicResource AltTextBrush}"
FontSize="14"/>
<TextBlock Name="PlayerShipTextBox"
Text=""
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,0,0,0"
Foreground="{DynamicResource TextBrush}"
FontSize="10"
TextAlignment="Center"/>
<TextBlock Name="GameModeTitle"
Text="Game Mode"
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,5,0,0"
Foreground="{DynamicResource AltTextBrush}"
FontSize="14"/>
<TextBlock Name="GameModeTextBox"
Text=""
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,0,0,0"
Foreground="{DynamicResource TextBrush}"
FontSize="10"
TextAlignment="Center"/>
<TextBlock Name="KillTallyTitle"
Text="Kill Tally"
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,5,0,0"
Foreground="{DynamicResource AltTextBrush}"
FontSize="14"/>
<TextBlock Name="KillTallyTextBox"
Text=""
Width="152"
Height="20"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Margin="0,0,0,0"
Foreground="{DynamicResource TextBrush}"
FontSize="10"
TextAlignment="Center"/>
<TextBox x:Name="DebugPanel"
Text=""
Width="152"
Height="98"
Background="Transparent"
FontFamily="{StaticResource Orbitron}"
Foreground="{DynamicResource TextBrush}"
FontSize="8"
BorderThickness="0"
Margin="0,9,0,0"/>
</StackPanel>
<StackPanel Grid.Row="1"
Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Height="120"
Width="172">
<Border Background="{DynamicResource BackgroundDarkBrush}"
BorderBrush="{DynamicResource AccentBrush}"
BorderThickness="2"
CornerRadius="5"
Height="80"
Margin="0,10,0,0">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Ellipse x:Name="StatusLight"
Width="15"
Height="15"
Margin="0,0,10,0"
Fill="Red"/>
<TextBlock x:Name="StatusText"
Text="TrackR&#x0a;Standby"
Foreground="{DynamicResource TextBrush}"
FontFamily="{StaticResource Orbitron}"
FontSize="14"
VerticalAlignment="Center"/>
</StackPanel>
</Border>
</StackPanel>
</Grid>
</Grid> </Grid>
</Grid>
</UserControl> </UserControl>

View file

@ -9,81 +9,104 @@ using System.IO;
using System.Text; using System.Text;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using AutoTrackR2.LogEventHandlers; using AutoTrackR2.LogEventHandlers;
using System.Timers;
using System.Linq;
namespace AutoTrackR2; namespace AutoTrackR2;
public partial class HomePage : UserControl public partial class HomePage : UserControl
{ {
private Process runningProcess; // Field to store the running process
private LogHandler? _logHandler; private LogHandler? _logHandler;
private KillHistoryManager _killHistoryManager; private KillHistoryManager _killHistoryManager;
private bool _UIEventsRegistered = false; private bool _UIEventsRegistered = false;
private System.Timers.Timer _statusCheckTimer;
private bool _isLogHandlerRunning = false;
public HomePage() public HomePage()
{ {
InitializeComponent(); InitializeComponent();
if (string.IsNullOrEmpty(ConfigManager.KillHistoryFile))
{
throw new InvalidOperationException("KillHistoryFile path is not configured.");
}
_killHistoryManager = new KillHistoryManager(ConfigManager.KillHistoryFile); _killHistoryManager = new KillHistoryManager(ConfigManager.KillHistoryFile);
// Set the TextBlock text // Set the TextBlock text
KillTallyTitle.Text = $"Kill Tally - {_killHistoryManager.GetKillsInCurrentMonth().Count}"; KillTallyTitle.Text = $"Kill Tally - {DateTime.Now.ToString("MMMM")}";
KillTallyTextBox.Text = _killHistoryManager.GetKillsInCurrentMonth().Count.ToString();
AdjustFontSize(KillTallyTextBox);
AddKillHistoryKillsToUI(); AddKillHistoryKillsToUI();
}
//
public void UpdateButtonState(bool isRunning)
{
var accentColor = (Color)Application.Current.Resources["AccentColor"];
// Initialize and start the status check timer
_statusCheckTimer = new System.Timers.Timer(1000); // Check every second
_statusCheckTimer.Elapsed += CheckStarCitizenStatus;
_statusCheckTimer.Start();
// Check if Star Citizen is already running and initialize accordingly
if (IsStarCitizenRunning())
{
Dispatcher.Invoke(() =>
{
UpdateStatusIndicator(true);
ReadInitialStates(); // Read states first
InitializeLogHandler(); // Then initialize the log handler
});
}
}
private void CheckStarCitizenStatus(object? sender, ElapsedEventArgs e)
{
bool isRunning = IsStarCitizenRunning();
Dispatcher.Invoke(() =>
{
UpdateStatusIndicator(isRunning);
if (isRunning)
{
if (!_isLogHandlerRunning)
{
// Game is running, start log monitoring and read initial states
InitializeLogHandler();
ReadInitialStates();
}
}
else
{
// Game is not running, set everything to Unknown
GameModeTextBox.Text = "Unknown";
PlayerShipTextBox.Text = "Unknown";
PilotNameTextBox.Text = "Unknown";
LocalPlayerData.CurrentGameMode = GameMode.Unknown;
LocalPlayerData.PlayerShip = string.Empty;
LocalPlayerData.Username = string.Empty;
// Stop log monitoring if it's running
if (_isLogHandlerRunning)
{
_logHandler?.StopMonitoring();
_isLogHandlerRunning = false;
}
}
});
}
private void UpdateStatusIndicator(bool isRunning)
{
if (isRunning) if (isRunning)
{ {
// Set Start button to "Running..." and apply glow effect StatusLight.Fill = new SolidColorBrush(Colors.Green);
StartButton.Content = "Running..."; StatusText.Text = "TrackR\nActive";
StartButton.IsEnabled = false; // Disable Start button
StartButton.Style = (Style)FindResource("DisabledButtonStyle");
// Add glow effect to the Start button
StartButton.Effect = new DropShadowEffect
{
Color = accentColor,
BlurRadius = 30, // Adjust blur radius for desired glow intensity
ShadowDepth = 0, // Set shadow depth to 0 for a pure glow effect
Opacity = 1, // Set opacity for glow visibility
Direction = 0 // Direction doesn't matter for glow
};
StopButton.Style = (Style)FindResource("ButtonStyle");
StopButton.IsEnabled = true; // Enable Stop button
} }
else else
{ {
// Reset Start button back to its original state StatusLight.Fill = new SolidColorBrush(Colors.Red);
StartButton.Content = "Start"; StatusText.Text = "TrackR\nStandby";
StartButton.IsEnabled = true; // Enable Start button
// Remove the glow effect from Start button
StartButton.Effect = null;
StopButton.Style = (Style)FindResource("DisabledButtonStyle");
StartButton.Style = (Style)FindResource("ButtonStyle");
StopButton.IsEnabled = false; // Disable Stop button
} }
RegisterUIEventHandlers();
} }
public void StartButton_Click(object sender, RoutedEventArgs e)
{
UpdateButtonState(true);
//string scriptPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "KillTrackR_MainScript.ps1");
// TailFileAsync(scriptPath);
// _logHandler = new LogHandler(@"U:\\StarCitizen\\StarCitizen\\LIVE\\Game.log");
_logHandler = new LogHandler(ConfigManager.LogFile);
_logHandler.Initialize();
}
private void AddKillHistoryKillsToUI() private void AddKillHistoryKillsToUI()
{ {
var kills = _killHistoryManager.GetKills(); var kills = _killHistoryManager.GetKills();
@ -97,9 +120,10 @@ public partial class HomePage : UserControl
{ {
if (_UIEventsRegistered) if (_UIEventsRegistered)
return; return;
// Username // Username
TrackREventDispatcher.PlayerLoginEvent += (username) => { TrackREventDispatcher.PlayerLoginEvent += (username) =>
{
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
PilotNameTextBox.Text = username; PilotNameTextBox.Text = username;
@ -107,38 +131,41 @@ public partial class HomePage : UserControl
LocalPlayerData.Username = username; LocalPlayerData.Username = username;
}); });
}; };
// Ship // Ship
TrackREventDispatcher.JumpDriveStateChangedEvent += (shipName) => { TrackREventDispatcher.JumpDriveStateChangedEvent += (shipName) =>
Dispatcher.Invoke(() => {
{
PlayerShipTextBox.Text = shipName;
AdjustFontSize(PlayerShipTextBox);
LocalPlayerData.PlayerShip = shipName;
});
};
// Game Mode
TrackREventDispatcher.PlayerChangedGameModeEvent += (mode) => {
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
GameModeTextBox.Text = mode.ToString(); PlayerShipTextBox.Text = LocalPlayerData.CurrentGameMode == GameMode.PersistentUniverse ? "Player" : shipName;
AdjustFontSize(PlayerShipTextBox);
LocalPlayerData.PlayerShip = shipName;
});
};
// Game Mode
TrackREventDispatcher.PlayerChangedGameModeEvent += (mode) =>
{
Dispatcher.Invoke(() =>
{
GameModeTextBox.Text = mode == GameMode.PersistentUniverse ? "Player" : mode.ToString();
AdjustFontSize(GameModeTextBox); AdjustFontSize(GameModeTextBox);
LocalPlayerData.CurrentGameMode = mode; LocalPlayerData.CurrentGameMode = mode;
}); });
}; };
// Game Version // Game Version
TrackREventDispatcher.GameVersionEvent += (version) => { TrackREventDispatcher.GameVersionEvent += (version) =>
LocalPlayerData.GameVersion = version; {
LocalPlayerData.GameVersion = version;
}; };
// Actor Death // Actor Death
TrackREventDispatcher.ActorDeathEvent += async (actorDeathData) => { TrackREventDispatcher.ActorDeathEvent += async (actorDeathData) =>
{
if (actorDeathData.VictimPilot != LocalPlayerData.Username) if (actorDeathData.VictimPilot != LocalPlayerData.Username)
{ {
var playerData = await WebHandler.GetPlayerData(actorDeathData.VictimPilot); var playerData = await WebHandler.GetPlayerData(actorDeathData.VictimPilot);
if (playerData != null) if (playerData != null)
{ {
var killData = new KillData var killData = new KillData
@ -156,7 +183,7 @@ public partial class HomePage : UserControl
KillTime = DateTime.UtcNow.ToString("dd MMM yyyy HH:mm"), KillTime = DateTime.UtcNow.ToString("dd MMM yyyy HH:mm"),
PFP = playerData?.PFPURL ?? "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg" PFP = playerData?.PFPURL ?? "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg"
}; };
switch (LocalPlayerData.CurrentGameMode) switch (LocalPlayerData.CurrentGameMode)
{ {
case GameMode.PersistentUniverse: case GameMode.PersistentUniverse:
@ -166,13 +193,13 @@ public partial class HomePage : UserControl
killData.Mode = "ac"; killData.Mode = "ac";
break; break;
} }
// Add kill to UI // Add kill to UI
Dispatcher.Invoke(() => Dispatcher.Invoke(() =>
{ {
AddKillToScreen(killData); AddKillToScreen(killData);
}); });
// Only submit kill data if not in offline mode // Only submit kill data if not in offline mode
if (ConfigManager.OfflineMode == 0) if (ConfigManager.OfflineMode == 0)
{ {
@ -185,17 +212,18 @@ public partial class HomePage : UserControl
} }
} }
}; };
// Vehicle Destruction // Vehicle Destruction
TrackREventDispatcher.VehicleDestructionEvent += (data) => { TrackREventDispatcher.VehicleDestructionEvent += (data) =>
{
LocalPlayerData.LastSeenVehicleLocation = data.VehicleZone; LocalPlayerData.LastSeenVehicleLocation = data.VehicleZone;
}; };
_UIEventsRegistered = true; _UIEventsRegistered = true;
} }
private void AddKillToScreen(KillData killData) private void AddKillToScreen(KillData killData)
{ {
// Fetch the dynamic resource for AltTextColor // Fetch the dynamic resource for AltTextColor
var altTextColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AltTextColor"]); var altTextColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AltTextColor"]);
var accentColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AccentColor"]); var accentColorBrush = new SolidColorBrush((Color)Application.Current.Resources["AccentColor"]);
@ -236,22 +264,22 @@ public partial class HomePage : UserControl
FontFamily = orbitronFontFamily, FontFamily = orbitronFontFamily,
}); });
killTextBlock.Inlines.Add(new Run($"{killData.OrgAffiliation}\n")); killTextBlock.Inlines.Add(new Run($"{killData.OrgAffiliation}\n"));
killTextBlock.Inlines.Add(new Run("Join Date: ") killTextBlock.Inlines.Add(new Run("Join Date: ")
{ {
Foreground = altTextColorBrush, Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily, FontFamily = orbitronFontFamily,
}); });
killTextBlock.Inlines.Add(new Run($"{killData.Enlisted}\n")); killTextBlock.Inlines.Add(new Run($"{killData.Enlisted}\n"));
killTextBlock.Inlines.Add(new Run("UEE Record: ") killTextBlock.Inlines.Add(new Run("UEE Record: ")
{ {
Foreground = altTextColorBrush, Foreground = altTextColorBrush,
FontFamily = orbitronFontFamily, FontFamily = orbitronFontFamily,
}); });
killTextBlock.Inlines.Add(new Run($"{killData.RecordNumber}\n")); killTextBlock.Inlines.Add(new Run($"{killData.RecordNumber}\n"));
killTextBlock.Inlines.Add(new Run("Kill Time: ") killTextBlock.Inlines.Add(new Run("Kill Time: ")
{ {
Foreground = altTextColorBrush, Foreground = altTextColorBrush,
@ -284,26 +312,24 @@ public partial class HomePage : UserControl
{ {
killData.PFP = "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg"; killData.PFP = "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg";
} }
// Create the Image for the profile // Create the Image for the profile
var profileImage = new Image var profileImage = new Image
{ {
Source = new BitmapImage(new Uri(killData.PFP)), // Assuming the 8th part contains the profile image URL Source = new BitmapImage(new Uri(killData.PFP ?? "https://cdn.robertsspaceindustries.com/static/images/account/avatar_default_big.jpg")),
Width = 90, Width = 90,
Height = 90, Height = 90,
Stretch = Stretch.Fill, // Adjust how the image fits Stretch = Stretch.Fill, // Adjust how the image fits
}; };
// Create a Border around the Image // Create a Border around the Image
var imageBorder = new Border var imageBorder = new Border();
{ imageBorder.SetResourceReference(Border.BorderBrushProperty, "AccentBrush");
BorderBrush = accentColorBrush, // Set the border color imageBorder.BorderThickness = new Thickness(2);
BorderThickness = new Thickness(2), // Set the border thickness imageBorder.Padding = new Thickness(0);
Padding = new Thickness(0), // Optional padding inside the border imageBorder.CornerRadius = new CornerRadius(5);
CornerRadius = new CornerRadius(5), imageBorder.Margin = new Thickness(10, 18, 15, 18);
Margin = new Thickness(10,18,15,18), imageBorder.Child = profileImage;
Child = profileImage // Set the Image as the content of the Border
};
// Add the Border (with the image inside) to the Grid // Add the Border (with the image inside) to the Grid
Grid.SetColumn(imageBorder, 1); Grid.SetColumn(imageBorder, 1);
@ -321,7 +347,7 @@ public partial class HomePage : UserControl
public void StopButton_Click(object sender, RoutedEventArgs e) public void StopButton_Click(object sender, RoutedEventArgs e)
{ {
_logHandler?.Stop(); _logHandler?.StopMonitoring();
// Clear the text boxes // Clear the text boxes
// System.Threading.Thread.Sleep(200); // System.Threading.Thread.Sleep(200);
@ -366,23 +392,27 @@ public partial class HomePage : UserControl
VisualTreeHelper.GetDpi(this).PixelsPerDip VisualTreeHelper.GetDpi(this).PixelsPerDip
); );
} }
// Apply the adjusted font size // Apply the adjusted font size
textBlock.FontSize = fontSize; textBlock.FontSize = fontSize;
} }
public static void RunAHKScript(string path) public static void RunAHKScript(string? path)
{ {
if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(ConfigManager.AHKScriptFolder))
{
return;
}
string scriptPath = Path.Combine(ConfigManager.AHKScriptFolder, path); string scriptPath = Path.Combine(ConfigManager.AHKScriptFolder, path);
if (!File.Exists(scriptPath)) if (!File.Exists(scriptPath))
{ {
return; return;
} }
// Run the script using powershell // Run the script using powershell
using var ahkProcess = new Process(); using var ahkProcess = new Process();
// Runs the script via Explorer, ensuring it uses whatever the // Runs the script via Explorer, ensuring it uses whatever the
// default binary for AHK is. Skips having to find a specific path to AHK // default binary for AHK is. Skips having to find a specific path to AHK
ahkProcess.StartInfo.FileName = "explorer"; ahkProcess.StartInfo.FileName = "explorer";
@ -397,7 +427,7 @@ public partial class HomePage : UserControl
RunAHKScript(ConfigManager.VisorWipeScript); RunAHKScript(ConfigManager.VisorWipeScript);
} }
} }
private void VideoRecord() private void VideoRecord()
{ {
if (ConfigManager.VideoRecord == 1) if (ConfigManager.VideoRecord == 1)
@ -405,4 +435,159 @@ public partial class HomePage : UserControl
RunAHKScript(ConfigManager.VideoRecordScript); RunAHKScript(ConfigManager.VideoRecordScript);
} }
} }
public void InitializeLogHandler()
{
if (_logHandler == null)
{
_logHandler = new LogHandler(ConfigManager.LogFile);
_logHandler.Initialize();
RegisterUIEventHandlers();
_isLogHandlerRunning = true;
// Read initial states after initializing log handler
ReadInitialStates();
}
else if (!_isLogHandlerRunning)
{
_logHandler.Initialize();
_isLogHandlerRunning = true;
ReadInitialStates();
}
}
private void ReadInitialStates()
{
if (string.IsNullOrEmpty(ConfigManager.LogFile) || !File.Exists(ConfigManager.LogFile))
{
Debug.WriteLine("Log file not found or path is empty");
return;
}
try
{
Debug.WriteLine("Reading initial states from log file...");
// Read the entire log file
var lines = File.ReadAllLines(ConfigManager.LogFile);
string username = "";
string shipName = "";
GameMode gameMode = GameMode.Unknown;
// Read from the end of the file to get the most recent states
for (int i = lines.Length - 1; i >= 0; i--)
{
var line = lines[i];
// Check for username (login)
if (line.Contains("'s Character"))
{
int startIndex = line.IndexOf("'s Character");
if (startIndex > 0)
{
username = line.Substring(0, startIndex).Trim();
Debug.WriteLine($"Found username: {username}");
}
}
// Check for ship name
else if (line.Contains("Entering quantum travel from"))
{
int startIndex = line.IndexOf("in ship") + 8;
int endIndex = line.IndexOf(" to ", startIndex);
if (startIndex > 8 && endIndex > startIndex)
{
shipName = line.Substring(startIndex, endIndex - startIndex).Trim();
Debug.WriteLine($"Found ship: {shipName}");
}
}
// Check for game mode
else if (line.Contains("Loading level"))
{
if (line.Contains("Persistent_Universe"))
{
gameMode = GameMode.PersistentUniverse;
Debug.WriteLine("Found game mode: PU");
}
else if (line.Contains("Arena_Commander"))
{
gameMode = GameMode.ArenaCommander;
Debug.WriteLine("Found game mode: AC");
}
}
// If we've found all the information we need, we can stop reading
if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(shipName) && gameMode != GameMode.Unknown)
{
break;
}
}
// Update UI with found states
Dispatcher.Invoke(() =>
{
if (!string.IsNullOrEmpty(username))
{
PilotNameTextBox.Text = username;
LocalPlayerData.Username = username;
AdjustFontSize(PilotNameTextBox);
Debug.WriteLine($"Set username in UI: {username}");
}
else
{
PilotNameTextBox.Text = "Unknown";
LocalPlayerData.Username = string.Empty;
AdjustFontSize(PilotNameTextBox);
Debug.WriteLine("Username not found, set to Unknown");
}
if (!string.IsNullOrEmpty(shipName))
{
PlayerShipTextBox.Text = gameMode == GameMode.PersistentUniverse ? "Player" : shipName;
LocalPlayerData.PlayerShip = shipName;
AdjustFontSize(PlayerShipTextBox);
Debug.WriteLine($"Set ship in UI: {PlayerShipTextBox.Text}");
}
else
{
PlayerShipTextBox.Text = "Unknown";
LocalPlayerData.PlayerShip = string.Empty;
AdjustFontSize(PlayerShipTextBox);
Debug.WriteLine("Ship not found, set to Unknown");
}
if (gameMode != GameMode.Unknown)
{
GameModeTextBox.Text = gameMode == GameMode.PersistentUniverse ? "Player" : gameMode.ToString();
LocalPlayerData.CurrentGameMode = gameMode;
AdjustFontSize(GameModeTextBox);
Debug.WriteLine($"Set game mode in UI: {GameModeTextBox.Text}");
}
else
{
GameModeTextBox.Text = "Unknown";
LocalPlayerData.CurrentGameMode = GameMode.Unknown;
AdjustFontSize(GameModeTextBox);
Debug.WriteLine("Game mode not found, set to Unknown");
}
});
}
catch (Exception ex)
{
Debug.WriteLine($"Error reading initial states: {ex.Message}");
}
}
public void Cleanup()
{
// Stop and dispose the status check timer
_statusCheckTimer?.Stop();
_statusCheckTimer?.Dispose();
// Stop the log handler if it's running
_logHandler?.StopMonitoring();
}
private bool IsStarCitizenRunning()
{
return Process.GetProcessesByName("StarCitizen").Length > 0;
}
} }

View file

@ -3,8 +3,9 @@
public enum GameMode public enum GameMode
{ {
ArenaCommander, Unknown,
PersistentUniverse PersistentUniverse,
ArenaCommander
} }
public static class LocalPlayerData public static class LocalPlayerData

View file

@ -19,7 +19,6 @@ public struct VehicleDestructionData
public class VehicleDestructionEvent : ILogEventHandler public class VehicleDestructionEvent : ILogEventHandler
{ {
public Regex Pattern { get; } public Regex Pattern { get; }
public VehicleDestructionEvent() public VehicleDestructionEvent()
{ {
Pattern = new Regex(""" Pattern = new Regex("""
@ -34,6 +33,10 @@ public class VehicleDestructionEvent : ILogEventHandler
public void Handle(LogEntry entry) public void Handle(LogEntry entry)
{ {
if (entry.Message == null)
{
return;
}
var match = Pattern.Match(entry.Message); var match = Pattern.Match(entry.Message);
if (!match.Success) if (!match.Success)
{ {

View file

@ -12,7 +12,6 @@ public class LogEntry
{ {
public DateTime Timestamp { get; set; } public DateTime Timestamp { get; set; }
public required string? Message { get; set; } public required string? Message { get; set; }
} }
enum GameProcessState enum GameProcessState
@ -22,16 +21,18 @@ enum GameProcessState
Unknown Unknown
} }
public class LogHandler(string logPath) public class LogHandler
{ {
private readonly string? _logPath = logPath; private string _logPath;
private FileStream? _fileStream; private FileStream? _fileStream;
private StreamReader? _reader; private StreamReader? _reader;
private GameProcessState _gameProcessState = GameProcessState.Unknown; private Thread? _monitorThread;
private CancellationTokenSource? _cancellationTokenSource;
private GameProcessState _gameProcessState = GameProcessState.NotRunning;
private bool _isMonitoring = false;
public bool IsMonitoring => _isMonitoring;
private CancellationTokenSource cancellationToken = new CancellationTokenSource();
Thread? monitorThread;
// Handlers that should be run on every log entry // Handlers that should be run on every log entry
// Overlap with _startupEventHandlers is fine // Overlap with _startupEventHandlers is fine
private readonly List<ILogEventHandler> _eventHandlers = [ private readonly List<ILogEventHandler> _eventHandlers = [
@ -43,18 +44,26 @@ public class LogHandler(string logPath)
new JumpDriveStateChangedEvent(), new JumpDriveStateChangedEvent(),
new RequestJumpFailedEvent() new RequestJumpFailedEvent()
]; ];
public LogHandler(string? logPath)
{
if (string.IsNullOrEmpty(logPath))
{
throw new ArgumentNullException(nameof(logPath), "Log path cannot be null or empty");
}
_logPath = logPath;
}
// Initialize the LogHandler and run all startup handlers
public void Initialize() public void Initialize()
{ {
if (!File.Exists(_logPath)) if (!File.Exists(_logPath))
{ {
throw new FileNotFoundException("Log file not found", _logPath); throw new FileNotFoundException("Log file not found", _logPath);
} }
_fileStream = new FileStream(_logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); _fileStream = new FileStream(_logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
_reader = new StreamReader(_fileStream); _reader = new StreamReader(_fileStream);
while (_reader.ReadLine() is { } line) while (_reader.ReadLine() is { } line)
{ {
HandleLogEntry(line); HandleLogEntry(line);
@ -62,19 +71,30 @@ public class LogHandler(string logPath)
// Ensures that any deaths already in log aren't sent to the APIs until the monitor thread is running // Ensures that any deaths already in log aren't sent to the APIs until the monitor thread is running
_eventHandlers.Add(new ActorDeathEvent()); _eventHandlers.Add(new ActorDeathEvent());
StartMonitoring();
monitorThread = new Thread(() => MonitorLog(cancellationToken.Token));
monitorThread.Start();
} }
public void Stop() public void StartMonitoring()
{ {
// Stop the monitor thread if (_isMonitoring) return;
cancellationToken?.Cancel();
_cancellationTokenSource = new CancellationTokenSource();
_monitorThread = new Thread(() => MonitorLog(_cancellationTokenSource.Token));
_monitorThread.Start();
_isMonitoring = true;
}
public void StopMonitoring()
{
if (!_isMonitoring) return;
_cancellationTokenSource?.Cancel();
_monitorThread?.Join();
_reader?.Close(); _reader?.Close();
_fileStream?.Close(); _fileStream?.Close();
_isMonitoring = false;
} }
// Parse a single line of the log file and run matching handlers // Parse a single line of the log file and run matching handlers
private void HandleLogEntry(string line) private void HandleLogEntry(string line)
{ {
@ -83,7 +103,7 @@ public class LogHandler(string logPath)
{ {
var match = handler.Pattern.Match(line); var match = handler.Pattern.Match(line);
if (!match.Success) continue; if (!match.Success) continue;
var entry = new LogEntry var entry = new LogEntry
{ {
Timestamp = DateTime.Now, Timestamp = DateTime.Now,
@ -93,7 +113,7 @@ public class LogHandler(string logPath)
break; break;
} }
} }
private void MonitorLog(CancellationToken token) private void MonitorLog(CancellationToken token)
{ {
while (!token.IsCancellationRequested) while (!token.IsCancellationRequested)
@ -102,9 +122,9 @@ public class LogHandler(string logPath)
{ {
break; break;
} }
CheckGameProcessState(); CheckGameProcessState();
List<string> lines = new List<string>(); List<string> lines = new List<string>();
while (_reader.ReadLine() is { } line) while (_reader.ReadLine() is { } line)
{ {
@ -131,21 +151,19 @@ public class LogHandler(string logPath)
{ {
// Check if the game process is running by window name // Check if the game process is running by window name
var process = Process.GetProcesses().FirstOrDefault(p => p.MainWindowTitle == "Star Citizen"); var process = Process.GetProcesses().FirstOrDefault(p => p.MainWindowTitle == "Star Citizen");
GameProcessState newGameProcessState = process != null ? GameProcessState.Running : GameProcessState.NotRunning; GameProcessState newGameProcessState = process != null ? GameProcessState.Running : GameProcessState.NotRunning;
if (newGameProcessState == GameProcessState.Running && _gameProcessState == GameProcessState.NotRunning) if (newGameProcessState == GameProcessState.Running && _gameProcessState == GameProcessState.NotRunning)
{ {
// Game process went from NotRunning to Running, so reload the Game.log file // Game process went from NotRunning to Running, so reload the Game.log file
Console.WriteLine("Game process started, reloading log file"); Console.WriteLine("Game process started, reloading log file");
_reader?.Close(); _reader?.Close();
_fileStream?.Close(); _fileStream?.Close();
_fileStream = new FileStream(_logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); _fileStream = new FileStream(_logPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
_reader = new StreamReader(_fileStream); _reader = new StreamReader(_fileStream);
} }
_gameProcessState = newGameProcessState; _gameProcessState = newGameProcessState;
} }
} }

View file

@ -13,7 +13,6 @@ 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
@ -23,9 +22,7 @@ namespace AutoTrackR2
}; };
private HomePage homePage; // Persistent HomePage instance private HomePage homePage; // Persistent HomePage instance
private bool isRunning = false; // Single source of truth for the running state
// Ensure this method is not static
public void ChangeLogoImage(string imagePath) public void ChangeLogoImage(string imagePath)
{ {
Logo.Source = new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute)); Logo.Source = new BitmapImage(new Uri(imagePath, UriKind.RelativeOrAbsolute));
@ -38,10 +35,6 @@ namespace AutoTrackR2
homePage = new HomePage(); // Create a single instance of HomePage homePage = new HomePage(); // Create a single instance of HomePage
ContentControl.Content = homePage; // Default to HomePage ContentControl.Content = homePage; // Default to HomePage
// Attach event handlers for the HomePage buttons
homePage.StartButton.Click += StartButton_Click;
homePage.StopButton.Click += StopButton_Click;
// Create ConfigPage and pass the MainWindow reference to it // Create ConfigPage and pass the MainWindow reference to it
var configPage = new ConfigPage(this); var configPage = new ConfigPage(this);
@ -51,6 +44,7 @@ namespace AutoTrackR2
UpdateTabVisuals(); UpdateTabVisuals();
Loaded += MainWindow_Loaded; // Handle Loaded event Loaded += MainWindow_Loaded; // Handle Loaded event
Closing += MainWindow_Closing; // Handle Closing event
} }
private void MainWindow_Loaded(object sender, RoutedEventArgs e) private void MainWindow_Loaded(object sender, RoutedEventArgs e)
@ -59,16 +53,23 @@ namespace AutoTrackR2
var args = Environment.GetCommandLineArgs(); var args = Environment.GetCommandLineArgs();
if (args.Contains("-start", StringComparer.OrdinalIgnoreCase)) if (args.Contains("-start", StringComparer.OrdinalIgnoreCase))
{ {
homePage.StartButton_Click(null, null); // Initialize log handler if needed
homePage.InitializeLogHandler();
} }
} }
private void MainWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
{
// Clean up resources
homePage?.Cleanup();
// Make sure the application exits completely
Application.Current.Shutdown();
}
private void CloseWindow(object sender, RoutedEventArgs e) private void CloseWindow(object sender, RoutedEventArgs e)
{ {
// If runningProcess is not null and still active, terminate it // This will trigger the Closing event
homePage.StopButton_Click(sender, e);
// Close the main window
this.Close(); this.Close();
} }
@ -91,9 +92,6 @@ namespace AutoTrackR2
{ {
// Reuse the existing HomePage instance // Reuse the existing HomePage instance
ContentControl.Content = homePage; ContentControl.Content = homePage;
// Update the button state on the HomePage
homePage.UpdateButtonState(isRunning);
} }
else if (clickedTabName == "StatsTab") else if (clickedTabName == "StatsTab")
{ {
@ -158,20 +156,6 @@ namespace AutoTrackR2
} }
} }
private void StartButton_Click(object sender, RoutedEventArgs e)
{
isRunning = true; // Update the running state
homePage.UpdateButtonState(isRunning); // Update HomePage button visuals
// Start your logic here
}
private void StopButton_Click(object sender, RoutedEventArgs e)
{
isRunning = false; // Update the running state
homePage.UpdateButtonState(isRunning); // Update HomePage button visuals
// Stop your logic here
}
private void InitializeConfigPage() private void InitializeConfigPage()
{ {
// Set the values from the loaded config // Set the values from the loaded config
@ -179,10 +163,10 @@ namespace AutoTrackR2
// Set the fields in ConfigPage.xaml.cs based on the loaded config // Set the fields in ConfigPage.xaml.cs based on the loaded config
configPage.SetConfigValues( configPage.SetConfigValues(
ConfigManager.LogFile, ConfigManager.LogFile ?? string.Empty,
ConfigManager.ApiUrl, ConfigManager.ApiUrl ?? string.Empty,
ConfigManager.ApiKey, ConfigManager.ApiKey ?? string.Empty,
ConfigManager.VideoPath, ConfigManager.VideoPath ?? string.Empty,
ConfigManager.VisorWipe, ConfigManager.VisorWipe,
ConfigManager.VideoRecord, ConfigManager.VideoRecord,
ConfigManager.OfflineMode, ConfigManager.OfflineMode,
@ -193,17 +177,14 @@ namespace AutoTrackR2
public static class ConfigManager public static class ConfigManager
{ {
public static string LogFile { get; set; } public static string? LogFile { get; set; } = string.Empty;
public static string KillHistoryFile { get; set; } public static string? KillHistoryFile { get; set; } = string.Empty;
public static string? AHKScriptFolder { get; set; } = string.Empty;
public static string AHKScriptFolder { get; set; } public static string? VisorWipeScript { get; set; } = string.Empty;
public static string? VideoRecordScript { get; set; } = string.Empty;
public static string VisorWipeScript { get; set; } public static string? ApiUrl { get; set; } = string.Empty;
public static string VideoRecordScript { get; set; } public static string? ApiKey { get; set; } = string.Empty;
public static string? VideoPath { get; set; } = string.Empty;
public static string ApiUrl { get; set; }
public static string ApiKey { get; set; }
public static string VideoPath { get; set; }
public static int VisorWipe { get; set; } public static int VisorWipe { get; set; }
public static int VideoRecord { get; set; } public static int VideoRecord { get; set; }
public static int OfflineMode { get; set; } public static int OfflineMode { get; set; }

View file

@ -10,7 +10,7 @@ namespace AutoTrackR2
public partial class UpdatePage : UserControl public partial class UpdatePage : UserControl
{ {
public static string currentVersion = "v2.09"; public static string currentVersion = "v2.09";
private string latestVersion; private string? latestVersion = string.Empty;
public UpdatePage() public UpdatePage()
{ {
@ -60,7 +60,7 @@ namespace AutoTrackR2
// Parse the JSON using System.Text.Json // Parse the JSON using System.Text.Json
using var document = System.Text.Json.JsonDocument.Parse(response); using var document = System.Text.Json.JsonDocument.Parse(response);
var root = document.RootElement; var root = document.RootElement;
var tagName = root.GetProperty("tag_name").GetString(); var tagName = root.GetProperty("tag_name").GetString() ?? "unknown";
return tagName; return tagName;
} }
@ -77,7 +77,8 @@ namespace AutoTrackR2
if (root.GetArrayLength() > 0) if (root.GetArrayLength() > 0)
{ {
var firstRelease = root[0]; var firstRelease = root[0];
return firstRelease.GetProperty("tag_name").GetString(); var tagName = firstRelease.GetProperty("tag_name").GetString() ?? "unknown";
return tagName;
} }
throw new Exception("No releases found."); throw new Exception("No releases found.");
@ -90,7 +91,7 @@ namespace AutoTrackR2
return !currentVersion.Equals(latestVersion, StringComparison.Ordinal); return !currentVersion.Equals(latestVersion, StringComparison.Ordinal);
} }
private async void InstallButton_Click(object sender, RoutedEventArgs e) private void InstallButton_Click(object sender, RoutedEventArgs e)
{ {
try try
{ {

View file

@ -0,0 +1,2 @@
; AutoHotkey v2 script to press Win + Alt + G
Send("{LWin Down}{Alt Down}g{Alt Up}{LWin Up}") ; Simulate pressing Win + Alt + G

View file

@ -0,0 +1,2 @@
; AutoHotkey v2 script to press Alt + X
Send("{Alt Down}x{Alt Up}") ; Simulate pressing Alt + X

148
README.md
View file

@ -1,90 +1,104 @@
AutoTrackR2 - Star Citizen Kill-Tracking Tool # AutoTrackR2 - Star Citizen Kill-Tracking Tool
AutoTrackR2 is a powerful and customizable kill-tracking tool for Star Citizen. Designed with gankers and combat enthusiasts in mind, it integrates seamlessly with the game to log, display, and manage your kills, providing detailed information and optional API integration for advanced tracking. AutoTrackR2 is a powerful and customizable kill-tracking tool for Star Citizen. Designed with gankers and combat enthusiasts in mind, it integrates seamlessly with the game to log, display, and manage your kills, providing detailed information and optional API integration for advanced tracking.
🚀 Features ## Features
Log File Integration: Point to Star Citizen's live game.log to track kills in real-time.
API Integration (Optional): - **Log File Integration**: Point to Star Citizen's live game.log to track kills in real-time.
Configure a desired API to send kill data for external tracking or display. - **API Integration (Optional)**:
Secure your data with an optional API key. - Configure a desired API to send kill data for external tracking or display.
- Secure your data with an optional API key.
- **Video Clipping (Optional)**:
- Set a path to your clipping software to save kills automatically.
- **Visor Wipe Integration (Optional)**:
- Automates visor wiping using an AutoHotkey script (`visorwipe.ahk`).
- Requires AutoHotkey v2.
- Script must be placed in `%LOCALAPPDATA%\AutoTrackR2\`.
- **Video Record Integration (Optional)**:
- Customize the `videorecord.ahk` script for your specific video recording keybinds.
- Requires AutoHotkey v2.
- Script must be placed in `%LOCALAPPDATA%\AutoTrackR2\`
- **Offline Mode**:
- Disables API submissions. The tool will still scrape and display information from the RobertsSpaceIndustries website for the profile of whomever you have killed.
- **Custom Themes**:
- Easily add or modify themes by adjusting the `ThemeSlider_ValueChanged` function in `ConfigPage.xaml.cs`.
- Update the ThemeSlider maximum value in `ConfigPage.xaml` to reflect the number of themes added.
Video Clipping (Optional): ## Setup
Set a path to your clipping software to save kills automatically.
Visor Wipe Integration: 1. **Prerequisites**:
Automates visor wiping using an AutoHotkey script (visorwipe.ahk).
Requires AutoHotkey v2.
Script must be placed in C:\Users\<Username>\AppData\Local\AutoTrackR2\.
Video Record Integration: - Windows 10 or later
Customize the videorecord.ahk script for your specific video recording keybinds. - .NET Framework 4.7.2 or higher
Requires AutoHotkey v2. - Star Citizen installed
Script must be placed in C:\Users\<Username>\AppData\Local\AutoTrackR2\ - AutoHotkey v2 (optional - only needed for visor wipe and video recording features):
- Download from the official website at https://www.autohotkey.com/
- Install AutoHotkey v2 (not v1.x as they are not compatible)
- Verify installation by right-clicking on your desktop and confirming "New > AutoHotkey v2 Script" appears in the context menu
Offline Mode: 2. **Installation Steps**:
Disables API submissions. The tool will still scrape and display information from the RobertsSpaceIndustries website for the profile of whomever you have killed.
Custom Themes: - Download the latest release package from the releases page
Easily add or modify themes by adjusting the ThemeSlider_ValueChanged function in ConfigPage.xaml.cs. - Run the installer and follow the on-screen instructions
Update the ThemeSlider maximum value in ConfigPage.xaml to reflect the number of themes added. - Launch AutoTrackR2 after installation completes
📁 Configuration 3. **Initial Configuration**:
Log File: - Open the Configuration panel within the application
Specify the path to Star Citizen's game.log. - Set the path to your Star Citizen game.log file (typically found in `[Star Citizen Install Path]\LIVE\game.log`)
- Configure API settings if desired (leave blank for offline mode)
- Set up video clipping paths if using this feature
- If using AutoHotkey features, verify the scripts are properly placed in the `%LOCALAPPDATA%\AutoTrackR2\` location
API Settings (Optional): ## Configuration
API URL: Provide the endpoint for posting kill data. - **Log File**:
- Specify the path to Star Citizen's `game.log`.
- **API Settings (Optional)**:
- API URL: Provide the endpoint for posting kill data.
- API Key: Secure access to the API with your unique key.
- **Video Clipping Path (Optional)**:
- Set the directory where your clipping software saves kills.
- **Visor Wipe Setup (Optional)**:
- Place `visorwipe.ahk` in `%LOCALAPPDATA%\AutoTrackR2\`.
- AutoHotkey v2 is required.
- **Video Recording Setup (Optional)**:
- Modify `videorecord.ahk` to use the keybinds of your video recording software.
- Place `videorecord.ahk` in `%LOCALAPPDATA%\AutoTrackR2\`.
- AutoHotkey v2 is required.
- **Offline Mode**:
- Enable to disable API submission. Restart the tracker to apply changes.
API Key: Secure access to the API with your unique key. ## Privacy & Data Usage
Video Clipping Path (Optional): - **No Personal Data Collection**:
Set the directory where your clipping software saves kills. - AutoTrackR2 does not collect or store personal or system information, other than common file paths to manage necessary files.
- **Access and Permissions**:
- The tool reads its own `config.ini` and the `game.log` from Star Citizen. It will also create a CSV file of all your logged kills, stored locally on your machine in the `%LOCALAPPDATA%\AutoTrackR2\` folder.
- **Optional Data Submission**:
- Data is only sent to an API if explicitly configured by the user. Offline Mode disables all outgoing submissions.
- **Killfeed Scraping**:
- The program scrapes the profile page of killed players to display their information locally. This feature remains active even in Offline Mode.
Visor Wipe Setup: ## Customization
Place visorwipe.ahk in C:\Users\<Username>\AppData\Local\AutoTrackR2\.
AutoHotkey v2 is required.
Video Recording Setup:
Modify videorecord.ahk to use the keybinds of your video recording software.
Place videorecord.ahk in C:\Users\<Username>\AppData\Local\AutoTrackR2\.
AutoHotkey v2 is required.
Offline Mode:
Enable to disable API submission. Restart the tracker to apply changes.
🛡️ Privacy & Data Usage
No Personal Data Collection:
AutoTrackR2 does not collect or store personal or system information, other than common file paths to manage necessary files.
Access and Permissions:
The tool reads its own config.ini and the game.log from Star Citizen. It will also create a CSV file of all your logged kills, stored locally on your machine in the AppData folder.
Optional Data Submission:
Data is only sent to an API if explicitly configured by the user. Offline Mode disables all outgoing submissions.
Killfeed Scraping:
The program scrapes the profile page of killed players to display their information locally. This feature remains active even in Offline Mode.
⚙️ Installation
Download the latest release from the releases page.
Follow the setup instructions included in the installer.
Configure the tool using the settings outlined above.
💡 Customization
To customize themes or behaviors: To customize themes or behaviors:
Add Themes: - **Add Themes**:
Update the ThemeSlider_ValueChanged function in ConfigPage.xaml.cs with your desired colors and logos. - Update the `ThemeSlider_ValueChanged` function in `ConfigPage.xaml.cs` with your desired colors and logos.
Adjust the ThemeSlider maximum value in ConfigPage.xaml to match the number of themes. - Adjust the ThemeSlider maximum value in `ConfigPage.xaml` to match the number of themes.
- **Modify AHK Scripts (Optional)**:
- Edit `visorwipe.ahk` and `videorecord.ahk` to fit your specific keybinds and preferences.
Modify AHK Scripts: ## Support
Edit visorwipe.ahk and videorecord.ahk to fit your specific keybinds and preferences.
📞 Support For questions, issues, or feature requests:
For questions, issues, or feature requests, please visit discord.gg/griefernet.
- Join our Discord server: [discord.gg/griefernet](https://discord.gg/griefernet)
- Report bugs through the Discord's #autotrackr-bugs channel
- For urgent issues, you can escalate in Discord by tagging moderators
## License
🔒 License
AutoTrackR2 is released under the GNU v3 License. AutoTrackR2 is released under the GNU v3 License.
GRIEFERNET VICTORY! GRIEFERNET VICTORY!