- 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;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using System.Windows.Forms.VisualStyles; using System.Windows.Forms.VisualStyles;
@ -223,13 +224,24 @@ internal class CustomTreeView : TreeView
comboBoxDropDown.Items.Clear(); comboBoxDropDown.Items.Clear();
foreach (string proxy in proxies) foreach (string proxy in proxies)
{ {
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (s, e) => bool canUse = true;
foreach ((string directory, BinaryType binaryType) in pair.Key.ExecutableDirectories)
{ {
pair.Key.KoaloaderProxy = proxy; string path = directory + @"\" + proxy + ".dll";
ProgramData.UpdateKoaloaderProxyChoices(); if (File.Exists(path) && !path.IsResourceFile(ResourceIdentifier.Koaloader))
Invalidate(); {
}) canUse = false;
{ Font = comboBoxFont }); break;
}
}
if (canUse)
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (s, e) =>
{
pair.Key.KoaloaderProxy = proxy;
ProgramData.UpdateKoaloaderProxyChoices();
Invalidate();
})
{ Font = comboBoxFont });
} }
comboBoxDropDown.Show(this, PointToScreen(new(pair.Value.Left, pair.Value.Bottom - 1))); comboBoxDropDown.Show(this, PointToScreen(new(pair.Value.Left, pair.Value.Bottom - 1)));
invalidate = true; invalidate = true;

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

View file

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

View file

@ -164,6 +164,8 @@ internal static class Koaloader
if (installForm is not null) if (installForm is not null)
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", InstallationLog.Action, info: false); 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); path.WriteProxy(selection.KoaloaderProxy, binaryType);
if (installForm is not null) if (installForm is not null)
installForm.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", InstallationLog.Action, info: false); installForm.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", InstallationLog.Action, info: false);