mirror of
https://github.com/BubbaGumpShrump/AutoTrackR2.git
synced 2025-05-21 16:25:31 +00:00
File save updates
This commit is contained in:
parent
d74a14948d
commit
10e88866f5
6 changed files with 55 additions and 17 deletions
|
@ -17,8 +17,10 @@
|
|||
<None Remove="Assets\NW.png" />
|
||||
<None Remove="Assets\VOX.png" />
|
||||
<None Remove="Assets\WRITH.jpg" />
|
||||
<None Remove="config.ini" />
|
||||
<None Remove="Fonts\Orbitron-Bold.ttf" />
|
||||
<None Remove="Fonts\Roboto-Regular.ttf" />
|
||||
<None Remove="kill-log.csv" />
|
||||
<None Remove="KillTrackR_MainScript.ps1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -45,12 +47,14 @@
|
|||
<Resource Include="Assets\WRITH.jpg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="config.ini" />
|
||||
<Resource Include="Fonts\Orbitron-Bold.ttf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="Fonts\Roboto-Regular.ttf">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
<Resource Include="kill-log.csv" />
|
||||
<EmbeddedResource Include="KillTrackR_MainScript.ps1">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -350,11 +350,20 @@ namespace AutoTrackR2
|
|||
|
||||
private void SaveButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Get the directory of the running executable
|
||||
string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
// Get the directory for the user's local application data
|
||||
string appDataDirectory = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"AutoTrackR2"
|
||||
);
|
||||
|
||||
// Combine the executable directory with the config file name
|
||||
string configFilePath = Path.Combine(exeDirectory, "config.ini");
|
||||
// Ensure the directory exists
|
||||
if (!Directory.Exists(appDataDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(appDataDirectory);
|
||||
}
|
||||
|
||||
// Combine the app data directory with the config file name
|
||||
string configFilePath = Path.Combine(appDataDirectory, "config.ini");
|
||||
|
||||
using (StreamWriter writer = new StreamWriter(configFilePath))
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
$TrackRver = "2.0"
|
||||
|
||||
# Path to the config file
|
||||
$scriptFolder = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$appName = "AutoTrackR2"
|
||||
$scriptFolder = Join-Path -Path (Join-Path -Path $env:LOCALAPPDATA -ChildPath $appName)
|
||||
$configFile = Join-Path -Path $scriptFolder -ChildPath "config.ini"
|
||||
|
||||
# Read the config file into a hashtable
|
||||
|
|
|
@ -188,8 +188,12 @@ namespace AutoTrackR2
|
|||
|
||||
public static void LoadConfig()
|
||||
{
|
||||
string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
string configFilePath = Path.Combine(exeDirectory, "config.ini");
|
||||
// Define the config file path in a writable location
|
||||
string configDirectory = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"AutoTrackR2"
|
||||
);
|
||||
string configFilePath = Path.Combine(configDirectory, "config.ini");
|
||||
|
||||
if (File.Exists(configFilePath))
|
||||
{
|
||||
|
@ -217,19 +221,31 @@ namespace AutoTrackR2
|
|||
|
||||
public static void SaveConfig()
|
||||
{
|
||||
string exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
|
||||
string configFilePath = Path.Combine(exeDirectory, "config.ini");
|
||||
// Define the config file path in a writable location
|
||||
string configDirectory = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
|
||||
"YourAppName"
|
||||
);
|
||||
|
||||
// Ensure the directory exists
|
||||
if (!Directory.Exists(configDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(configDirectory);
|
||||
}
|
||||
|
||||
string configFilePath = Path.Combine(configDirectory, "config.ini");
|
||||
|
||||
// Write the configuration to the file
|
||||
using (StreamWriter writer = new StreamWriter(configFilePath))
|
||||
{
|
||||
writer.WriteLine($"LogFile=\"{LogFile}\"");
|
||||
writer.WriteLine($"ApiUrl=\"{ApiUrl}\"");
|
||||
writer.WriteLine($"ApiKey=\"{ApiKey}\"");
|
||||
writer.WriteLine($"VideoPath=\"{VideoPath}\"");
|
||||
writer.WriteLine($"VisorWipe=\"{VisorWipe}\"");
|
||||
writer.WriteLine($"VideoRecord=\"{VideoRecord}\"");
|
||||
writer.WriteLine($"OfflineMode=\"{OfflineMode}\"");
|
||||
writer.WriteLine($"Theme=\"{Theme}\"");
|
||||
writer.WriteLine($"LogFile={LogFile}");
|
||||
writer.WriteLine($"ApiUrl={ApiUrl}");
|
||||
writer.WriteLine($"ApiKey={ApiKey}");
|
||||
writer.WriteLine($"VideoPath={VideoPath}");
|
||||
writer.WriteLine($"VisorWipe={VisorWipe}");
|
||||
writer.WriteLine($"VideoRecord={VideoRecord}");
|
||||
writer.WriteLine($"OfflineMode={OfflineMode}");
|
||||
writer.WriteLine($"Theme={Theme}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
8
AutoTrackR2/config.ini
Normal file
8
AutoTrackR2/config.ini
Normal file
|
@ -0,0 +1,8 @@
|
|||
LogFile=
|
||||
ApiUrl=
|
||||
ApiKey=
|
||||
VideoPath=
|
||||
VisorWipe=0
|
||||
VideoRecord=0
|
||||
OfflineMode=0
|
||||
Theme=0
|
0
AutoTrackR2/kill-log.csv
Normal file
0
AutoTrackR2/kill-log.csv
Normal file
|
Loading…
Add table
Add a link
Reference in a new issue