- 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> <UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon> <ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>2.4.3.0</Version> <Version>2.4.3.1</Version>
<PackageIcon>Resources\ini.ico</PackageIcon> <PackageIcon>Resources\ini.ico</PackageIcon>
<PackageIconUrl /> <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> <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) => new EventHandler(async (sender, e) =>
{ {
if (!Program.IsProgramRunningDialog(this, selection)) return; if (!Program.IsProgramRunningDialog(this, selection)) return;
bool shouldReinstall = false; byte[] cApiIni = null;
byte[] properApi = null; byte[] properApi = null;
byte[] properApi64 = null; byte[] properApi64 = null;
foreach (string directory in selection.SteamApiDllDirectories) 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); 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); await InstallForm.UninstallCreamAPI(directory);
if (properApi is null && File.Exists(api) && !FileResourceExtensions.Equals(Properties.Resources.API, api)) if (properApi is null && File.Exists(api) && !FileResourceExtensions.Equals(Properties.Resources.API, api))
properApi = File.ReadAllBytes(api); properApi = File.ReadAllBytes(api);
@ -590,8 +591,11 @@ internal partial class SelectForm : CustomForm
properApi64.Write(api64); properApi64.Write(api64);
neededRepair = true; neededRepair = true;
} }
if (shouldReinstall) if (cApiIni is not null)
{
await InstallForm.InstallCreamAPI(directory, selection); await InstallForm.InstallCreamAPI(directory, selection);
cApiIni.Write(cApi);
}
} }
if (neededRepair) if (neededRepair)
new DialogForm(this).Show("Paradox Launcher Repair", Icon, "Paradox Launcher successfully repaired!", "OK"); new DialogForm(this).Show("Paradox Launcher Repair", Icon, "Paradox Launcher successfully repaired!", "OK");