- Paradox Launcher CreamAPI configuration will now stay consistent after repair
This commit is contained in:
pointfeev 2022-02-21 16:42:03 -05:00
parent 1d08f5162c
commit d4b62c2068
2 changed files with 8 additions and 4 deletions

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>2.4.3.0</Version>
<Version>2.4.3.1</Version>
<PackageIcon>Resources\ini.ico</PackageIcon>
<PackageIconUrl />
<Description>Automatically generates and installs CreamAPI files for Steam games on the user's computer. It can also generate and install CreamAPI for the Paradox Launcher should the user select a Paradox Interactive game.</Description>

View file

@ -561,13 +561,14 @@ internal partial class SelectForm : CustomForm
new EventHandler(async (sender, e) =>
{
if (!Program.IsProgramRunningDialog(this, selection)) return;
bool shouldReinstall = false;
byte[] cApiIni = null;
byte[] properApi = null;
byte[] properApi64 = null;
foreach (string directory in selection.SteamApiDllDirectories)
{
directory.GetApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi);
shouldReinstall = File.Exists(cApi);
if (cApiIni is null && File.Exists(cApi))
cApiIni = File.ReadAllBytes(cApi);
await InstallForm.UninstallCreamAPI(directory);
if (properApi is null && File.Exists(api) && !FileResourceExtensions.Equals(Properties.Resources.API, api))
properApi = File.ReadAllBytes(api);
@ -590,8 +591,11 @@ internal partial class SelectForm : CustomForm
properApi64.Write(api64);
neededRepair = true;
}
if (shouldReinstall)
if (cApiIni is not null)
{
await InstallForm.InstallCreamAPI(directory, selection);
cApiIni.Write(cApi);
}
}
if (neededRepair)
new DialogForm(this).Show("Paradox Launcher Repair", Icon, "Paradox Launcher successfully repaired!", "OK");