From da7147ce7f87647102e998df2774369ce97668c2 Mon Sep 17 00:00:00 2001 From: laolarou Date: Tue, 16 Jan 2024 12:20:14 -0800 Subject: [PATCH 1/2] Update ProjBobcat.csproj --- ProjBobcat/ProjBobcat/ProjBobcat.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjBobcat/ProjBobcat/ProjBobcat.csproj b/ProjBobcat/ProjBobcat/ProjBobcat.csproj index 3e601be..7b8ec3d 100644 --- a/ProjBobcat/ProjBobcat/ProjBobcat.csproj +++ b/ProjBobcat/ProjBobcat/ProjBobcat.csproj @@ -66,7 +66,7 @@ resolved the issue that LaunchWrapper may not return the correct exit code - 0.35.0 + 0.36.0 From bd1d1689f3080de3bd8ab42c7c0d847ddf371c81 Mon Sep 17 00:00:00 2001 From: laolarou Date: Wed, 17 Jan 2024 16:40:48 -0800 Subject: [PATCH 2/2] minor fix for FileParser --- .../Launch/DefaultLauncherAccountParser.cs | 18 +++++++++++++----- .../Launch/DefaultLauncherProfileParser.cs | 16 ++++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherAccountParser.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherAccountParser.cs index 57662ba..9994646 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherAccountParser.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherAccountParser.cs @@ -145,7 +145,7 @@ public bool RemoveAccount(Guid id) var result = Find(id); if (!result.HasValue) return false; - var (key, value) = result.Value; + var (key, _) = result.Value; LauncherAccount?.Accounts?.Remove(key); Save(); @@ -155,13 +155,21 @@ public bool RemoveAccount(Guid id) public void Save() { - if (File.Exists(_fullLauncherAccountPath)) - File.Delete(_fullLauncherAccountPath); - var launcherProfileJson = JsonSerializer.Serialize(LauncherAccount, typeof(LauncherAccountModel), new LauncherAccountModelContext(JsonHelper.CamelCasePropertyNamesSettings())); - File.WriteAllText(_fullLauncherAccountPath, launcherProfileJson); + for (var i = 0; i < 3; i++) + { + try + { + File.WriteAllText(_fullLauncherAccountPath, launcherProfileJson); + break; + } + catch (IOException) + { + if (i == 2) throw; + } + } } } \ No newline at end of file diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherProfileParser.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherProfileParser.cs index 6882ca7..2ccdf4f 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherProfileParser.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultLauncherProfileParser.cs @@ -120,14 +120,22 @@ public void RemoveGameProfile(string name) public void SaveProfile() { - if (File.Exists(_fullLauncherProfilePath)) - File.Delete(_fullLauncherProfilePath); - var launcherProfileJson = JsonSerializer.Serialize(LauncherProfile, typeof(LauncherProfileModel), new LauncherProfileModelContext(JsonHelper.CamelCasePropertyNamesSettings())); - File.WriteAllText(_fullLauncherProfilePath, launcherProfileJson); + for (var i = 0; i < 3; i++) + { + try + { + File.WriteAllText(_fullLauncherProfilePath, launcherProfileJson); + break; + } + catch (IOException) + { + if (i == 2) throw; + } + } } public void SelectGameProfile(string name)