diff --git a/AutoTrackR2/App.xaml b/AutoTrackR2/App.xaml index ee45830..0717447 100644 --- a/AutoTrackR2/App.xaml +++ b/AutoTrackR2/App.xaml @@ -1,632 +1,625 @@ <Application x:Class="AutoTrackR2.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="clr-namespace:AutoTrackR2"> - <Application.Resources> - <FontFamily x:Key="Orbitron">/AutoTrackR2;component/Fonts/Orbitron-Bold.ttf#Orbitron</FontFamily> - <FontFamily x:Key="Roboto">/AutoTrackR2;component/Fonts/Roboto-Regular.ttf#Roboto</FontFamily> - <FontFamily x:Key="Gemunu">/AutoTrackR2;component/Fonts/GemunuLibre-VariableFont_wght.ttf#GemunuLibre</FontFamily> + xmlns:local="clr-namespace:AutoTrackR2" + StartupUri="MainWindow.xaml"> + <Application.Resources> + <FontFamily x:Key="Orbitron">/AutoTrackR2;component/Fonts/Orbitron-Bold.ttf#Orbitron</FontFamily> + <FontFamily x:Key="Roboto">/AutoTrackR2;component/Fonts/Roboto-Regular.ttf#Roboto</FontFamily> + <FontFamily x:Key="Gemunu">/AutoTrackR2;component/Fonts/GemunuLibre-VariableFont_wght.ttf#GemunuLibre</FontFamily> - <!-- Default theme --> - <Color x:Key="AccentColor">#00A9E0</Color> - <Color x:Key="BackgroundDarkColor">#0F1A2B</Color> - <Color x:Key="BackgroundLightColor">#1D2D44</Color> - <Color x:Key="TextColor">#FFFFFF</Color> - <Color x:Key="AltTextColor">#A88F2C</Color> + <!-- Default theme --> + <Color x:Key="AccentColor">#00A9E0</Color> + <Color x:Key="BackgroundDarkColor">#0F1A2B</Color> + <Color x:Key="BackgroundLightColor">#1D2D44</Color> + <Color x:Key="TextColor">#FFFFFF</Color> + <Color x:Key="AltTextColor">#A88F2C</Color> - <SolidColorBrush x:Key="TextBrush" - Color="{DynamicResource TextColor}"/> - <SolidColorBrush x:Key="AccentBrush" - Color="{DynamicResource AccentColor}"/> - <SolidColorBrush x:Key="BackgroundDarkBrush" - Color="{DynamicResource BackgroundDarkColor}"/> - <SolidColorBrush x:Key="BackgroundLightBrush" - Color="{DynamicResource BackgroundLightColor}"/> - <SolidColorBrush x:Key="AltTextBrush" - Color="{DynamicResource AltTextColor}"/> + <SolidColorBrush x:Key="TextBrush" + Color="{DynamicResource TextColor}"/> + <SolidColorBrush x:Key="AccentBrush" + Color="{DynamicResource AccentColor}"/> + <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 --> - <Style TargetType="Window" - x:Key="CustomWindowStyle"> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Window"> - <Border BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="10" - Background="{DynamicResource BackgroundLightBrush}"> - <Grid> - <ContentPresenter HorizontalAlignment="Stretch" - VerticalAlignment="Stretch"/> - </Grid> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <!-- Define the Style for Window --> + <Style TargetType="Window" + x:Key="CustomWindowStyle"> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Window"> + <Border BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="10" + Background="{DynamicResource BackgroundLightBrush}"> + <Grid> + <ContentPresenter HorizontalAlignment="Stretch" + VerticalAlignment="Stretch"/> + </Grid> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Tab Button Style --> - <Style x:Key="TabButtonStyle" - TargetType="Button"> - <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="Cursor" - Value="Hand"/> - <Setter Property="Padding" - Value="10"/> - <Setter Property="Margin" - Value="5"/> - <Setter Property="FontFamily" - Value="{StaticResource Orbitron}"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <!-- ContentPresenter will automatically inherit Foreground from Button --> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> + <!-- Tab Button Style --> + <Style x:Key="TabButtonStyle" + TargetType="Button"> + <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="Cursor" + Value="Hand"/> + <Setter Property="Padding" + Value="10"/> + <Setter Property="Margin" + Value="5"/> + <Setter Property="FontFamily" + Value="{StaticResource Orbitron}"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <!-- ContentPresenter will automatically inherit Foreground from Button --> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> - </Style> + </Style> - <!-- General Button Style --> - <Style x:Key="DisabledButtonStyle" - TargetType="Button"> - <Setter Property="Foreground" - Value="Gray"/> - <Setter Property="Background" - Value="{DynamicResource BackgroundDarkBrush}"/> - <Setter Property="BorderBrush" - 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.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <!-- General Button Style --> + <Style x:Key="DisabledButtonStyle" + TargetType="Button"> + <Setter Property="Foreground" + Value="Gray"/> + <Setter Property="Background" + Value="{DynamicResource BackgroundDarkBrush}"/> + <Setter Property="BorderBrush" + 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.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <Style x:Key="ButtonStyle" - TargetType="Button"> - <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="FontWeight" - Value="Bold"/> - <Setter Property="Cursor" - Value="Hand"/> - <Setter Property="Padding" - Value="5"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <Style x:Key="ButtonStyle" + TargetType="Button"> + <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="FontWeight" + Value="Bold"/> + <Setter Property="Cursor" + Value="Hand"/> + <Setter Property="Padding" + Value="5"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5"> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Title Bar Button Style --> - <Style x:Key="TitleButtonStyle" - TargetType="Button"> - <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="FontWeight" - Value="Bold"/> - <Setter Property="Cursor" - Value="Hand"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Button"> - <Border Background="{TemplateBinding Background}" - BorderBrush="{TemplateBinding BorderBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ContentPresenter HorizontalAlignment="Center" - VerticalAlignment="Center"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <!-- Title Bar Button Style --> + <Style x:Key="TitleButtonStyle" + TargetType="Button"> + <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="FontWeight" + Value="Bold"/> + <Setter Property="Cursor" + Value="Hand"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="5" + Margin="0,1,4,1"> + <ContentPresenter HorizontalAlignment="Center" + VerticalAlignment="Center"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Custom style for text blocks --> - <Style x:Key="RoundedTextBlock" - TargetType="TextBlock"> - <Setter Property="Foreground" - Value="{DynamicResource TextBrush}"/> - <Setter Property="FontFamily" - Value="{StaticResource Roboto}"/> - <Setter Property="Background" - 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> + <!-- Custom style for text blocks --> + <Style x:Key="RoundedTextBlock" + TargetType="TextBlock"> + <Setter Property="Foreground" + Value="{DynamicResource TextBrush}"/> + <Setter Property="FontFamily" + Value="{StaticResource Roboto}"/> + <Setter Property="Background" + 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> - <!-- Wrap TextBlock in Border to apply rounded corners --> - <Style x:Key="RoundedTextBlockWithBorder" - TargetType="Border"> - <Setter Property="Background" - Value="{DynamicResource BackgroundLightBrush}"/> - <Setter Property="BorderBrush" - Value="{DynamicResource AccentBrush}"/> - <Setter Property="BorderThickness" - Value="2"/> - <Setter Property="CornerRadius" - Value="5"/> - <Setter Property="Padding" - Value="0"/> - <Setter Property="Margin" - Value="0,10,0,0"/> - </Style> + <!-- Wrap TextBlock in Border to apply rounded corners --> + <Style x:Key="RoundedTextBlockWithBorder" + TargetType="Border"> + <Setter Property="Background" + Value="{DynamicResource BackgroundLightBrush}"/> + <Setter Property="BorderBrush" + Value="{DynamicResource AccentBrush}"/> + <Setter Property="BorderThickness" + Value="2"/> + <Setter Property="CornerRadius" + Value="5"/> + <Setter Property="Padding" + Value="0"/> + <Setter Property="Margin" + Value="0,10,0,0"/> + </Style> - <!-- Custom Style for Rounded TextBox --> - <Style x:Key="RoundedTextBox" - TargetType="TextBox"> - <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="TextBox"> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="{TemplateBinding BorderThickness}" - CornerRadius="5"> - <ScrollViewer x:Name="PART_ContentHost"/> - </Border> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + <!-- Custom Style for Rounded TextBox --> + <Style x:Key="RoundedTextBox" + TargetType="TextBox"> + <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="TextBox"> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + 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"/> - </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"/> + </Border> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - <!-- Custom Style for Slider --> - <Style x:Key="ThreePositionSlider" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <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.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="200" - Height="30" - HorizontalAlignment="Left" - Margin="58,-6,0,0"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> + <!-- Custom Style for Slider --> + <Style x:Key="ThreePositionSlider" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <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.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="200" + Height="30" + HorizontalAlignment="Left" + Margin="58,-6,0,0"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="{DynamicResource AccentBrush}"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="{DynamicResource AccentBrush}"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Toggle Slider Style --> + <Style x:Key="ToggleSliderStyle" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <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.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="50" + Height="30" + HorizontalAlignment="Left"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> + + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="{DynamicResource AccentBrush}"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- False toggle theme --> + <Style x:Key="FalseToggleStyle" + TargetType="Slider"> + <Setter Property="Height" + Value="40"/> + <Setter Property="Width" + Value="160"/> + <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.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="50" + Height="30" + HorizontalAlignment="Left"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> + + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="Gray"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <!-- Modern Rounded ScrollBar Style --> + <Style TargetType="ScrollBar"> + <Setter Property="Width" + Value="6"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ScrollBar"> + <Grid> + <Track Name="PART_Track" + IsDirectionReversed="true" + Width="6" + Margin="0,0,0,0"> + <!-- Decrease Repeat Button --> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="0"> + <RepeatButton.Template> + <ControlTemplate TargetType="RepeatButton"> + <Grid x:Name="RepeatButtonGrid"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup Name="CommonStates"> + <VisualState Name="Normal"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="1" + Duration="0:0:0"/> + </Storyboard> + </VisualState> + <VisualState Name="MouseOver"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="0" + Duration="0:0:0.1"/> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + </ControlTemplate> + </RepeatButton.Template> + </RepeatButton> + </Track.DecreaseRepeatButton> - <!-- Toggle Slider Style --> - <Style x:Key="ToggleSliderStyle" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <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.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="50" - Height="30" - HorizontalAlignment="Left"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="{DynamicResource AccentBrush}"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- False toggle theme --> - <Style x:Key="FalseToggleStyle" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <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.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="50" - Height="30" - HorizontalAlignment="Left"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> - - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="Gray"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <!-- Modern Rounded ScrollBar Style --> - <Style TargetType="ScrollBar"> - <Setter Property="Width" - Value="6"/> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="ScrollBar"> + <!-- Thumb (Handle) --> + <Track.Thumb> + <Thumb> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> <Grid> - <Track Name="PART_Track" - IsDirectionReversed="true" - Width="6" - Margin="0,0,0,0"> - <!-- Decrease Repeat Button --> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="0"> - <RepeatButton.Template> - <ControlTemplate TargetType="RepeatButton"> - <Grid x:Name="RepeatButtonGrid"> - <VisualStateManager.VisualStateGroups> - <VisualStateGroup Name="CommonStates"> - <VisualState Name="Normal"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="1" - Duration="0:0:0"/> - </Storyboard> - </VisualState> - <VisualState Name="MouseOver"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="0" - Duration="0:0:0.1"/> - </Storyboard> - </VisualState> - </VisualStateGroup> - </VisualStateManager.VisualStateGroups> - </Grid> - </ControlTemplate> - </RepeatButton.Template> - </RepeatButton> - </Track.DecreaseRepeatButton> - - - <!-- Thumb (Handle) --> - <Track.Thumb> - <Thumb> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Grid> - <Border - Background="{DynamicResource AccentBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="0" - CornerRadius="3"/> - </Grid> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - - <!-- Increase Repeat Button --> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="0"> - <RepeatButton.Template> - <ControlTemplate TargetType="RepeatButton"> - <Grid x:Name="RepeatButtonGrid"> - <VisualStateManager.VisualStateGroups> - <VisualStateGroup Name="CommonStates"> - <VisualState Name="Normal"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="1" - Duration="0:0:0"/> - </Storyboard> - </VisualState> - <VisualState Name="MouseOver"> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="Opacity" - Storyboard.TargetName="RepeatButtonGrid" - To="0" - Duration="0:0:0.1"/> - </Storyboard> - </VisualState> - </VisualStateGroup> - </VisualStateManager.VisualStateGroups> - </Grid> - </ControlTemplate> - </RepeatButton.Template> - </RepeatButton> - </Track.IncreaseRepeatButton> - </Track> + <Border + Background="{DynamicResource AccentBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="0" + CornerRadius="3"/> </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> - <!-- Standard Slider Style --> - <Style x:Key="SliderStyle" - TargetType="Slider"> - <Setter Property="Height" - Value="40"/> - <Setter Property="Width" - Value="160"/> - <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.Value> - <ControlTemplate TargetType="Slider"> - <Grid Width="100" - Height="30" - HorizontalAlignment="Left"> - <!-- Track Background --> - <Border Background="{DynamicResource BackgroundDarkBrush}" - BorderBrush="{DynamicResource AccentBrush}" - BorderThickness="2" - CornerRadius="15" - Margin="0,0,-5,-4"/> - - <!-- Track --> - <Track x:Name="PART_Track"> - <Track.Thumb> - <Thumb x:Name="PART_Thumb" - Width="22" - Height="22" - Margin="6,4,1,0"> - <Thumb.Template> - <ControlTemplate TargetType="Thumb"> - <Ellipse Fill="{DynamicResource AccentBrush}"/> - </ControlTemplate> - </Thumb.Template> - </Thumb> - </Track.Thumb> - <Track.DecreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.DecreaseRepeatButton> - <Track.IncreaseRepeatButton> - <RepeatButton Background="Transparent" - BorderBrush="Transparent" - IsHitTestVisible="False"/> - </Track.IncreaseRepeatButton> - </Track> + <!-- Increase Repeat Button --> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="0"> + <RepeatButton.Template> + <ControlTemplate TargetType="RepeatButton"> + <Grid x:Name="RepeatButtonGrid"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup Name="CommonStates"> + <VisualState Name="Normal"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="1" + Duration="0:0:0"/> + </Storyboard> + </VisualState> + <VisualState Name="MouseOver"> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="Opacity" + Storyboard.TargetName="RepeatButtonGrid" + To="0" + Duration="0:0:0.1"/> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> + </ControlTemplate> + </RepeatButton.Template> + </RepeatButton> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> - </Application.Resources> + <!-- Standard Slider Style --> + <Style x:Key="SliderStyle" TargetType="Slider"> + <Setter Property="Height" Value="40"/> + <Setter Property="Width" Value="160"/> + <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.Value> + <ControlTemplate TargetType="Slider"> + <Grid Width="100" Height="30" HorizontalAlignment="Left"> + <!-- Track Background --> + <Border Background="{DynamicResource BackgroundDarkBrush}" + BorderBrush="{DynamicResource AccentBrush}" + BorderThickness="2" + CornerRadius="15" + Margin="0,0,-5,-4"/> + + <!-- Track --> + <Track x:Name="PART_Track"> + <Track.Thumb> + <Thumb x:Name="PART_Thumb" + Width="22" + Height="22" + Margin="6,4,1,0"> + <Thumb.Template> + <ControlTemplate TargetType="Thumb"> + <Ellipse Fill="{DynamicResource AccentBrush}"/> + </ControlTemplate> + </Thumb.Template> + </Thumb> + </Track.Thumb> + <Track.DecreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.DecreaseRepeatButton> + <Track.IncreaseRepeatButton> + <RepeatButton Background="Transparent" + BorderBrush="Transparent" + IsHitTestVisible="False"/> + </Track.IncreaseRepeatButton> + </Track> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + </Application.Resources> </Application> diff --git a/AutoTrackR2/App.xaml.cs b/AutoTrackR2/App.xaml.cs index 55a1e85..e9a45e7 100644 --- a/AutoTrackR2/App.xaml.cs +++ b/AutoTrackR2/App.xaml.cs @@ -23,43 +23,28 @@ namespace AutoTrackR2 protected override void OnStartup(StartupEventArgs e) { - try + // Ensure crash log directory exists + Directory.CreateDirectory(Path.GetDirectoryName(CrashLogPath)); + + // Set up unhandled exception handlers + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + DispatcherUnhandledException += App_DispatcherUnhandledException; + + const string appName = "AutoTrackR2"; + bool createdNew; + + _mutex = new Mutex(true, appName, out createdNew); + _mutexOwned = createdNew; + + if (!createdNew) { - // Ensure crash log directory exists - Directory.CreateDirectory(Path.GetDirectoryName(CrashLogPath)); - - // Set up unhandled exception handlers - AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; - DispatcherUnhandledException += App_DispatcherUnhandledException; - - const string appName = "AutoTrackR2"; - bool createdNew; - - _mutex = new Mutex(true, appName, out createdNew); - _mutexOwned = createdNew; - - if (!createdNew) - { - // App is already running, show message and exit - MessageBox.Show("AutoTrackR2 is already running.", "AutoTrackR2", MessageBoxButton.OK, MessageBoxImage.Information); - Current.Shutdown(); - return; - } - - // Initialize StreamlinkHandler before creating the main window - _streamlinkHandler = new StreamlinkHandler(); - - // Create and show the main window - var mainWindow = new MainWindow(); - mainWindow.Show(); - - base.OnStartup(e); - } - catch (Exception ex) - { - MessageBox.Show($"Failed to start AutoTrackR2: {ex.Message}", "AutoTrackR2 Error", MessageBoxButton.OK, MessageBoxImage.Error); + // App is already running, silently exit Current.Shutdown(); + return; } + + base.OnStartup(e); + _streamlinkHandler = new StreamlinkHandler(); } private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) @@ -110,24 +95,20 @@ namespace AutoTrackR2 protected override void OnExit(ExitEventArgs e) { - try + if (_mutex != null && _mutexOwned) { - if (_mutex != null && _mutexOwned) + try { _mutex.ReleaseMutex(); - _mutex.Close(); - _mutex = null; } + catch (Exception ex) + { + // Log the mutex release error but don't throw + LogCrash(ex); + } + _mutex.Dispose(); } - catch (Exception ex) - { - // Log the error but don't prevent shutdown - File.AppendAllText(CrashLogPath, $"[{DateTime.Now}] Error during shutdown: {ex.Message}\n"); - } - finally - { - base.OnExit(e); - } + base.OnExit(e); } } } diff --git a/AutoTrackR2/Constants/Weapons.cs b/AutoTrackR2/Constants/Weapons.cs deleted file mode 100644 index af841ed..0000000 --- a/AutoTrackR2/Constants/Weapons.cs +++ /dev/null @@ -1,396 +0,0 @@ -using System.Collections.Generic; - -namespace AutoTrackR2.Constants; - -public static class Weapons -{ - public static readonly List<string> List = new List<string> - { - "gmni_rifle_ballistic_01_firerats01", - "utfl_melee_01_gungame", - "volt_rifle_energy_01_black_gold01", - "behr_glauncher_ballistic_01_cen01", - "behr_optics_tsco_x16_s3", - "klwe_rifle_energy_01_black02", - "behr_optics_rdot_x1_s1", - "ksar_shotgun_energy_01_blue01", - "ksar_smg_energy_01_white02", - "gmni_optics_tsco_x4_s2", - "gmni_pistol_ballistic_01_white02", - "behr_lmg_ballistic_01", - "gmni_pistol_ballistic_01_gold01", - "grin_multitool_01_default_cutter", - "apar_special_ballistic_02_mag", - "apar_special_ballistic_01_mag", - "klwe_sniper_energy_01_tan01", - "ksar_shotgun_ballistic_01_green01", - "test_Gadget", - "ksar_rifle_energy_01_iae2023", - "Carryable_1H_CU_Glowstick_Orange", - "none_smg_energy_01", - "weapon_underbarrel_light_wide", - "volt_rifle_energy_01_tint01", - "nvtc_optics_holo_x1_s1_LAMP", - "gmni_pistol_ballistic_01_white01", - "grin_multitool_01_black01", - "ksar_shotgun_energy_01_tan01", - "ksar_shotgun_energy_01_cen01", - "ksar_rifle_energy_01_red_green01", - "ksar_smg_energy_01_mag", - "grin_multitool_01_default_grapple", - "behr_rifle_ballistic_02_civilian_blue01", - "nvtc_ubarrel_flsh_s1_02", - "nvtc_ubarrel_flsh_s1", - "lbco_sniper_energy_01", - "behr_rifle_ballistic_01_mag", - "apar_special_ballistic_01_tan01", - "none_smg_energy_01_mag", - "banu_melee_01_blue01", - "crlf_medgun_01_purple01", - "klwe_ubarrel_lasr_s1_02", - "ksar_melee_01", - "gmni_lmg_ballistic_01_mag", - "ksar_smg_energy_01_black01", - "gmni_smg_ballistic_01_firerats01", - "crlf_medgun_01_grey01", - "behr_pistol_ballistic_01_300", - "behr_sniper_ballistic_01_arctic01", - "sasu_pistol_toy_01_orange_purple01", - "klwe_sniper_energy_01_Luminalia_red01", - "Carryable_1H_CU_Glowstick_Yellow", - "klwe_lmg_energy_01", - "ksar_optics_tsco_x8_s3", - "ksar_rifle_energy_01_pink_red01", - "apar_special_ballistic_02_mat01", - "behr_glauncher_ballistic_01", - "ksar_shotgun_ballistic_01_firerats01", - "grin_salvage_repair_01", - "apar_special_ballistic_01_mat01", - "ksar_shotgun_ballistic_01_luminalia_blue01", - "gmni_smg_ballistic_01_Luminalia", - "apar_special_ballistic_02_missile", - "volt_rifle_energy_01_mag", - "ksar_pistol_ballistic_01_mag", - "ksar_shotgun_energy_01_green01", - "kegr_fire_extinguisher_01_mag", - "gmni_rifle_ballistic_01_iae2023", - "grin_multitool_01_healing", - "gmni_pistol_ballistic_01_red_black01", - "klwe_optics_disp_x8_s3", - "ksar_smg_energy_01_firerats01", - "behr_lmg_ballistic_01_yellow_grey01", - "behr_smg_ballistic_01_mag", - "klwe_smg_energy_01_blue_gold", - "gmni_sniper_ballistic_01_iae2201", - "sasu_pistol_toy_01_mag_ea_elim", - "nvtc_ubarrel_flsh_s1_04", - "gmni_pistol_ballistic_01_tan01", - "behr_lmg_ballistic_01_mag", - "klwe_rifle_energy_01_white01", - "Carryable_1H_CU_Glowstick_Green_Active", - "behr_shotgun_ballistic_01_blue_white01", - "Carryable_1H_CU_Glowstick_Pink", - "behr_optics_holo_x3_s1", - "klwe_smg_energy_01", - "klwe_sniper_energy_01_gold01", - "klwe_rifle_energy_01_gold01", - "lbco_pistol_energy_01", - "hdgw_pistol_ballistic_01_engraved02", - "gmni_sniper_ballistic_01_firerats01", - "klwe_rifle_energy_01_black01", - "none_shotgun_ballistic_01", - "gmni_sniper_ballistic_01_urban01", - "ksar_smg_energy_01_cc17a", - "behr_pistol_ballistic_01", - "gmni_smg_ballistic_01_mag", - "nvtc_optics_tsco_x4_s2_LAMP", - "behr_prx_kinetic_01", - "behr_smg_ballistic_01_iae2201", - "gmni_lmg_ballistic_01_firerats01", - "ksar_smg_energy_01_cc17b", - "ksar_pistol_ballistic_01_iae2023", - "ksar_smg_energy_01_black02", - "nvtc_optics_holo_x2_s1_LAMP", - "grin_multitool_01_cutter", - "utfl_melee_01_red01_gungame_rotated", - "gmni_rifle_ballistic_01_grey_red01", - "behr_shotgun_ballistic_01_mag", - "behr_rifle_ballistic_02_civilian", - "grin_multitool_01_default_salvage_repair", - "gmni_rifle_ballistic_01", - "gmni_sniper_ballistic_01_arctic01", - "grin_tool_salvage_repair_01", - "gmni_optics_tsco_x8_s3_firerats01", - "weapon_underbarrel_light_wide_blue_01", - "weapon_underbarrel_light_wide_gold_01", - "Carryable_1H_CY_universal_utensil_a", - "behr_smg_ballistic_01_white01", - "weapon_underbarrel_light_wide_red_01", - "klwe_ubarrel_lasr_s1", - "Carryable_1H_CU_Glowstick_Red_Active", - "gmni_shotgun_ballistic_01_red_black01", - "behr_smg_ballistic_01_black02", - "nvtc_optics_tsco_x4_s2", - "klwe_sniper_energy_01_black01", - "klwe_pistol_energy_01_black01", - "grin_multitool_01_brown01", - "volt_rifle_energy_01_camo01", - "klwe_sniper_energy_01_mag", - "klwe_sniper_energy_01_imp01", - "grin_multitool_01_default_charge_drain", - "apar_special_ballistic_01", - "ksar_shotgun_ballistic_01", - "kegr_fire_extinguisher_01_Igniter", - "ksar_smg_energy_01_green01", - "utfl_melee_01_red01_gungame", - "behr_glauncher_ballistic_01_black01", - "behr_rifle_ballistic_01_black02", - "grin_multitool_01_silver01", - "gmni_smg_ballistic_01_purple01", - "lbco_pistol_energy_01_acid01", - "gmni_sniper_ballistic_01_imp01", - "ksar_smg_energy_01", - "behr_smg_ballistic_01_tan01", - "gmni_pistol_ballistic_01_blue_white01", - "grin_tractor_01", - "lbco_optics_tsco_x16_s3", - "behr_sniper_ballistic_01", - "klwe_sniper_energy_01_white01", - "volt_rifle_energy_01_collector02", - "weaponMount_nvtc_optics_holo_x1_s1", - "Optics_Attachment", - "grin_multitool_01_default_tractorbeam_maelstromtest", - "ksar_melee_01_brown01", - "behr_rifle_ballistic_02_civilian_digi01", - "crlf_medgun_01_red01", - "grin_multitool_01_white01", - "klwe_pistol_energy_01_chromic01", - "behr_glauncher_ballistic_01_shin01", - "ksar_melee_01_red01", - "JanitorMob", - "ksar_shotgun_ballistic_01_mag", - "behr_rifle_ballistic_01_white02", - "klwe_sniper_energy_01_black02", - "klwe_sniper_energy_01", - "crlf_medgun_vial_01", - "grin_tool_01_mag", - "gmni_smg_ballistic_01", - "lbco_sniper_energy_01_chromic01", - "ksar_shotgun_energy_01_imp01", - "sasu_pistol_toy_01_mag", - "nvtc_ubarrel_lasr_s1", - "behr_sniper_ballistic_01_mag", - "grin_multitool_01", - "ksar_melee_01_blue01", - "lbco_sniper_energy_01_sunset01", - "ksar_rifle_energy_01_test_inf_ammo", - "ksar_rifle_energy_01_red01", - "ksar_sniper_ballistic_01", - "gmni_sniper_ballistic_01", - "ksar_rifle_energy_01_cian_black01", - "Carryable_1H_CU_Glowstick_Yellow_Active", - "behr_smg_ballistic_01_gold01", - "gmni_lmg_ballistic_01", - "gmni_rifle_ballistic_01_firerats02", - "grin_tractor_01_mag", - "klwe_sniper_energy_01_cen01", - "gmni_shotgun_ballistic_01", - "gmni_shotgun_ballistic_01_mag", - "volt_rifle_energy_01_collector03", - "hdgw_pistol_ballistic_01_mag", - "behr_rifle_ballistic_01", - "behr_smg_ballistic_01_white02", - "ksar_smg_energy_01_cc17", - "banu_melee_01_red01", - "behr_optics_tsco_x4_s2", - "vlk_spewgun_ballistic_01_mag_juvi", - "glsn_smg_energy_01", - "ksar_rifle_energy_01_blue_gold", - "gmni_lmg_ballistic_01_blue_gold", - "ksar_pistol_ballistic_01", - "sasu_pistol_toy_01", - "Multitool_Attachment", - "grin_multitool_01_energy_placeholder", - "gmni_pistol_ballistic_01_black02", - "ksar_melee_01_orange01", - "grin_multitool_01_mining", - "ksar_rifle_energy_01_firerats01", - "volt_rifle_energy_01_collector04", - "lbco_pistol_energy_01_mag", - "nvtc_optics_tsco_x8_s3_LAMP", - "ksar_smg_energy_01_spc_01", - "behr_pistol_ballistic_01_firerats01", - "banu_melee_01", - "ksar_shotgun_energy_01_white02", - "klwe_pistol_energy_01_white01", - "grin_multitool_01_salvage_repair", - "gmni_pistol_ballistic_01_mag", - "banu_melee_01_green01", - "rrs_melee_01_fallout01", - "volt_rifle_energy_01", - "ksar_sniper_ballistic_01_white_blue_01", - "behr_smg_ballistic_01_green01", - "kegr_fire_extinguisher_01", - "ksar_pistol_ballistic_01_headhunters01", - "apar_special_ballistic_01_black02", - "klwe_rifle_energy_01_mag", - "ksar_rifle_energy_01_firerats01_spc", - "klwe_lmg_energy_01_purple_blue01", - "ksar_pistol_ballistic_01_purple_pink01", - "nvtc_optics_holo_x3_s1", - "grin_multitool_resource_salvage_repair_01_filled", - "ksar_shotgun_energy_01_purple01", - "gmni_rifle_ballistic_01_mag", - "weapon_underbarrel_light_narrow_gold_01", - "lbco_sniper_energy_01_acid01", - "nvtc_optics_tsco_x4_s2_firerats01", - "gmni_pistol_ballistic_01_firerats01", - "klwe_rifle_energy_01_green01", - "lbco_pistol_energy_01_sunset01", - "sasu_pistol_toy_01_blue_pink01", - "volt_rifle_energy_01_tint02", - "gmni_smg_ballistic_01_spc_01", - "ksar_pistol_ballistic_01_yellow_black01", - "grin_multitool_02_AR_HUD", - "ksar_shotgun_energy_01_black01", - "klwe_rifle_energy_01_white02", - "ksar_smg_energy_01_gold01", - "grin_multitool_01_default_tractorbeam", - "utfl_melee_01_red01", - "gmni_pistol_ballistic_01_imp01", - "weapon_underbarrel_light_narrow_blue_01", - "behr_smg_ballistic_01_black01", - "weapon_underbarrel_light_wide_purple_01", - "nvtc_optics_rdot_x1_s1_firerats01", - "Carryable_1H_CY_universal_utensil_b", - "behr_lmg_ballistic_01_luminalia_green01", - "weapon_underbarrel_light_narrow_purple_01", - "gmni_lmg_ballistic_01_purple01", - "grin_multitool_01_default_mining", - "gmni_rifle_ballistic_01_yellow_blue01", - "crlf_medgun_01_yellow01", - "none_shotgun_ballistic_01_green01", - "ksar_shotgun_ballistic_01_iae2201", - "behr_rifle_ballistic_01_spc_01", - "grin_multitool_01_AI", - "weapon_underbarrel_light_narrow_red_01", - "nvtc_optics_holo_x1_s1", - "vlk_spewgun_ballistic_reference", - "ksar_shotgun_energy_01", - "none_shotgun_ballistic_01_mag", - "grin_multitool_01_tractorbeam", - "klwe_pistol_energy_01_tan01", - "glsn_shotgun_ballistic_01_mag", - "Tablet_Small", - "ksar_smg_energy_01_black_green01", - "klwe_rifle_energy_01", - "lbco_sniper_energy_imp01", - "ksar_rifle_energy_01_blue_gold_spc_01", - "Carryable_1H_CU_Glowstick_Blue", - "behr_optics_holo_x2_s1", - "grin_multitool_01_red01", - "weapon_underbarrel_light_narrow", - "hdgw_pistol_ballistic_01", - "behr_rifle_ballistic_02_mag_civilian", - "none_melee_01", - "gmni_lmg_ballistic_01_green_red01", - "ksar_rifle_energy_01", - "lbco_pistol_energy_01_chromic01", - "ksar_shotgun_energy_01_red01", - "nvtc_optics_holo_x3_s1_LAMP", - "klwe_smg_energy_01_mag", - "behr_glauncher_ballistic_01_mat01", - "Carryable_1H_CU_Glowstick_Red", - "ksar_shotgun_energy_01_black02", - "grin_multitool_01_orange01", - "vlk_spewgun_ballistic_01_juvi", - "Carryable_1H_CU_Glowstick_Green", - "klwe_rifle_energy_01_tan01", - "vlk_spewgun_ballistic_01_mag", - "banu_melee_02", - "apar_special_ballistic_02", - "behr_gren_frag_01", - "klwe_sniper_energy_01_green01", - "behr_optics_tsco_x8_s3", - "behr_rifle_ballistic_01_green01", - "grin_multitool_resource_salvage_repair_01", - "ksar_shotgun_energy_01_mag", - "behr_shotgun_ballistic_01", - "klwe_pistol_energy_01_black02", - "Carryable_1H_CU_Glowstick_Blue_Active", - "gmni_smg_ballistic_01_blue_white01", - "nvtc_ubarrel_flsh_s1_03", - "ksar_smg_energy_01_red01", - "ksar_pistol_ballistic_01_spc", - "gmni_shotgun_ballistic_01_pink_red01", - "klwe_pistol_energy_01_engraved01", - "crlf_medgun_01", - "gmni_pistol_ballistic_01", - "Carryable_1H_CY_universal_utensil_c", - "grin_cutter_01", - "rrs_melee_01_orange01", - "klwe_ubarrel_flsh_s1", - "gmni_smg_ballistic_01_grey_red01", - "Carryable_1H_CU_Flare_Medivac", - "utfl_melee_01_brown01", - "klwe_pistol_energy_01_gold01", - "gmni_sniper_ballistic_01_mag", - "grin_multitool_01_default_cutter_AI", - "ksar_shotgun_energy_01_gold01", - "ksar_shotgun_energy_01_black_purple01", - "lbco_pistol_energy_cen01", - "gmni_smg_ballistic_01_green_grey01", - "behr_rifle_ballistic_02_civilian_black01", - "klwe_pistol_energy_01_mag", - "grin_multitool_energy_01_mag", - "sasu_pistol_toy_01_blue_yellow01", - "nvtc_ubarrel_flsh_s1_firerats01", - "Underbarrel_Attachment", - "volt_rifle_energy_01_collector01", - "klwe_lmg_energy_01_iae2201", - "behr_sniper_ballistic_01_black01", - "ksar_smg_energy_01_tan01", - "apar_melee_01", - "behr_glauncher_ballistic_01_imp01", - "klwe_lmg_energy_01_mag", - "nvtc_optics_rdot_x1_s1", - "Carryable_1H_CU_Glowstick_Pink_Active", - "gmni_pistol_ballistic_01_green01", - "gmni_pistol_ballistic_01_green_grey01", - "lbco_sniper_energy_01_mag", - "Carryable_1H_CU_Glowstick_Pink_Active_Prison", - "behr_optics_holo_x1_s1", - "grin_multitool_01_default_healing", - "gmni_optics_tsco_x8_s3", - "behr_pistol_ballistic_01_mag", - "gmni_pistol_ballistic_01_cen01", - "gmni_optics_tsco_x4_s2_firerats01", - "klwe_pistol_energy_01", - "nvtc_optics_rdot_x1_s1_LAMP", - "nvtc_optics_holo_x2_s1", - "ksar_sniper_ballistic_01_mag", - "gmni_pistol_ballistic_01_pink_cian01", - "behr_lmg_ballistic_01_xenothreat01", - "behr_smg_ballistic_01", - "sasu_pistol_toy_01_ea_elim", - "klwe_pistol_energy_01_white02", - "Carryable_1H_CU_Glowstick_Luminalia", - "Carryable_1H_CY_cutlery_chopsticks_set_1_a", - "banu_melee_03", - "Carryable_1H_CU_Glowstick_Orange_Active", - "gmni_shotgun_ballistic_01_firerats01", - "vlk_spewgun_ballistic_01_mag_adult", - "klwe_rifle_energy_01_iae2201", - "nvtc_optics_tsco_x8_s3", - "hdgw_pistol_ballistic_01_engraved01", - "behr_rifle_ballistic_01_tan01", - "klwe_sniper_energy_01_white02", - "utfl_melee_01", - "gmni_sniper_ballistic_01_green_grey01", - "klwe_pistol_energy_01_green01", - "utfl_melee_01_grey01", - "ksar_rifle_energy_01_mag", - "grin_multitool_resource_healing_01", - "behr_glauncher_ballistic_01_mag" - }; -} \ No newline at end of file diff --git a/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs b/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs index ab57536..56741f5 100644 --- a/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs +++ b/AutoTrackR2/LogEventHandlers/ActorDeathEvent.cs @@ -1,6 +1,5 @@ using System.Text.RegularExpressions; using AutoTrackR2.Constants; -using AutoTrackR2; namespace AutoTrackR2.LogEventHandlers; @@ -18,9 +17,9 @@ public struct ActorDeathData public class ActorDeathEvent : ILogEventHandler { public Regex Pattern { get; } + private Regex _cleanUpPattern = new Regex(@"^(.+?)_\d+$"); private Regex _shipManufacturerPattern; private string _lastKillShip = string.Empty; - private Regex cleanUpPattern = new Regex(@"^(.+?)(?:_\d+)*$"); public ActorDeathEvent() { @@ -30,6 +29,12 @@ public class ActorDeathEvent : ILogEventHandler private bool IsValidShip(string shipName) { + // Clean up the ship name first + if (_cleanUpPattern.IsMatch(shipName)) + { + shipName = _cleanUpPattern.Match(shipName).Groups[1].Value; + } + // A valid ship must start with a known manufacturer return _shipManufacturerPattern.IsMatch(shipName); } @@ -52,16 +57,10 @@ public class ActorDeathEvent : ILogEventHandler Timestamp = match.Groups["Timestamp"].Value }; - // Check if the damage type is TakeDown or Melee - if (data.DamageType == "TakeDown" || data.DamageType == "Melee") + // Clean up weapon name + if (_cleanUpPattern.IsMatch(data.Weapon)) { - LocalPlayerData.PlayerShip = "Player"; - } - - // Check if the weapon is in our list of weapons - if (Weapons.List.Contains(data.Weapon)) - { - LocalPlayerData.PlayerShip = "Player"; + data.Weapon = _cleanUpPattern.Match(data.Weapon).Groups[1].Value; } // First check if this is a valid ship @@ -81,18 +80,8 @@ public class ActorDeathEvent : ILogEventHandler _lastKillShip = data.VictimShip; } } - - // Clean up ship and weapon names (only if not set to Player or Passenger) - if (data.VictimShip != "Player" && data.VictimShip != "Passenger" && cleanUpPattern.IsMatch(data.VictimShip)) - { - data.VictimShip = cleanUpPattern.Match(data.VictimShip).Groups[1].Value; - } - - if (cleanUpPattern.IsMatch(data.Weapon)) - { - data.Weapon = cleanUpPattern.Match(data.Weapon).Groups[1].Value; - } - + + TrackREventDispatcher.OnActorDeathEvent(data); } } \ No newline at end of file diff --git a/AutoTrackR2/StreamlinkHandler.cs b/AutoTrackR2/StreamlinkHandler.cs index 9fa4e0e..6cdda86 100644 --- a/AutoTrackR2/StreamlinkHandler.cs +++ b/AutoTrackR2/StreamlinkHandler.cs @@ -53,7 +53,7 @@ public class StreamlinkHandler { var outputPath = Path.Combine( ConfigManager.VideoPath ?? Environment.GetFolderPath(Environment.SpecialFolder.MyVideos), - $"{streamerHandle}_{DateTime.Now:yyyyMMdd_HHmmss}.mp4" + $"kill_{DateTime.Now:yyyyMMdd_HHmmss}.mp4" ); // Calculate the duration for recording (30 seconds before + configured duration after)