- Koaloader proxy selection will no longer provide options for DLLs that already exist in the game's directories
- Installation will now error when a DLL that already exists is attempting to be installed as Koaloader
- Fixed selections not being re-enabled after an installation failure when hitting the Reselect button
This commit is contained in:
pointfeev 2022-09-14 17:39:35 -04:00
parent f31151921f
commit 2bdf9c9d77
4 changed files with 36 additions and 12 deletions

View file

@ -4,6 +4,7 @@ using CreamInstaller.Utility;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
@ -223,6 +224,17 @@ internal class CustomTreeView : TreeView
comboBoxDropDown.Items.Clear();
foreach (string proxy in proxies)
{
bool canUse = true;
foreach ((string directory, BinaryType binaryType) in pair.Key.ExecutableDirectories)
{
string path = directory + @"\" + proxy + ".dll";
if (File.Exists(path) && !path.IsResourceFile(ResourceIdentifier.Koaloader))
{
canUse = false;
break;
}
}
if (canUse)
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (s, e) =>
{
pair.Key.KoaloaderProxy = proxy;

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>4.1.2.0</Version>
<Version>4.1.3.0</Version>
<PackageIcon>Resources\ini.ico</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
@ -25,6 +25,8 @@
<SignAssembly>False</SignAssembly>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AnalysisLevel>latest-all</AnalysisLevel>
<Title>CreamInstaller</Title>
<Description>Automatic DLC Unlocker Installer &amp; Configuration Generator</Description>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>embedded</DebugType>

View file

@ -175,12 +175,13 @@ internal partial class InstallForm : CustomForm
UpdateProgress(100);
}
private readonly List<ProgramSelection> DisabledSelections = new();
private async Task Operate()
{
List<ProgramSelection> programSelections = ProgramSelection.AllEnabled;
OperationsCount = programSelections.Count;
CompleteOperationsCount = 0;
List<ProgramSelection> disabledSelections = new();
foreach (ProgramSelection selection in programSelections)
{
if (Program.Canceled || !Program.IsProgramRunningDialog(this, selection)) throw new CustomMessageException("The operation was canceled.");
@ -189,7 +190,7 @@ internal partial class InstallForm : CustomForm
await OperateFor(selection);
UpdateUser($"Operation succeeded for {selection.Name}.", InstallationLog.Success);
selection.Enabled = false;
disabledSelections.Add(selection);
DisabledSelections.Add(selection);
}
catch (Exception exception)
{
@ -200,9 +201,13 @@ internal partial class InstallForm : CustomForm
Program.Cleanup();
List<ProgramSelection> FailedSelections = ProgramSelection.AllEnabled;
if (FailedSelections.Any())
if (FailedSelections.Count == 1) throw new CustomMessageException($"Operation failed for {FailedSelections.First().Name}.");
else throw new CustomMessageException($"Operation failed for {FailedSelections.Count} programs.");
foreach (ProgramSelection selection in disabledSelections) selection.Enabled = true;
if (FailedSelections.Count == 1)
throw new CustomMessageException($"Operation failed for {FailedSelections.First().Name}.");
else
throw new CustomMessageException($"Operation failed for {FailedSelections.Count} programs.");
foreach (ProgramSelection selection in DisabledSelections)
selection.Enabled = true;
DisabledSelections.Clear();
}
private readonly int ProgramCount = ProgramSelection.AllEnabled.Count;
@ -265,6 +270,9 @@ internal partial class InstallForm : CustomForm
{
Program.Cleanup();
Reselecting = true;
foreach (ProgramSelection selection in DisabledSelections)
selection.Enabled = true;
DisabledSelections.Clear();
Close();
}
}

View file

@ -164,6 +164,8 @@ internal static class Koaloader
if (installForm is not null)
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", InstallationLog.Action, info: false);
}
if (File.Exists(path) && !path.IsResourceFile(ResourceIdentifier.Koaloader))
throw new CustomMessageException("A non-Koaloader DLL named " + selection.KoaloaderProxy + ".dll already exists in this directory!");
path.WriteProxy(selection.KoaloaderProxy, binaryType);
if (installForm is not null)
installForm.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", InstallationLog.Action, info: false);