mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-05-20 16:05:30 +00:00
Changed Config Formatting
Fixed an issue with the video path looking for a file when it needed to be defined as a folder... https://www.youtube.com/watch?v=ahKH19iN2SM
This commit is contained in:
parent
1f35e0a9e6
commit
daf6954e74
2 changed files with 61 additions and 47 deletions
AutoTrackR2
|
@ -26,7 +26,7 @@
|
|||
VerticalAlignment="Center"
|
||||
Height="389">
|
||||
<!-- Log File -->
|
||||
<StackPanel Margin="0,10,0,15"
|
||||
<StackPanel Margin="0,5,0,10"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="ⓘ"
|
||||
ToolTip="Set this to the Game.log file in your StarCitizen\LIVE directory."
|
||||
|
@ -55,7 +55,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<!-- API URL -->
|
||||
<StackPanel Margin="0,0,0,15"
|
||||
<StackPanel Margin="0,0,0,10"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="ⓘ"
|
||||
ToolTip="Need a URL? No idea what to do? Contact heavy_bob on Discord!"
|
||||
|
@ -83,7 +83,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<!-- API Key -->
|
||||
<StackPanel Margin="0,0,0,15"
|
||||
<StackPanel Margin="0,0,0,10"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="ⓘ"
|
||||
ToolTip="Need a key? No idea what to do? Contact heavy_bob on Discord!"
|
||||
|
@ -102,7 +102,7 @@
|
|||
</StackPanel>
|
||||
|
||||
<!-- Video Path -->
|
||||
<StackPanel Margin="0,0,0,15"
|
||||
<StackPanel Margin="0,0,0,10"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock Text="ⓘ"
|
||||
ToolTip="The directory where your clipping software saves kills. Check the README."
|
||||
|
@ -129,18 +129,31 @@
|
|||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Visor Wipe Toggle Slider -->
|
||||
<StackPanel Margin="0,0,0,15"
|
||||
Orientation="Horizontal">
|
||||
<!-- Toggle Settings Grid -->
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Visor Wipe Toggle -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="0"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,0,5,5">
|
||||
<TextBlock Text="ⓘ"
|
||||
ToolTip="Perform a Visor Wipe animation on player kill. Requires AHKv2."
|
||||
Foreground="{DynamicResource TextBrush}"
|
||||
FontSize="20"
|
||||
Margin="0,4,3,5"/>
|
||||
Margin="0,4,3,0"/>
|
||||
<TextBlock Text="Visor Wipe:"
|
||||
Foreground="{DynamicResource TextBrush}"
|
||||
FontSize="16"
|
||||
Margin="0,7,0,5"/>
|
||||
Margin="0,7,0,0"/>
|
||||
<Slider Name="VisorWipeSlider"
|
||||
Minimum="0"
|
||||
Maximum="1"
|
||||
|
@ -148,22 +161,24 @@
|
|||
IsSnapToTickEnabled="True"
|
||||
Value="0"
|
||||
Style="{StaticResource ToggleSliderStyle}"
|
||||
Margin="27,-4,0,0"
|
||||
Margin="10,-4,0,0"
|
||||
Width="100"
|
||||
ValueChanged="VisorWipeSlider_ValueChanged"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Video Record Toggle Slider -->
|
||||
<StackPanel Margin="0,0,0,15"
|
||||
Orientation="Horizontal">
|
||||
<!-- Video Record Toggle -->
|
||||
<StackPanel Grid.Column="1" Grid.Row="0"
|
||||
Orientation="Horizontal"
|
||||
Margin="5,0,0,5">
|
||||
<TextBlock Text="ⓘ"
|
||||
ToolTip="Automatically clip your last kill. Check the README for more info."
|
||||
Foreground="{DynamicResource TextBrush}"
|
||||
FontSize="20"
|
||||
Margin="0,4,3,5"/>
|
||||
Margin="0,4,3,0"/>
|
||||
<TextBlock Text="Video Record:"
|
||||
Foreground="{DynamicResource TextBrush}"
|
||||
FontSize="16"
|
||||
Margin="0,7,0,5"/>
|
||||
Margin="0,7,0,0"/>
|
||||
<Slider Name="VideoRecordSlider"
|
||||
Minimum="0"
|
||||
Maximum="1"
|
||||
|
@ -172,21 +187,23 @@
|
|||
Value="0"
|
||||
Style="{StaticResource ToggleSliderStyle}"
|
||||
Margin="10,-4,0,0"
|
||||
Width="100"
|
||||
ValueChanged="VideoRecordSlider_ValueChanged"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Offline Mode Toggle Slider -->
|
||||
<StackPanel Margin="0,0,0,10"
|
||||
Orientation="Horizontal">
|
||||
<!-- Offline Mode Toggle -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="1"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,0,5,5">
|
||||
<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"/>
|
||||
Margin="0,4,3,0"/>
|
||||
<TextBlock Text="Offline Mode:"
|
||||
Foreground="{DynamicResource TextBrush}"
|
||||
FontSize="16"
|
||||
Margin="0,7,0,5"/>
|
||||
Margin="0,7,0,0"/>
|
||||
<Slider Name="OfflineModeSlider"
|
||||
Minimum="0"
|
||||
Maximum="1"
|
||||
|
@ -194,17 +211,20 @@
|
|||
IsSnapToTickEnabled="True"
|
||||
Value="0"
|
||||
Style="{StaticResource ToggleSliderStyle}"
|
||||
Margin="12,-4,0,0"
|
||||
Margin="10,-4,0,0"
|
||||
Width="100"
|
||||
ValueChanged="OfflineModeSlider_ValueChanged"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- 3-Position Toggle Slider -->
|
||||
<StackPanel Margin="0,0,0,15"
|
||||
Orientation="Horizontal">
|
||||
<!-- Theme Slider -->
|
||||
<StackPanel Grid.Column="0" Grid.Row="2"
|
||||
Grid.ColumnSpan="2"
|
||||
Orientation="Horizontal"
|
||||
Margin="0,0,0,5">
|
||||
<TextBlock Text="Theme:"
|
||||
Foreground="{DynamicResource TextBrush}"
|
||||
FontSize="16"
|
||||
Margin="0,7,0,5"/>
|
||||
Margin="0,7,10,0"/>
|
||||
<Slider x:Name="ThemeSlider"
|
||||
Minimum="0"
|
||||
Value="0"
|
||||
|
@ -213,8 +233,8 @@
|
|||
ValueChanged="ThemeSlider_ValueChanged"
|
||||
Width="447"
|
||||
Style="{StaticResource ThreePositionSlider}"/>
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Save Button -->
|
||||
|
|
|
@ -39,7 +39,6 @@ public partial class ConfigPage : UserControl
|
|||
|
||||
ApplyToggleModeStyle(OfflineModeSlider.Value, VisorWipeSlider.Value, VideoRecordSlider.Value);
|
||||
|
||||
|
||||
const string themeJsonPath = "themes.json";
|
||||
var themeJson = File.ReadAllText(themeJsonPath);
|
||||
_themes = JsonSerializer.Deserialize<Dictionary<string, Theme>>(themeJson);
|
||||
|
@ -78,23 +77,19 @@ public partial class ConfigPage : UserControl
|
|||
}
|
||||
|
||||
// This method will set the loaded config values to the UI controls
|
||||
public void SetConfigValues(string logFile, string apiUrl, string apiKey, string videoPath,
|
||||
int visorWipe, int videoRecord, int offlineMode, int theme)
|
||||
public void SetConfigValues(string logFile, string apiUrl, string apiKey, string videoPath, int visorWipe, int videoRecord, int offlineMode, int theme)
|
||||
{
|
||||
// Set the textboxes with the loaded values
|
||||
LogFilePath.Text = logFile;
|
||||
ApiUrl.Text = apiUrl;
|
||||
ApiKey.Password = apiKey;
|
||||
VideoPath.Text = videoPath;
|
||||
|
||||
// Set the sliders with the loaded values
|
||||
VideoRecordSlider.Value = videoRecord;
|
||||
VisorWipeSlider.Value = visorWipe;
|
||||
VideoRecordSlider.Value = videoRecord;
|
||||
OfflineModeSlider.Value = offlineMode;
|
||||
ThemeSlider.Value = theme;
|
||||
|
||||
// Handle themes
|
||||
ApplyTheme(theme);
|
||||
|
||||
}
|
||||
|
||||
private void ApplyToggleModeStyle(double offlineModeValue, double visorWipeValue, double videoRecordValue)
|
||||
|
@ -202,18 +197,18 @@ public partial class ConfigPage : UserControl
|
|||
// Video Path Browse Button Handler
|
||||
private void VideoPathBrowseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var dialog = new OpenFileDialog();
|
||||
dialog.CheckFileExists = false;
|
||||
var dialog = new Microsoft.Win32.OpenFileDialog();
|
||||
dialog.ValidateNames = false;
|
||||
dialog.Filter = "All files|*.*";
|
||||
|
||||
if (dialog.ShowDialog() == true && dialog.FileName != null)
|
||||
dialog.CheckFileExists = false;
|
||||
dialog.CheckPathExists = true;
|
||||
dialog.FileName = "Folder Selection";
|
||||
|
||||
if (dialog.ShowDialog() == true)
|
||||
{
|
||||
// Extract only the directory path from the file
|
||||
string? selectedFolder = Path.GetDirectoryName(dialog.FileName);
|
||||
if (selectedFolder != null)
|
||||
{
|
||||
VideoPath.Text = selectedFolder; // Set the folder path
|
||||
VideoPath.Text = selectedFolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -320,10 +315,8 @@ public partial class ConfigPage : UserControl
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
ConfigManager.ApiKey = ApiKey.Password;
|
||||
ConfigManager.ApiUrl = ApiUrl.Text;
|
||||
ConfigManager.LogFile = LogFilePath.Text;
|
||||
|
@ -332,6 +325,7 @@ public partial class ConfigPage : UserControl
|
|||
ConfigManager.VideoRecord = (int)VideoRecordSlider.Value;
|
||||
ConfigManager.OfflineMode = (int)OfflineModeSlider.Value;
|
||||
ConfigManager.Theme = (int)ThemeSlider.Value;
|
||||
|
||||
// Save the current config values
|
||||
ConfigManager.SaveConfig();
|
||||
// Start the flashing effect
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue