From 83a62668458d6267584988c6cdcce810ecce57f5 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Fri, 12 Jul 2024 09:38:09 -0400 Subject: [PATCH 1/5] fix profile wipe checkbox also fix select folder dialog, removed a commented out property --- .../ViewModels/ProfileViewModel.cs | 4 ---- .../ViewModels/SettingsViewModel.cs | 24 ++++++++++++------- project/SPT.Launcher/Views/ProfileView.axaml | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/project/SPT.Launcher/ViewModels/ProfileViewModel.cs b/project/SPT.Launcher/ViewModels/ProfileViewModel.cs index 59e8c4a..9151fed 100644 --- a/project/SPT.Launcher/ViewModels/ProfileViewModel.cs +++ b/project/SPT.Launcher/ViewModels/ProfileViewModel.cs @@ -18,8 +18,6 @@ namespace SPT.Launcher.ViewModels [RequireLoggedIn] public class ProfileViewModel : ViewModelBase { - // public string CurrentUsername { get; set; } - private string _CurrentEdition; public string CurrentEdition { @@ -65,8 +63,6 @@ namespace SPT.Launcher.ViewModels _monitor = new ProcessMonitor("EscapeFromTarkov", 1000, aliveCallback: GameAliveCallBack, exitCallback: GameExitCallback); - // CurrentUsername = AccountManager.SelectedAccount.username; - CurrentEdition = AccountManager.SelectedAccount.edition; CurrentId = AccountManager.SelectedAccount.id; diff --git a/project/SPT.Launcher/ViewModels/SettingsViewModel.cs b/project/SPT.Launcher/ViewModels/SettingsViewModel.cs index 6010d71..54d8902 100644 --- a/project/SPT.Launcher/ViewModels/SettingsViewModel.cs +++ b/project/SPT.Launcher/ViewModels/SettingsViewModel.cs @@ -11,7 +11,9 @@ using System.Diagnostics; using System.IO; using System.Reflection; using System.Threading.Tasks; +using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.Notifications; +using Avalonia.Platform.Storage; namespace SPT.Launcher.ViewModels { @@ -148,18 +150,22 @@ namespace SPT.Launcher.ViewModels public async Task SelectGameFolderCommand() { - OpenFolderDialog dialog = new OpenFolderDialog(); - - dialog.Directory = Assembly.GetExecutingAssembly().Location; - - if (Application.Current?.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktop) + if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - string? result = await dialog.ShowAsync(desktop.MainWindow); - - if (result != null) + var startPath = await desktop.MainWindow.StorageProvider.TryGetFolderFromPathAsync(Assembly.GetExecutingAssembly().Location); + + var dir = await desktop.MainWindow.StorageProvider.OpenFolderPickerAsync(new FolderPickerOpenOptions() { - LauncherSettingsProvider.Instance.GamePath = result; + Title = "Select your SPT folder", + SuggestedStartLocation = startPath + }); + + if (dir == null || dir.Count == 0) + { + return; } + + LauncherSettingsProvider.Instance.GamePath = dir[0].Path.LocalPath; } } } diff --git a/project/SPT.Launcher/Views/ProfileView.axaml b/project/SPT.Launcher/Views/ProfileView.axaml index 6dd8aa4..0a8dab6 100644 --- a/project/SPT.Launcher/Views/ProfileView.axaml +++ b/project/SPT.Launcher/Views/ProfileView.axaml @@ -13,7 +13,7 @@ ProfileInfo="{Binding ProfileInfo}" CurrentEdition="{Binding CurrentEdition}" CurrentId="{Binding CurrentId}" - WipeProfileOnStart="{Binding WipeProfileOnStart}" + WipeProfileOnStart="{Binding WipeProfileOnStart, Mode=TwoWay}" ProfileWipePending="{Binding ProfileWipePending}" CopyCommand="{Binding CopyCommand}" ChangeEditionCommand="{Binding ChangeEditionCommand}" From 1d7c232bb43371713459c81b76f8cef6b6e45efd Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Fri, 12 Jul 2024 15:21:43 -0400 Subject: [PATCH 2/5] fix core dll version parse --- project/SPT.Launcher.Base/Controllers/GameStarter.cs | 2 +- project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/project/SPT.Launcher.Base/Controllers/GameStarter.cs b/project/SPT.Launcher.Base/Controllers/GameStarter.cs index 253450b..3c2e715 100644 --- a/project/SPT.Launcher.Base/Controllers/GameStarter.cs +++ b/project/SPT.Launcher.Base/Controllers/GameStarter.cs @@ -217,7 +217,7 @@ namespace SPT.Launcher { var serverVersion = new SPTVersion(ServerManager.GetVersion()); - var coreDllVersionInfo = FileVersionInfo.GetVersionInfo(Path.Combine($"{gamePath}/BepinEx/plugins/spt", "spt-core.dll")); + var coreDllVersionInfo = FileVersionInfo.GetVersionInfo(Path.Join(gamePath, @"\BepinEx\plugins\spt", "spt-core.dll")); var dllVersion = new SPTVersion(coreDllVersionInfo.FileVersion); LogManager.Instance.Info($"[LaunchGame] spt-core.dll version: {dllVersion}"); diff --git a/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs b/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs index ef7e45f..c0e842d 100644 --- a/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs +++ b/project/SPT.Launcher.Base/Models/SPT/SPTVersion.cs @@ -38,7 +38,7 @@ namespace SPT.Launcher.Models.SPT string[] splitVersion = SPTVersion.Split('.'); - if (splitVersion.Length == 3) + if (splitVersion.Length >= 3) { int.TryParse(splitVersion[0], out Major); int.TryParse(splitVersion[1], out Minor); From 6387edfb3de59128ee9b5801f8ee7c457a290812 Mon Sep 17 00:00:00 2001 From: "waffle.lord" Date: Fri, 12 Jul 2024 15:22:20 -0400 Subject: [PATCH 3/5] scale text in detailed profile --- .../CustomControls/DetailedProfileCard.axaml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/project/SPT.Launcher/CustomControls/DetailedProfileCard.axaml b/project/SPT.Launcher/CustomControls/DetailedProfileCard.axaml index 1545524..d3ea51e 100644 --- a/project/SPT.Launcher/CustomControls/DetailedProfileCard.axaml +++ b/project/SPT.Launcher/CustomControls/DetailedProfileCard.axaml @@ -6,7 +6,8 @@ xmlns:cvt="using:SPT.Launcher.Converters" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="SPT.Launcher.CustomControls.DetailedProfileCard" - MinWidth="250" MinHeight="250" + MinWidth="250" MinHeight="300" + MaxWidth="250" MaxHeight="300" PointerEntered="InputElement_OnPointerEntered" PointerExited="InputElement_OnPointerExited" PointerPressed="InputElement_OnPointerPressed" @@ -26,22 +27,26 @@ - + -