From 9dcb3766df74da7dbb084242794c6286041b0d86 Mon Sep 17 00:00:00 2001 From: laolarou Date: Mon, 25 Mar 2024 22:19:52 -0700 Subject: [PATCH 1/4] 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 cb8b18c..48b6adb 100644 --- a/ProjBobcat/ProjBobcat/ProjBobcat.csproj +++ b/ProjBobcat/ProjBobcat/ProjBobcat.csproj @@ -73,7 +73,7 @@ resolved the issue that LaunchWrapper may not return the correct exit code - + all From 8727b49ba8b69f16ed19100367a600f1cb9b3501 Mon Sep 17 00:00:00 2001 From: laolarou Date: Sat, 30 Mar 2024 11:46:58 -0700 Subject: [PATCH 2/4] Update DefaultVersionLocator.cs --- .../Launch/DefaultVersionLocator.cs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs index a3d0717..cced54b 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs @@ -31,7 +31,7 @@ public sealed class DefaultVersionLocator : VersionLocatorBase /// public DefaultVersionLocator(string rootPath, Guid clientToken) : base(rootPath) { - LauncherProfileParser = new DefaultLauncherProfileParser(rootPath, clientToken); + LauncherProfileParser ??= new DefaultLauncherProfileParser(rootPath, clientToken); //防止给定路径不存在的时候Parser遍历文件夹爆炸。 //Prevents errors in the parser's folder traversal when the given path does not exist. @@ -590,14 +590,21 @@ void ProcessProfile(VersionInfo result, string id) if (string.IsNullOrEmpty(oldProfileKey) || oldProfileModel == null) { - LauncherProfileParser.LauncherProfile.Profiles!.Add(gameId, - new GameProfileModel - { - GameDir = gamePath, - LastVersionId = id, - Name = id, - Created = DateTime.Now - }); + var gameProfile = new GameProfileModel + { + GameDir = gamePath, + LastVersionId = id, + Name = id, + Created = DateTime.Now + }; + + if (!string.IsNullOrEmpty(oldProfileKey) && + LauncherProfileParser.LauncherProfile.Profiles!.ContainsKey(oldProfileKey)) + { + LauncherProfileParser.LauncherProfile.Profiles![oldProfileKey] = gameProfile; + } + + LauncherProfileParser.LauncherProfile.Profiles!.Add(gameId, gameProfile); LauncherProfileParser.SaveProfile(); return; From 7b9387f0330084353ce538bbfece1a2b4b17a705 Mon Sep 17 00:00:00 2001 From: laolarou Date: Sat, 30 Mar 2024 11:48:38 -0700 Subject: [PATCH 3/4] Update DefaultVersionLocator.cs --- .../ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs index cced54b..5f6511e 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs @@ -602,6 +602,7 @@ void ProcessProfile(VersionInfo result, string id) LauncherProfileParser.LauncherProfile.Profiles!.ContainsKey(oldProfileKey)) { LauncherProfileParser.LauncherProfile.Profiles![oldProfileKey] = gameProfile; + return; } LauncherProfileParser.LauncherProfile.Profiles!.Add(gameId, gameProfile); From 99f0bff544c734a4714874fd5d56a363d446f190 Mon Sep 17 00:00:00 2001 From: laolarou Date: Sat, 30 Mar 2024 11:48:50 -0700 Subject: [PATCH 4/4] Update DefaultVersionLocator.cs --- .../ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs index 5f6511e..ad6b51a 100644 --- a/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs +++ b/ProjBobcat/ProjBobcat/DefaultComponent/Launch/DefaultVersionLocator.cs @@ -602,6 +602,7 @@ void ProcessProfile(VersionInfo result, string id) LauncherProfileParser.LauncherProfile.Profiles!.ContainsKey(oldProfileKey)) { LauncherProfileParser.LauncherProfile.Profiles![oldProfileKey] = gameProfile; + LauncherProfileParser.SaveProfile(); return; }