Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BugFix] minor fix for FileParser #113

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ProjBobcat/ProjBobcat/ProjBobcat.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ resolved the issue that LaunchWrapper may not return the correct exit code
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="8.0.1" />
<PackageReference Include="SharpCompress">
<Version>0.35.0</Version>
<Version>0.36.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down