diff --git a/AutoTrackR2/Assets/WRITH.jpg b/AutoTrackR2/Assets/WRITH.jpg new file mode 100644 index 0000000..c942eb5 Binary files /dev/null and b/AutoTrackR2/Assets/WRITH.jpg differ diff --git a/AutoTrackR2/AutoTrackR2.csproj b/AutoTrackR2/AutoTrackR2.csproj index 6c30cc3..95c6ad6 100644 --- a/AutoTrackR2/AutoTrackR2.csproj +++ b/AutoTrackR2/AutoTrackR2.csproj @@ -16,6 +16,7 @@ <None Remove="Assets\HIT.png" /> <None Remove="Assets\NW.png" /> <None Remove="Assets\VOX.png" /> + <None Remove="Assets\WRITH.jpg" /> <None Remove="Fonts\Orbitron-Bold.ttf" /> <None Remove="Fonts\Roboto-Regular.ttf" /> <None Remove="KillTrackR_MainScript.ps1" /> @@ -41,6 +42,9 @@ <Resource Include="Assets\VOX.png"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Resource> + <Resource Include="Assets\WRITH.jpg"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </Resource> <Resource Include="Fonts\Orbitron-Bold.ttf"> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </Resource> diff --git a/AutoTrackR2/ConfigPage.xaml b/AutoTrackR2/ConfigPage.xaml index 7a74a86..c48e2b4 100644 --- a/AutoTrackR2/ConfigPage.xaml +++ b/AutoTrackR2/ConfigPage.xaml @@ -35,7 +35,7 @@ <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="340" Height="30" Style="{StaticResource RoundedTextBox}"/> - <Button Content="Test" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}"/> + <Button Content="Test" Width="75" Height="30" FontFamily="{StaticResource Orbitron}" Margin="5,0" Style="{StaticResource ButtonStyle}" Click="TestApiButton_Click"/> </StackPanel> </StackPanel> diff --git a/AutoTrackR2/ConfigPage.xaml.cs b/AutoTrackR2/ConfigPage.xaml.cs index 2a7a793..fe6dfa4 100644 --- a/AutoTrackR2/ConfigPage.xaml.cs +++ b/AutoTrackR2/ConfigPage.xaml.cs @@ -1,4 +1,9 @@ -using System.IO; +using System.Diagnostics; +using System.IO; +using System.Net.Http.Headers; +using System.Net.Http; +using System.Text.RegularExpressions; +using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Media; @@ -208,7 +213,17 @@ namespace AutoTrackR2 ); ChangeLogo("/Assets/HIT.png"); break; - case 8: // VOX Theme + case 8: // WRAITH Theme + UpdateThemeColors( + (Color)ColorConverter.ConvertFromString("#ff0000"), // Accent/Border + (Color)ColorConverter.ConvertFromString("#ce8946"), // Button + (Color)ColorConverter.ConvertFromString("#000000"), // Background + (Color)ColorConverter.ConvertFromString("#ce8946"), // Text + (Color)ColorConverter.ConvertFromString("#A88F2C") // AltText + ); + ChangeLogo("/Assets/WRITH.png", (Color)ColorConverter.ConvertFromString("#ff0000")); + break; + case 9: // VOX Theme UpdateThemeColors( (Color)ColorConverter.ConvertFromString("#C0C0C0"), // Accent/Border (Color)ColorConverter.ConvertFromString("#1C1C1C"), // Button @@ -218,7 +233,7 @@ namespace AutoTrackR2 ); ChangeLogo("/Assets/VOX.png", (Color)ColorConverter.ConvertFromString("#FFD700")); break; - case 9: // EMP Theme + case 10: // EMP Theme UpdateThemeColors( (Color)ColorConverter.ConvertFromString("#F5721C"), // Accent/Border (Color)ColorConverter.ConvertFromString("#535353"), // Button @@ -404,5 +419,48 @@ namespace AutoTrackR2 // Start the timer timer.Start(); } + + private async void TestApiButton_Click(object sender, RoutedEventArgs e) + { + string apiUrl = ApiUrl.Text; + string modifiedUrl = Regex.Replace(apiUrl, @"(https?://[^/]+)/?.*", "$1/test"); + string apiKey = ApiKey.Text; + Debug.WriteLine($"Sending to {modifiedUrl}"); + + try + { + // Configure HttpClient with TLS 1.2 + var handler = new HttpClientHandler + { + SslProtocols = System.Security.Authentication.SslProtocols.Tls12 + }; + + using (var client = new HttpClient(handler)) + { + // Set headers + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); + client.DefaultRequestHeaders.UserAgent.ParseAdd("AutoTrackR"); + + // Empty JSON body + var content = new StringContent("{}", Encoding.UTF8, "application/json"); + + // Send POST + var response = await client.PostAsync(modifiedUrl, content); + + if (response.IsSuccessStatusCode) + { + MessageBox.Show("API Test Success."); + } + else + { + MessageBox.Show($"Error: {response.StatusCode} - {response.ReasonPhrase}"); + } + } + } + catch (Exception ex) + { + MessageBox.Show($"API Test Failure. {ex.Message}"); + } + } } } diff --git a/AutoTrackR2/KillTrackR_MainScript.ps1 b/AutoTrackR2/KillTrackR_MainScript.ps1 index e6ca610..2076965 100644 --- a/AutoTrackR2/KillTrackR_MainScript.ps1 +++ b/AutoTrackR2/KillTrackR_MainScript.ps1 @@ -15,7 +15,7 @@ if (Test-Path $configFile) { # Convert to key-value pairs $config = $configContent -replace '^([^=]+)=(.+)$', '$1=$2' | ConvertFrom-StringData } else { - Write-Output "PlayerName=Config.ini not found." + Write-Output "Config.ini not found." exit } @@ -49,18 +49,9 @@ if ($visorWipe -eq 1){ If (Test-Path $logFilePath) { Write-Output "PlayerName=Logfile found" } else { - Write-Output "PlayerName=Logfile not found." + Write-Output "Logfile not found." } -$enemyPilot = "6lasphemous" -$enemyShip = "MISC_Freelancer_MAX" -$enemyOrgs = "GrieferNet" -$joinDate = "12 Dec 2022" -$citizenRecord = "237890" -$KillTime = (Get-Date).ToUniversalTime().ToString("d MMM yyyy H:mm 'UTC'") - -Write-Output "NewKill=break,$enemyPilot,$enemyShip,$($enemyOrgs),$joinDate,$citizenRecord,$killTime" - # Ship Manufacturers $prefixes = @( "ORIG", @@ -215,7 +206,7 @@ function Read-LogEntry { $ship = $ship -replace '_(PU|AI|CIV|MIL|PIR)$', '' } - $KillTime = Get-Date([DateTime]::UtcNow) -UFormat "%d%b%Y %r" + $KillTime = (Get-Date).ToUniversalTime().ToString("d MMM yyyy H:mm 'UTC'") $page1 = Invoke-WebRequest -uri "https://robertsspaceindustries.com/citizens/$enemyPilot" $page2 = Invoke-WebRequest -uri "https://robertsspaceindustries.com/citizens/$enemyPilot/organizations" diff --git a/AutoTrackR2/StatsPage.xaml b/AutoTrackR2/StatsPage.xaml index 8ba7626..79fd18a 100644 --- a/AutoTrackR2/StatsPage.xaml +++ b/AutoTrackR2/StatsPage.xaml @@ -3,6 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="396" Width="626"> <Grid Background="{DynamicResource BackgroundLightBrush}"> - <TextBlock Text="Welcome to the Stats Tab!" FontSize="24" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/> + <TextBlock Text="Stats and graphs coming soon!" FontSize="24" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </UserControl> diff --git a/AutoTrackR2/UpdatePage.xaml b/AutoTrackR2/UpdatePage.xaml index 6f16fe9..2c86ea4 100644 --- a/AutoTrackR2/UpdatePage.xaml +++ b/AutoTrackR2/UpdatePage.xaml @@ -3,6 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="396" Width="626"> <Grid Background="{DynamicResource BackgroundLightBrush}"> - <TextBlock Text="Welcome to the Update Tab!" FontSize="24" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/> + <TextBlock Text="Download and update features coming soon!" FontSize="24" Foreground="{DynamicResource TextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </UserControl>