mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-12 22:30:43 -05:00
add reset button
This commit is contained in:
parent
3517f5e9e1
commit
2e882683c4
@ -74,6 +74,43 @@ namespace Aki.Launcher.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task ResetGameSettingsCommand()
|
||||||
|
{
|
||||||
|
string EFTSettingsFolder = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Escape from Tarkov", "Settings");
|
||||||
|
string SPTSettingsFolder = Path.Join(LauncherSettingsProvider.Instance.GamePath, "user", "sptsettings");
|
||||||
|
|
||||||
|
if (!Directory.Exists(EFTSettingsFolder))
|
||||||
|
{
|
||||||
|
LogManager.Instance.Warning($"EFT settings folder not found, can't reset :: Path: {EFTSettingsFolder}");
|
||||||
|
SendNotification("", LocalizationProvider.Instance.reset_game_settings_failed, Avalonia.Controls.Notifications.NotificationType.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(SPTSettingsFolder);
|
||||||
|
|
||||||
|
foreach (string dirPath in Directory.GetDirectories(EFTSettingsFolder, "*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(dirPath.Replace(EFTSettingsFolder, SPTSettingsFolder));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Copy all the files & Replaces any files with the same name
|
||||||
|
foreach (string newPath in Directory.GetFiles(EFTSettingsFolder, "*.*", SearchOption.AllDirectories))
|
||||||
|
{
|
||||||
|
File.Copy(newPath, newPath.Replace(EFTSettingsFolder, SPTSettingsFolder), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogManager.Instance.Exception(ex);
|
||||||
|
SendNotification("", LocalizationProvider.Instance.reset_game_settings_failed, Avalonia.Controls.Notifications.NotificationType.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendNotification("", LocalizationProvider.Instance.reset_game_settings_succeeded, Avalonia.Controls.Notifications.NotificationType.Success);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task ClearGameSettingsCommand()
|
public async Task ClearGameSettingsCommand()
|
||||||
{
|
{
|
||||||
var SPTSettingsDir = new DirectoryInfo(Path.Join(LauncherSettingsProvider.Instance.GamePath, "user", "sptsettings"));
|
var SPTSettingsDir = new DirectoryInfo(Path.Join(LauncherSettingsProvider.Instance.GamePath, "user", "sptsettings"));
|
||||||
@ -86,8 +123,8 @@ namespace Aki.Launcher.ViewModels
|
|||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
SendNotification("", LocalizationProvider.Instance.clear_game_settings_failed, Avalonia.Controls.Notifications.NotificationType.Error);
|
|
||||||
LogManager.Instance.Exception(ex);
|
LogManager.Instance.Exception(ex);
|
||||||
|
SendNotification("", LocalizationProvider.Instance.clear_game_settings_failed, Avalonia.Controls.Notifications.NotificationType.Error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,33 +8,39 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Aki.Launcher.Views.SettingsView">
|
x:Class="Aki.Launcher.Views.SettingsView">
|
||||||
|
|
||||||
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,*,10" ColumnDefinitions="10,2*,2*,10">
|
<Grid RowDefinitions="10,AUTO,AUTO,AUTO,*,10" ColumnDefinitions="10,2*,2*,AUTO,10">
|
||||||
|
|
||||||
<!-- Backdrop -->
|
<!-- Backdrop -->
|
||||||
<Rectangle Fill="{StaticResource AKI_Background_Dark}"
|
<Rectangle Fill="{StaticResource AKI_Background_Dark}"
|
||||||
Grid.RowSpan="6" Grid.ColumnSpan="4"
|
Grid.RowSpan="6" Grid.ColumnSpan="5"
|
||||||
Opacity=".7"
|
Opacity=".7"
|
||||||
/>
|
/>
|
||||||
<StackPanel Spacing="10" Grid.Row="1" Grid.Column="1" Orientation="Horizontal">
|
<WrapPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="2" Orientation="Horizontal">
|
||||||
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=remove_registry_keys}"
|
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=remove_registry_keys}"
|
||||||
Command="{Binding RemoveRegistryKeysCommand}"
|
Command="{Binding RemoveRegistryKeysCommand}"
|
||||||
Classes="borderedlink"
|
Classes="borderedlink"
|
||||||
|
Margin="0 0 10 5"
|
||||||
/>
|
/>
|
||||||
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clear_game_settings}"
|
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clear_game_settings}"
|
||||||
Command="{Binding ClearGameSettingsCommand}"
|
Command="{Binding ClearGameSettingsCommand}"
|
||||||
Classes="borderedlink"
|
Classes="borderedlink"
|
||||||
|
Margin="0 0 10 5"
|
||||||
/>
|
/>
|
||||||
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clean_temp_files}"
|
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=clean_temp_files}"
|
||||||
Command="{Binding CleanTempFilesCommand}"
|
Command="{Binding CleanTempFilesCommand}"
|
||||||
Classes="borderedlink"
|
Classes="borderedlink"
|
||||||
|
Margin="0 0 10 5"
|
||||||
/>
|
/>
|
||||||
</StackPanel>
|
<Button Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=reset_game_settings}"
|
||||||
|
Command="{Binding ResetGameSettingsCommand}"
|
||||||
|
Classes="borderedlink"
|
||||||
|
Margin="0 0 10 5"
|
||||||
|
/>
|
||||||
|
</WrapPanel>
|
||||||
|
|
||||||
<!-- Go Back -->
|
<!-- Go Back -->
|
||||||
<Button Content="➜" FontSize="25"
|
<Button Content="➜" FontSize="25"
|
||||||
Grid.Row="1" Grid.ColumnSpan="3"
|
Grid.Row="1" Grid.Column="3"
|
||||||
HorizontalAlignment="Right"
|
|
||||||
VerticalAlignment="Top"
|
|
||||||
Command="{Binding GoBackCommand}"
|
Command="{Binding GoBackCommand}"
|
||||||
Classes="link"
|
Classes="link"
|
||||||
/>
|
/>
|
||||||
@ -64,9 +70,9 @@
|
|||||||
/>
|
/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Spacing="3" Grid.Row="3" Grid.Column="2" Margin="0 20 0 0">
|
<WrapPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" Margin="0 30 0 0">
|
||||||
<!-- Select Folder -->
|
<!-- Select Folder -->
|
||||||
<Button x:Name="sfb" Command="{Binding SelectGameFolderCommand}">
|
<Button x:Name="sfb" Command="{Binding SelectGameFolderCommand}" Margin="0 0 10 5">
|
||||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||||
<Path Data="{StaticResource FolderWithPlus}" Fill="{Binding ElementName=sfb, Path=Foreground}"
|
<Path Data="{StaticResource FolderWithPlus}" Fill="{Binding ElementName=sfb, Path=Foreground}"
|
||||||
/>
|
/>
|
||||||
@ -75,7 +81,7 @@
|
|||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<!-- Open Folder -->
|
<!-- Open Folder -->
|
||||||
<Button x:Name="ofb" Command="{Binding OpenGameFolderCommand}">
|
<Button x:Name="ofb" Command="{Binding OpenGameFolderCommand}" Margin="0 0 10 5">
|
||||||
<StackPanel Orientation="Horizontal" Spacing="5">
|
<StackPanel Orientation="Horizontal" Spacing="5">
|
||||||
<!-- This geometry data isn't centered and I'm far too lazy to fix it, so I'm just adding a margin (waffle.lazy) -->
|
<!-- This geometry data isn't centered and I'm far too lazy to fix it, so I'm just adding a margin (waffle.lazy) -->
|
||||||
<Path Data="{StaticResource OpenFolder}" Fill="{Binding ElementName=ofb, Path=Foreground}"
|
<Path Data="{StaticResource OpenFolder}" Fill="{Binding ElementName=ofb, Path=Foreground}"
|
||||||
@ -84,7 +90,7 @@
|
|||||||
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=open_folder}"/>
|
<Label Content="{Binding Source={x:Static helpers:LocalizationProvider.Instance}, Path=open_folder}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
</StackPanel>
|
</WrapPanel>
|
||||||
|
|
||||||
<!-- Server URL -->
|
<!-- Server URL -->
|
||||||
<StackPanel Grid.Row="4" Grid.Column="1">
|
<StackPanel Grid.Row="4" Grid.Column="1">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user