Skip to content

Commit

Permalink
Merge pull request #137 from Corona-Studio/hotfix
Browse files Browse the repository at this point in the history
Update ProjBobcat.csproj
  • Loading branch information
laolarou726 committed Mar 31, 2024
2 parents bc0e71c + 99f0bff commit 0da2a64
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public sealed class DefaultVersionLocator : VersionLocatorBase
/// <param name="clientToken"></param>
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.
Expand Down Expand Up @@ -590,14 +590,23 @@ 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.SaveProfile();
return;
}

LauncherProfileParser.LauncherProfile.Profiles!.Add(gameId, gameProfile);
LauncherProfileParser.SaveProfile();

return;
Expand Down
2 changes: 1 addition & 1 deletion ProjBobcat/ProjBobcat/ProjBobcat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ resolved the issue that LaunchWrapper may not return the correct exit code
<PackageReference Include="System.Management" Version="8.0.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.18-beta">
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down

0 comments on commit 0da2a64

Please sign in to comment.