beginning of migration back to CreamAPI

This commit is contained in:
pointfeev 2024-07-21 05:57:26 -04:00
parent a25bd8b9dc
commit a198b7f9e5
15 changed files with 548 additions and 328 deletions

View file

@ -13,7 +13,7 @@ namespace CreamInstaller.Components;
internal sealed class CustomTreeView : TreeView
{
private const string KoaloaderToggleString = "Koaloader";
private const string ProxyToggleString = "Proxy";
private static readonly Color C1 = ColorTranslator.FromHtml("#FFFF99");
private static readonly Color C2 = ColorTranslator.FromHtml("#696900");
@ -121,7 +121,7 @@ internal sealed class CustomTreeView : TreeView
if (form is SelectForm)
{
Selection selection = Selection.FromId(platform, id);
if (selection is not null)
if (selection is not null && selection.CanUseProxy)
{
if (bounds == node.Bounds)
{
@ -130,7 +130,7 @@ internal sealed class CustomTreeView : TreeView
graphics.FillRectangle(brush, bounds);
}
CheckBoxState checkBoxState = selection.Koaloader
CheckBoxState checkBoxState = selection.UseProxy
? Enabled ? CheckBoxState.CheckedPressed : CheckBoxState.CheckedDisabled
: Enabled
? CheckBoxState.UncheckedPressed
@ -142,7 +142,7 @@ internal sealed class CustomTreeView : TreeView
graphics.FillRectangle(backBrush, bounds);
point = new(bounds.Left, bounds.Top + bounds.Height / 2 - size.Height / 2 - 1);
CheckBoxRenderer.DrawCheckBox(graphics, point, checkBoxState);
text = KoaloaderToggleString;
text = ProxyToggleString;
size = TextRenderer.MeasureText(graphics, text, font);
int left = 1;
bounds = bounds with { X = bounds.X + bounds.Width, Width = size.Width + left };
@ -152,12 +152,12 @@ internal sealed class CustomTreeView : TreeView
point = new(bounds.Location.X - 1 + left, bounds.Location.Y + 1);
TextRenderer.DrawText(graphics, text, font, point, Enabled ? C7 : C8, TextFormatFlags.Default);
this.checkBoxBounds[selection] = RectangleToClient(checkBoxBounds);
if (selection.Koaloader)
if (selection.UseProxy)
{
comboBoxFont ??= new(font.FontFamily, 6, font.Style, font.Unit, font.GdiCharSet,
font.GdiVerticalFont);
ComboBoxState comboBoxState = Enabled ? ComboBoxState.Normal : ComboBoxState.Disabled;
text = (selection.KoaloaderProxy ?? Selection.DefaultKoaloaderProxy) + ".dll";
text = (selection.Proxy ?? Selection.DefaultProxy) + ".dll";
size = TextRenderer.MeasureText(graphics, text, comboBoxFont) + new Size(6, 0);
const int padding = 2;
bounds = new(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds.Height - padding);
@ -233,8 +233,8 @@ internal sealed class CustomTreeView : TreeView
if (canUse)
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (_, _) =>
{
pair.Key.KoaloaderProxy = proxy == Selection.DefaultKoaloaderProxy ? null : proxy;
selectForm.OnKoaloaderChanged();
pair.Key.Proxy = proxy == Selection.DefaultProxy ? null : proxy;
selectForm.OnProxyChanged();
}) { Font = comboBoxFont });
}
@ -247,8 +247,8 @@ internal sealed class CustomTreeView : TreeView
_ = checkBoxBounds.Remove(pair.Key);
else if (pair.Value.Contains(clickPoint))
{
pair.Key.Koaloader = !pair.Key.Koaloader;
selectForm?.OnKoaloaderChanged();
pair.Key.UseProxy = !pair.Key.UseProxy;
selectForm?.OnProxyChanged();
break;
}
}

View file

@ -4,7 +4,7 @@
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\program.ico</ApplicationIcon>
<Version>4.10.2</Version>
<Version>5.0.0.0</Version>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
<Company>CreamInstaller</Company>
<Product>Automatic DLC Unlocker Installer &amp; Configuration Generator</Product>
@ -22,7 +22,7 @@
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
<LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<SupportedOSPlatformVersion>8.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
<Platforms>x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
@ -147,11 +147,15 @@
<EmbeddedResource Include="Resources\UplayR1\uplay_r1_loader64.dll" />
<EmbeddedResource Include="Resources\UplayR2\upc_r2_loader.dll" />
<EmbeddedResource Include="Resources\UplayR2\upc_r2_loader64.dll" />
<None Remove="Resources\CreamAPI\steam_api.dll" />
<EmbeddedResource Include="Resources\CreamAPI\steam_api.dll" />
<None Remove="Resources\CreamAPI\steam_api64.dll" />
<EmbeddedResource Include="Resources\CreamAPI\steam_api64.dll" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Gameloop.Vdf" Version="0.6.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ServiceModel.Primitives" Version="6.0.0"/>
<PackageReference Include="System.ServiceModel.Primitives" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="Forms\DebugForm.cs">

View file

@ -64,6 +64,8 @@ internal sealed partial class InstallForm : CustomForm
_ = await Repair(this, selection);
}
bool useKoaloader = selection.UseProxy && (Program.UseSmokeAPI || selection.Platform is not Platform.Steam);
UpdateUser(
$"{(uninstalling ? "Uninstalling" : "Installing")}" + $" {(uninstalling ? "from" : "for")} " +
selection.Name
@ -93,7 +95,7 @@ internal sealed partial class InstallForm : CustomForm
}
}
if (uninstalling || !selection.Koaloader)
if (uninstalling || !useKoaloader)
foreach ((string directory, BinaryType _) in selection.ExecutableDirectories)
{
if (Program.Canceled)
@ -111,47 +113,68 @@ internal sealed partial class InstallForm : CustomForm
}
}
bool uninstallProxy = uninstalling || selection.Koaloader;
bool uninstallingForKoaloader = uninstalling || useKoaloader;
int count = selection.DllDirectories.Count, cur = 0;
foreach (string directory in selection.DllDirectories)
{
if (Program.Canceled)
return;
if (selection.Platform is Platform.Steam or Platform.Paradox)
{
if (Program.UseSmokeAPI)
{
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64,
out string api64_o, out string old_config,
out string config, out string old_log, out string log, out string cache);
if (uninstallProxy
if (uninstallingForKoaloader
? api32_o.FileExists() || api64_o.FileExists() || old_config.FileExists() ||
config.FileExists() || old_log.FileExists() || log.FileExists()
|| cache.FileExists()
: api32.FileExists() || api64.FileExists())
{
UpdateUser(
$"{(uninstallProxy ? "Uninstalling" : "Installing")} SmokeAPI" +
$" {(uninstallProxy ? "from" : "for")} " + selection.Name
$"{(uninstallingForKoaloader ? "Uninstalling" : "Installing")} SmokeAPI" +
$" {(uninstallingForKoaloader ? "from" : "for")} " + selection.Name
+ $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
if (uninstallProxy)
if (uninstallingForKoaloader)
await SmokeAPI.Uninstall(directory, this);
else
await SmokeAPI.Install(directory, selection, this);
}
}
else
{
directory.GetCreamApiComponents(out string api32, out string api32_o, out string api64,
out string api64_o, out string config);
if (uninstalling
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists()
: api32.FileExists() || api64.FileExists())
{
UpdateUser(
$"{(uninstalling ? "Uninstalling" : "Installing")} CreamAPI" +
$" {(uninstalling ? "from" : "for")} " + selection.Name
+ $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
if (uninstalling)
await CreamAPI.Uninstall(directory, this);
else
await CreamAPI.Install(directory, selection, this);
}
}
}
if (selection.Platform is Platform.Epic or Platform.Paradox)
{
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64,
out string api64_o, out string config, out string log);
if (uninstallProxy
if (uninstallingForKoaloader
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists()
: api32.FileExists() || api64.FileExists())
{
UpdateUser(
$"{(uninstallProxy ? "Uninstalling" : "Installing")} ScreamAPI" +
$" {(uninstallProxy ? "from" : "for")} " + selection.Name
$"{(uninstallingForKoaloader ? "Uninstalling" : "Installing")} ScreamAPI" +
$" {(uninstallingForKoaloader ? "from" : "for")} " + selection.Name
+ $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
if (uninstallProxy)
if (uninstallingForKoaloader)
await ScreamAPI.Uninstall(directory, this);
else
await ScreamAPI.Install(directory, selection, this);
@ -162,15 +185,15 @@ internal sealed partial class InstallForm : CustomForm
{
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64,
out string api64_o, out string config, out string log);
if (uninstallProxy
if (uninstallingForKoaloader
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists()
: api32.FileExists() || api64.FileExists())
{
UpdateUser(
$"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" +
$" {(uninstallProxy ? "from" : "for")} " + selection.Name
$"{(uninstallingForKoaloader ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" +
$" {(uninstallingForKoaloader ? "from" : "for")} " + selection.Name
+ $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
if (uninstallProxy)
if (uninstallingForKoaloader)
await UplayR1.Uninstall(directory, this);
else
await UplayR1.Install(directory, selection, this);
@ -178,15 +201,15 @@ internal sealed partial class InstallForm : CustomForm
directory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o,
out api64, out api64_o, out config, out log);
if (uninstallProxy
if (uninstallingForKoaloader
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists()
: old_api32.FileExists() || old_api64.FileExists() || api32.FileExists() || api64.FileExists())
{
UpdateUser(
$"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" +
$" {(uninstallProxy ? "from" : "for")} " + selection.Name
$"{(uninstallingForKoaloader ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" +
$" {(uninstallingForKoaloader ? "from" : "for")} " + selection.Name
+ $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
if (uninstallProxy)
if (uninstallingForKoaloader)
await UplayR2.Uninstall(directory, this);
else
await UplayR2.Install(directory, selection, this);
@ -196,7 +219,7 @@ internal sealed partial class InstallForm : CustomForm
UpdateProgress(++cur / count * 100);
}
if (selection.Koaloader && !uninstalling)
if (useKoaloader && !uninstalling)
foreach ((string directory, BinaryType binaryType) in selection.ExecutableDirectories)
{
if (Program.Canceled)

View file

@ -22,8 +22,8 @@ namespace CreamInstaller.Forms
installButton = new Button();
cancelButton = new Button();
programsGroupBox = new GroupBox();
koaloaderFlowPanel = new FlowLayoutPanel();
koaloaderAllCheckBox = new CheckBox();
proxyFlowPanel = new FlowLayoutPanel();
proxyAllCheckBox = new CheckBox();
noneFoundLabel = new Label();
blockedGamesFlowPanel = new FlowLayoutPanel();
blockedGamesCheckBox = new CheckBox();
@ -39,13 +39,13 @@ namespace CreamInstaller.Forms
sortCheckBox = new CheckBox();
saveButton = new Button();
loadButton = new Button();
resetKoaloaderButton = new Button();
resetProxyButton = new Button();
resetButton = new Button();
saveKoaloaderButton = new Button();
loadKoaloaderButton = new Button();
saveProxyButton = new Button();
loadProxyButton = new Button();
selectionTreeView = new CustomTreeView();
programsGroupBox.SuspendLayout();
koaloaderFlowPanel.SuspendLayout();
proxyFlowPanel.SuspendLayout();
blockedGamesFlowPanel.SuspendLayout();
allCheckBoxLayoutPanel.SuspendLayout();
SuspendLayout();
@ -82,7 +82,7 @@ namespace CreamInstaller.Forms
// programsGroupBox
//
programsGroupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
programsGroupBox.Controls.Add(koaloaderFlowPanel);
programsGroupBox.Controls.Add(proxyFlowPanel);
programsGroupBox.Controls.Add(noneFoundLabel);
programsGroupBox.Controls.Add(blockedGamesFlowPanel);
programsGroupBox.Controls.Add(allCheckBoxLayoutPanel);
@ -94,33 +94,33 @@ namespace CreamInstaller.Forms
programsGroupBox.TabStop = false;
programsGroupBox.Text = "Programs / Games";
//
// koaloaderFlowPanel
// proxyFlowPanel
//
koaloaderFlowPanel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
koaloaderFlowPanel.AutoSize = true;
koaloaderFlowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
koaloaderFlowPanel.Controls.Add(koaloaderAllCheckBox);
koaloaderFlowPanel.Location = new System.Drawing.Point(422, -1);
koaloaderFlowPanel.Margin = new Padding(0);
koaloaderFlowPanel.Name = "koaloaderFlowPanel";
koaloaderFlowPanel.Size = new System.Drawing.Size(81, 19);
koaloaderFlowPanel.TabIndex = 10005;
koaloaderFlowPanel.WrapContents = false;
proxyFlowPanel.Anchor = AnchorStyles.Top | AnchorStyles.Right;
proxyFlowPanel.AutoSize = true;
proxyFlowPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
proxyFlowPanel.Controls.Add(proxyAllCheckBox);
proxyFlowPanel.Location = new System.Drawing.Point(422, -1);
proxyFlowPanel.Margin = new Padding(0);
proxyFlowPanel.Name = "proxyFlowPanel";
proxyFlowPanel.Size = new System.Drawing.Size(81, 19);
proxyFlowPanel.TabIndex = 10005;
proxyFlowPanel.WrapContents = false;
//
// koaloaderAllCheckBox
// proxyAllCheckBox
//
koaloaderAllCheckBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
koaloaderAllCheckBox.AutoSize = true;
koaloaderAllCheckBox.Checked = true;
koaloaderAllCheckBox.CheckState = CheckState.Checked;
koaloaderAllCheckBox.Enabled = false;
koaloaderAllCheckBox.Location = new System.Drawing.Point(2, 0);
koaloaderAllCheckBox.Margin = new Padding(2, 0, 0, 0);
koaloaderAllCheckBox.Name = "koaloaderAllCheckBox";
koaloaderAllCheckBox.Size = new System.Drawing.Size(79, 19);
koaloaderAllCheckBox.TabIndex = 4;
koaloaderAllCheckBox.Text = "Koaloader";
koaloaderAllCheckBox.CheckedChanged += OnKoaloaderAllCheckBoxChanged;
proxyAllCheckBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
proxyAllCheckBox.AutoSize = true;
proxyAllCheckBox.Checked = false;
proxyAllCheckBox.CheckState = CheckState.Checked;
proxyAllCheckBox.Enabled = false;
proxyAllCheckBox.Location = new System.Drawing.Point(2, 0);
proxyAllCheckBox.Margin = new Padding(2, 0, 0, 0);
proxyAllCheckBox.Name = "proxyAllCheckBox";
proxyAllCheckBox.Size = new System.Drawing.Size(79, 19);
proxyAllCheckBox.TabIndex = 4;
proxyAllCheckBox.Text = "Proxy All";
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
//
// noneFoundLabel
//
@ -323,19 +323,19 @@ namespace CreamInstaller.Forms
loadButton.UseVisualStyleBackColor = true;
loadButton.Click += OnLoadDlc;
//
// resetKoaloaderButton
// resetProxyButton
//
resetKoaloaderButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
resetKoaloaderButton.AutoSize = true;
resetKoaloaderButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
resetKoaloaderButton.Enabled = false;
resetKoaloaderButton.Location = new System.Drawing.Point(12, 295);
resetKoaloaderButton.Name = "resetKoaloaderButton";
resetKoaloaderButton.Size = new System.Drawing.Size(101, 25);
resetKoaloaderButton.TabIndex = 10010;
resetKoaloaderButton.Text = "Reset Koaloader";
resetKoaloaderButton.UseVisualStyleBackColor = true;
resetKoaloaderButton.Click += OnResetKoaloader;
resetProxyButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
resetProxyButton.AutoSize = true;
resetProxyButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
resetProxyButton.Enabled = false;
resetProxyButton.Location = new System.Drawing.Point(12, 295);
resetProxyButton.Name = "resetProxyButton";
resetProxyButton.Size = new System.Drawing.Size(101, 25);
resetProxyButton.TabIndex = 10010;
resetProxyButton.Text = "Reset Proxy";
resetProxyButton.UseVisualStyleBackColor = true;
resetProxyButton.Click += OnResetProxy;
//
// resetButton
//
@ -351,33 +351,33 @@ namespace CreamInstaller.Forms
resetButton.UseVisualStyleBackColor = true;
resetButton.Click += OnResetDlc;
//
// saveKoaloaderButton
// saveProxyButton
//
saveKoaloaderButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
saveKoaloaderButton.AutoSize = true;
saveKoaloaderButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
saveKoaloaderButton.Enabled = false;
saveKoaloaderButton.Location = new System.Drawing.Point(119, 295);
saveKoaloaderButton.Name = "saveKoaloaderButton";
saveKoaloaderButton.Size = new System.Drawing.Size(97, 25);
saveKoaloaderButton.TabIndex = 10009;
saveKoaloaderButton.Text = "Save Koaloader";
saveKoaloaderButton.UseVisualStyleBackColor = true;
saveKoaloaderButton.Click += OnSaveKoaloader;
saveProxyButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
saveProxyButton.AutoSize = true;
saveProxyButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
saveProxyButton.Enabled = false;
saveProxyButton.Location = new System.Drawing.Point(119, 295);
saveProxyButton.Name = "saveProxyButton";
saveProxyButton.Size = new System.Drawing.Size(97, 25);
saveProxyButton.TabIndex = 10009;
saveProxyButton.Text = "Save Proxy";
saveProxyButton.UseVisualStyleBackColor = true;
saveProxyButton.Click += OnSaveProxy;
//
// loadKoaloaderButton
// loadProxyButton
//
loadKoaloaderButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
loadKoaloaderButton.AutoSize = true;
loadKoaloaderButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
loadKoaloaderButton.Enabled = false;
loadKoaloaderButton.Location = new System.Drawing.Point(222, 295);
loadKoaloaderButton.Name = "loadKoaloaderButton";
loadKoaloaderButton.Size = new System.Drawing.Size(99, 25);
loadKoaloaderButton.TabIndex = 10008;
loadKoaloaderButton.Text = "Load Koaloader";
loadKoaloaderButton.UseVisualStyleBackColor = true;
loadKoaloaderButton.Click += OnLoadKoaloader;
loadProxyButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
loadProxyButton.AutoSize = true;
loadProxyButton.AutoSizeMode = AutoSizeMode.GrowAndShrink;
loadProxyButton.Enabled = false;
loadProxyButton.Location = new System.Drawing.Point(222, 295);
loadProxyButton.Name = "loadProxyButton";
loadProxyButton.Size = new System.Drawing.Size(99, 25);
loadProxyButton.TabIndex = 10008;
loadProxyButton.Text = "Load Proxy";
loadProxyButton.UseVisualStyleBackColor = true;
loadProxyButton.Click += OnLoadProxy;
//
// SelectForm
//
@ -386,10 +386,10 @@ namespace CreamInstaller.Forms
AutoSize = true;
AutoSizeMode = AutoSizeMode.GrowAndShrink;
ClientSize = new System.Drawing.Size(584, 361);
Controls.Add(loadKoaloaderButton);
Controls.Add(saveKoaloaderButton);
Controls.Add(loadProxyButton);
Controls.Add(saveProxyButton);
Controls.Add(resetButton);
Controls.Add(resetKoaloaderButton);
Controls.Add(resetProxyButton);
Controls.Add(loadButton);
Controls.Add(saveButton);
Controls.Add(sortCheckBox);
@ -412,8 +412,8 @@ namespace CreamInstaller.Forms
Load += OnLoad;
programsGroupBox.ResumeLayout(false);
programsGroupBox.PerformLayout();
koaloaderFlowPanel.ResumeLayout(false);
koaloaderFlowPanel.PerformLayout();
proxyFlowPanel.ResumeLayout(false);
proxyFlowPanel.PerformLayout();
blockedGamesFlowPanel.ResumeLayout(false);
blockedGamesFlowPanel.PerformLayout();
allCheckBoxLayoutPanel.ResumeLayout(false);
@ -441,14 +441,14 @@ namespace CreamInstaller.Forms
private Label progressLabelGames;
private Label progressLabelDLCs;
private CheckBox sortCheckBox;
private FlowLayoutPanel koaloaderFlowPanel;
internal CheckBox koaloaderAllCheckBox;
private FlowLayoutPanel proxyFlowPanel;
internal CheckBox proxyAllCheckBox;
private Button saveButton;
private Button loadButton;
private Button resetKoaloaderButton;
private Button resetProxyButton;
private Button resetButton;
private Button saveKoaloaderButton;
private Button loadKoaloaderButton;
private Button saveProxyButton;
private Button loadProxyButton;
}
}

View file

@ -23,6 +23,9 @@ namespace CreamInstaller.Forms;
internal sealed partial class SelectForm : CustomForm
{
// TODO: fix the form display reset save load buttons for proxy
// consolidate all reset save load functionality into only 3 buttons instead of 6?
private const string HelpButtonListPrefix = "\n • ";
private static SelectForm current;
@ -562,16 +565,16 @@ internal sealed partial class SelectForm : CustomForm
scanButton.Enabled = false;
noneFoundLabel.Visible = false;
allCheckBox.Enabled = false;
koaloaderAllCheckBox.Enabled = false;
proxyAllCheckBox.Enabled = false;
installButton.Enabled = false;
uninstallButton.Enabled = installButton.Enabled;
selectionTreeView.Enabled = false;
saveButton.Enabled = false;
loadButton.Enabled = false;
resetButton.Enabled = false;
saveKoaloaderButton.Enabled = false;
loadKoaloaderButton.Enabled = false;
resetKoaloaderButton.Enabled = false;
saveProxyButton.Enabled = false;
loadProxyButton.Enabled = false;
resetProxyButton.Enabled = false;
progressLabel.Text = "Waiting for user to select which programs/games to scan . . .";
ShowProgressBar();
await ProgramData.Setup(this);
@ -693,20 +696,20 @@ internal sealed partial class SelectForm : CustomForm
}
OnLoadDlc(null, null);
OnLoadKoaloader(null, null);
OnLoadProxy(null, null);
HideProgressBar();
selectionTreeView.Enabled = !Selection.All.IsEmpty;
allCheckBox.Enabled = selectionTreeView.Enabled;
koaloaderAllCheckBox.Enabled = selectionTreeView.Enabled;
proxyAllCheckBox.Enabled = selectionTreeView.Enabled;
noneFoundLabel.Visible = !selectionTreeView.Enabled;
installButton.Enabled = Selection.AllEnabled.Any();
uninstallButton.Enabled = installButton.Enabled;
saveButton.Enabled = CanSaveDlc();
loadButton.Enabled = CanLoadDlc();
resetButton.Enabled = CanResetDlc();
saveKoaloaderButton.Enabled = CanSaveKoaloader();
loadKoaloaderButton.Enabled = CanLoadKoaloader();
resetKoaloaderButton.Enabled = CanResetKoaloader();
saveProxyButton.Enabled = CanSaveProxy();
loadProxyButton.Enabled = CanLoadProxy();
resetProxyButton.Enabled = CanResetProxy();
cancelButton.Enabled = false;
scanButton.Enabled = true;
blockedGamesCheckBox.Enabled = true;
@ -1043,16 +1046,16 @@ internal sealed partial class SelectForm : CustomForm
allCheckBox.CheckedChanged += OnAllCheckBoxChanged;
}
private void OnKoaloaderAllCheckBoxChanged(object sender, EventArgs e)
private void OnProxyAllCheckBoxChanged(object sender, EventArgs e)
{
bool shouldEnable = Selection.All.Keys.Any(selection => !selection.Koaloader);
bool shouldEnable = Selection.All.Keys.Any(selection => !selection.UseProxy);
foreach (Selection selection in Selection.All.Keys)
selection.Koaloader = shouldEnable;
selection.UseProxy = shouldEnable;
selectionTreeView.Invalidate();
koaloaderAllCheckBox.CheckedChanged -= OnKoaloaderAllCheckBoxChanged;
koaloaderAllCheckBox.Checked = shouldEnable;
koaloaderAllCheckBox.CheckedChanged += OnKoaloaderAllCheckBoxChanged;
resetKoaloaderButton.Enabled = CanResetKoaloader();
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
proxyAllCheckBox.Checked = shouldEnable;
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
resetProxyButton.Enabled = CanResetProxy();
}
private bool AreSelectionsDefault()
@ -1107,36 +1110,36 @@ internal sealed partial class SelectForm : CustomForm
resetButton.Enabled = CanResetDlc();
}
private static bool AreKoaloaderSelectionsDefault() =>
Selection.All.Keys.All(selection => selection.Koaloader && selection.KoaloaderProxy is null);
private static bool AreProxySelectionsDefault() =>
Selection.All.Keys.All(selection => !selection.UseProxy && selection.Proxy is null);
private static bool CanSaveKoaloader() =>
ProgramData.ReadKoaloaderChoices().Any() || !AreKoaloaderSelectionsDefault();
private static bool CanSaveProxy() =>
ProgramData.ReadProxyChoices().Any() || !AreProxySelectionsDefault();
private void OnSaveKoaloader(object sender, EventArgs e)
private void OnSaveProxy(object sender, EventArgs e)
{
List<(Platform platform, string id, string proxy, bool enabled)> choices =
ProgramData.ReadKoaloaderChoices().ToList();
ProgramData.ReadProxyChoices().ToList();
foreach (Selection selection in Selection.All.Keys)
{
_ = choices.RemoveAll(c => c.platform == selection.Platform && c.id == selection.Id);
if (selection.KoaloaderProxy is not null and not Selection.DefaultKoaloaderProxy || !selection.Koaloader)
if (selection.Proxy is not null and not Selection.DefaultProxy || selection.UseProxy)
choices.Add((selection.Platform, selection.Id,
selection.KoaloaderProxy == Selection.DefaultKoaloaderProxy ? null : selection.KoaloaderProxy,
selection.Koaloader));
selection.Proxy == Selection.DefaultProxy ? null : selection.Proxy,
selection.UseProxy));
}
ProgramData.WriteKoaloaderProxyChoices(choices);
saveKoaloaderButton.Enabled = CanSaveKoaloader();
loadKoaloaderButton.Enabled = CanLoadKoaloader();
ProgramData.WriteProxyChoices(choices);
saveProxyButton.Enabled = CanSaveProxy();
loadProxyButton.Enabled = CanLoadProxy();
}
private static bool CanLoadKoaloader() => ProgramData.ReadKoaloaderChoices().Any();
private static bool CanLoadProxy() => ProgramData.ReadProxyChoices().Any();
private void OnLoadKoaloader(object sender, EventArgs e)
private void OnLoadProxy(object sender, EventArgs e)
{
List<(Platform platform, string id, string proxy, bool enabled)> choices =
ProgramData.ReadKoaloaderChoices().ToList();
ProgramData.ReadProxyChoices().ToList();
foreach (Selection selection in Selection.All.Keys)
if (choices.Any(c => c.platform == selection.Platform && c.id == selection.Id))
{
@ -1148,46 +1151,46 @@ internal sealed partial class SelectForm : CustomForm
proxy.GetProxyInfoFromIdentifier(out currentProxy, out _);
if (proxy != currentProxy && choices.Remove(choice)) // convert pre-v4.1.0.0 choices
choices.Add((platform, id, currentProxy, enabled));
if (currentProxy is null or Selection.DefaultKoaloaderProxy && enabled)
if (currentProxy is null or Selection.DefaultProxy && !enabled)
_ = choices.RemoveAll(c => c.platform == platform && c.id == id);
else
{
selection.Koaloader = enabled;
selection.KoaloaderProxy = currentProxy == Selection.DefaultKoaloaderProxy ? currentProxy : proxy;
selection.UseProxy = enabled;
selection.Proxy = currentProxy == Selection.DefaultProxy ? currentProxy : proxy;
}
}
else
{
selection.Koaloader = true;
selection.KoaloaderProxy = null;
selection.UseProxy = false;
selection.Proxy = null;
}
ProgramData.WriteKoaloaderProxyChoices(choices);
loadKoaloaderButton.Enabled = CanLoadKoaloader();
OnKoaloaderChanged();
ProgramData.WriteProxyChoices(choices);
loadProxyButton.Enabled = CanLoadProxy();
OnProxyChanged();
}
private static bool CanResetKoaloader() => !AreKoaloaderSelectionsDefault();
private static bool CanResetProxy() => !AreProxySelectionsDefault();
private void OnResetKoaloader(object sender, EventArgs e)
private void OnResetProxy(object sender, EventArgs e)
{
foreach (Selection selection in Selection.All.Keys)
{
selection.Koaloader = true;
selection.KoaloaderProxy = null;
selection.UseProxy = false;
selection.Proxy = null;
}
OnKoaloaderChanged();
OnProxyChanged();
}
internal void OnKoaloaderChanged()
internal void OnProxyChanged()
{
selectionTreeView.Invalidate();
saveKoaloaderButton.Enabled = CanSaveKoaloader();
resetKoaloaderButton.Enabled = CanResetKoaloader();
koaloaderAllCheckBox.CheckedChanged -= OnKoaloaderAllCheckBoxChanged;
koaloaderAllCheckBox.Checked = Selection.All.Keys.All(selection => selection.Koaloader);
koaloaderAllCheckBox.CheckedChanged += OnKoaloaderAllCheckBoxChanged;
saveProxyButton.Enabled = CanSaveProxy();
resetProxyButton.Enabled = CanResetProxy();
proxyAllCheckBox.CheckedChanged -= OnProxyAllCheckBoxChanged;
proxyAllCheckBox.Checked = Selection.All.Keys.All(selection => !selection.CanUseProxy || selection.UseProxy);
proxyAllCheckBox.CheckedChanged += OnProxyAllCheckBoxChanged;
}
private void OnBlockProtectedGamesCheckBoxChanged(object sender, EventArgs e)

View file

@ -75,7 +75,7 @@ internal static class ParadoxLauncher
}
using DialogForm dialogForm = new(form);
bool smokeInstalled = false;
bool creamInstalled = false;
byte[] steamOriginalSdk32 = null;
byte[] steamOriginalSdk64 = null;
bool screamInstalled = false;
@ -86,24 +86,39 @@ internal static class ParadoxLauncher
bool koaloaderInstalled = Koaloader.AutoLoadDLLs
.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
.Any(pair => pair.path.FileExists() && pair.path.IsResourceFile());
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o,
out string old_config,
out string config, out _, out _, out _);
smokeInstalled = smokeInstalled || api32_o.FileExists() || api64_o.FileExists()
string api32;
string api32_o;
string api64;
string api64_o;
if (Program.UseSmokeAPI)
{
directory.GetSmokeApiComponents(out api32, out api32_o, out api64, out api64_o,
out string old_config, out string config, out _, out _, out _);
creamInstalled = creamInstalled || api32_o.FileExists() || api64_o.FileExists()
|| (old_config.FileExists() || config.FileExists()) && !koaloaderInstalled
|| api32.FileExists() && api32.IsResourceFile(ResourceIdentifier.Steamworks32)
|| api64.FileExists() && api64.IsResourceFile(ResourceIdentifier.Steamworks64);
await SmokeAPI.Uninstall(directory, deleteOthers: false);
}
else
{
directory.GetCreamApiComponents(out api32, out api32_o, out api64, out api64_o, out string config);
creamInstalled = creamInstalled || api32_o.FileExists() || api64_o.FileExists() || config.FileExists()
|| api32.FileExists() && api32.IsResourceFile(ResourceIdentifier.Steamworks32)
|| api64.FileExists() && api64.IsResourceFile(ResourceIdentifier.Steamworks64);
await CreamAPI.Uninstall(directory, deleteOthers: false);
}
if (steamOriginalSdk32 is null && api32.FileExists() &&
!api32.IsResourceFile(ResourceIdentifier.Steamworks32))
steamOriginalSdk32 = api32.ReadFileBytes(true);
if (steamOriginalSdk64 is null && api64.FileExists() &&
!api64.IsResourceFile(ResourceIdentifier.Steamworks64))
steamOriginalSdk64 = api64.ReadFileBytes(true);
directory.GetScreamApiComponents(out api32, out api32_o, out api64, out api64_o, out config,
directory.GetScreamApiComponents(out api32, out api32_o, out api64, out api64_o, out string screamConfig,
out string log);
screamInstalled = screamInstalled || api32_o.FileExists() || api64_o.FileExists()
|| (config.FileExists() || log.FileExists()) && !koaloaderInstalled
|| (screamConfig.FileExists() || log.FileExists()) && !koaloaderInstalled
|| api32.FileExists() && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32)
|| api64.FileExists() && api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64);
await ScreamAPI.Uninstall(directory, deleteOthers: false);
@ -143,8 +158,16 @@ internal static class ParadoxLauncher
neededRepair = true;
}
if (smokeInstalled)
if (creamInstalled)
if (Program.UseSmokeAPI)
{
await SmokeAPI.Install(directory, selection, generateConfig: false);
}
else
{
await CreamAPI.Install(directory, selection, generateConfig: false);
}
directory.GetScreamApiComponents(out api32, out _, out api64, out _, out _, out _);
if (epicOriginalSdk32 is not null && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
{

View file

@ -35,6 +35,9 @@ internal static class Program
internal static readonly string CurrentProcessFilePath = CurrentProcess.MainModule?.FileName;
internal static readonly int CurrentProcessId = CurrentProcess.Id;
// this may forever be false, but who knows, maybe acidicoala makes it once again better than CreamAPI some day
internal static bool UseSmokeAPI = false;
internal static bool BlockProtectedGames = true;
internal static readonly string[] ProtectedGames = ["PAYDAY 2"];
internal static readonly string[] ProtectedGameDirectories = [@"\EasyAntiCheat", @"\BattlEye"];

View file

@ -1,16 +1,21 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CreamInstaller.Components;
using CreamInstaller.Forms;
using CreamInstaller.Utility;
using static CreamInstaller.Resources.Resources;
namespace CreamInstaller.Resources;
internal static class CreamAPI
{
// TODO: add proxy mode support
internal static void GetCreamApiComponents(this string directory, out string api32, out string api32_o,
out string api64, out string api64_o,
out string config)
out string api64, out string api64_o, out string config)
{
api32 = directory + @"\steam_api.dll";
api32_o = directory + @"\steam_api_o.dll";
@ -22,28 +27,171 @@ internal static class CreamAPI
internal static void CheckConfig(string directory, Selection selection, InstallForm installForm = null)
{
// TODO
directory.GetCreamApiComponents(out _, out _, out _, out _, out string config);
HashSet<SelectionDLC> dlc = selection.DLC.Where(dlc => dlc.Enabled).ToHashSet();
foreach (SelectionDLC extraDlc in selection.ExtraSelections.SelectMany(extraSelection =>
extraSelection.DLC.Where(_dlc => _dlc.Enabled)))
_ = dlc.Add(extraDlc);
if (dlc.Count > 0)
{
/*if (installForm is not null)
installForm.UpdateUser("Generating CreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);*/
config.CreateFile(true, installForm)?.Close();
StreamWriter writer = new(config, true, Encoding.UTF8);
WriteConfig(writer, selection.Name, selection.Id,
new(dlc.ToDictionary(_dlc => _dlc.Id, _dlc => _dlc.Name), PlatformIdComparer.String), installForm);
writer.Flush();
writer.Close();
}
else if (config.FileExists())
{
config.DeleteFile();
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action,
false);
}
}
private static void WriteConfig(StreamWriter writer, string appId,
SortedList<string, (string name, SortedList<string, SelectionDLC> injectDlc)> extraApps,
SortedList<string, SelectionDLC> overrideDlc, SortedList<string, SelectionDLC> injectDlc,
InstallForm installForm = null)
private static void WriteConfig(StreamWriter writer, string name, string appId,
SortedList<string, string> dlc, InstallForm installForm = null)
{
// TODO
writer.WriteLine($"; {name}");
writer.WriteLine("[steam]");
writer.WriteLine($"appid = {appId}");
// TODO: check if we should add these
// writer.WriteLine("unlockall = true");
// writer.WriteLine("extraprotection = true");
writer.WriteLine();
writer.WriteLine("[dlc]");
// installForm?.UpdateUser($"Added game to cream_api.ini with appid {appId} ({name})",
// LogTextBox.Action, false);
foreach ((string dlcId, string dlcName) in dlc)
{
writer.WriteLine($"{dlcId} = {dlcName}");
installForm?.UpdateUser($"Added DLC to cream_api.ini with appid {dlcId} ({dlcName})",
LogTextBox.Action, false);
}
}
private static void DeleteSmokeApiComponents(string directory, InstallForm installForm = null)
{
directory.GetSmokeApiComponents(out _, out _, out _, out _,
out string old_config, out string config, out string old_log, out string log, out string cache);
if (old_config.FileExists())
{
old_config.DeleteFile();
installForm?.UpdateUser($"Deleted old SmokeAPI configuration: {Path.GetFileName(old_config)}",
LogTextBox.Action, false);
}
if (config.FileExists())
{
config.DeleteFile();
installForm?.UpdateUser($"Deleted old SmokeAPI configuration: {Path.GetFileName(config)}",
LogTextBox.Action, false);
}
if (old_log.FileExists())
{
old_log.DeleteFile();
installForm?.UpdateUser($"Deleted old SmokeAPI log: {Path.GetFileName(old_log)}",
LogTextBox.Action, false);
}
if (log.FileExists())
{
log.DeleteFile();
installForm?.UpdateUser($"Deleted old SmokeAPI log: {Path.GetFileName(log)}",
LogTextBox.Action, false);
}
if (cache.FileExists())
{
cache.DeleteFile();
installForm?.UpdateUser($"Deleted old SmokeAPI cache: {Path.GetFileName(cache)}",
LogTextBox.Action, false);
}
}
internal static async Task Uninstall(string directory, InstallForm installForm = null, bool deleteOthers = true)
=> await Task.Run(() =>
{
// TODO
DeleteSmokeApiComponents(directory, installForm);
directory.GetCreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o,
out string config);
if (api32_o.FileExists())
{
if (api32.FileExists())
{
api32.DeleteFile(true);
installForm?.UpdateUser($"Deleted CreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
}
api32_o.MoveFile(api32!);
installForm?.UpdateUser(
$"Restored Steamworks: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action,
false);
}
if (api64_o.FileExists())
{
if (api64.FileExists())
{
api64.DeleteFile(true);
installForm?.UpdateUser($"Deleted CreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
}
api64_o.MoveFile(api64!);
installForm?.UpdateUser(
$"Restored Steamworks: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action,
false);
}
if (!deleteOthers)
return;
if (config.FileExists())
{
config.DeleteFile();
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
}
});
internal static async Task Install(string directory, Selection selection, InstallForm installForm = null,
bool generateConfig = true)
=> await Task.Run(() =>
{
// TODO
DeleteSmokeApiComponents(directory, installForm);
directory.GetCreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o,
out _);
if (api32.FileExists() && !api32_o.FileExists())
{
api32.MoveFile(api32_o!, true);
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}",
LogTextBox.Action, false);
}
if (api32_o.FileExists())
{
"CreamAPI.steam_api.dll".WriteManifestResource(api32);
installForm?.UpdateUser($"Wrote CreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
}
if (api64.FileExists() && !api64_o.FileExists())
{
api64.MoveFile(api64_o!, true);
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}",
LogTextBox.Action, false);
}
if (api64_o.FileExists())
{
"CreamAPI.steam_api64.dll".WriteManifestResource(api64);
installForm?.UpdateUser($"Wrote CreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
}
if (generateConfig)
CheckConfig(directory, selection, installForm);
});
internal static readonly Dictionary<ResourceIdentifier, HashSet<string>> ResourceMD5s = new()
@ -111,7 +259,11 @@ internal static class CreamAPI
"23909B4B1C7A182A6596BD0FDF2BFC7C", // CreamAPI v5.0.0.0 Log build
"E6DDF91F4419BE471FBE126A0966648B", // CreamAPI v5.0.0.0 Non-log build
"B14007170E59B03D5DF844BD3457295B", // CreamAPI v5.1.0.0 Log build
"24C712826D939F5CEC9049D4B94FCBDB" // CreamAPI v5.1.0.0 Non-log build
"24C712826D939F5CEC9049D4B94FCBDB", // CreamAPI v5.1.0.0 Non-log build
"BAB060E3FB98BFAB60003089EFF3714B", // CreamAPI v5.2.0.0 Log build
"3DD6F774B64BA9F1C12A0CAAD801E4CB", // CreamAPI v5.2.0.0 Non-log build
"7B052096931080FDC7E10FB9BCE25177", // CreamAPI v5.3.0.0 Log build
"10638F7AC4E18DDBFA533EB6F307AE9E" // CreamAPI v5.3.0.0 Non-log build
],
[ResourceIdentifier.Steamworks64] =
[
@ -176,7 +328,11 @@ internal static class CreamAPI
"15D76C0CBB175AA94936200C5208611E", // CreamAPI v5.0.0.0 Log build
"B7CF4BC4020C6419249E32EE126FF647", // CreamAPI v5.0.0.0 Non-log build
"BE635705410B93A1075ED32AA97E3B5C", // CreamAPI v5.1.0.0 Log build
"1B14C913C0DF41CC0667993D9B37404D" // CreamAPI v5.1.0.0 Non-log build
"1B14C913C0DF41CC0667993D9B37404D", // CreamAPI v5.1.0.0 Non-log build
"218DC783A7E274494517F3A55FFCA225", // CreamAPI v5.2.0.0 Log build
"562F62C0AA6244397B92246C6C5A778F", // CreamAPI v5.2.0.0 Non-log build
"D719E3852BBA105B97F061630A08CA74", // CreamAPI v5.3.0.0 Log build
"87EA1775F0CEE3649DBB31043EB51FC0" // CreamAPI v5.3.0.0 Non-log build
]
};
}

Binary file not shown.

Binary file not shown.

View file

@ -182,7 +182,7 @@ internal static class Koaloader
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
}
await SmokeAPI.Uninstall(directory, installForm, deleteConfig);
if (Program.UseSmokeAPI) await SmokeAPI.Uninstall(directory, installForm, deleteConfig);
await ScreamAPI.Uninstall(directory, installForm, deleteConfig);
await UplayR1.Uninstall(directory, installForm, deleteConfig);
await UplayR2.Uninstall(directory, installForm, deleteConfig);
@ -195,7 +195,7 @@ internal static class Koaloader
InstallForm installForm = null, bool generateConfig = true)
=> await Task.Run(() =>
{
string proxy = selection.KoaloaderProxy ?? Selection.DefaultKoaloaderProxy;
string proxy = selection.Proxy ?? Selection.DefaultProxy;
string path = directory + @"\" + proxy + ".dll";
foreach (string _path in directory.GetKoaloaderProxies().Where(p =>
p != path && p.FileExists() && p.IsResourceFile(ResourceIdentifier.Koaloader)))
@ -230,7 +230,7 @@ internal static class Koaloader
break;
}
if (selection.Platform is Platform.Steam or Platform.Paradox)
if (Program.UseSmokeAPI && selection.Platform is Platform.Steam or Platform.Paradox)
{
if (bit32)
{

View file

@ -174,8 +174,7 @@ internal static class SmokeAPI
writer.WriteLine("}");
}
internal static async Task Uninstall(string directory, InstallForm installForm = null, bool deleteOthers = true)
=> await Task.Run(() =>
private static void DeleteCreamApiComponents(string directory, InstallForm installForm = null)
{
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
if (oldConfig.FileExists())
@ -184,10 +183,15 @@ internal static class SmokeAPI
installForm?.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}",
LogTextBox.Action, false);
}
}
internal static async Task Uninstall(string directory, InstallForm installForm = null, bool deleteOthers = true)
=> await Task.Run(() =>
{
DeleteCreamApiComponents(directory, installForm);
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o,
out string old_config,
out string config, out string old_log, out string log, out string cache);
out string old_config, out string config, out string old_log, out string log, out string cache);
if (api32_o.FileExists())
{
if (api32.FileExists())
@ -254,13 +258,7 @@ internal static class SmokeAPI
bool generateConfig = true)
=> await Task.Run(() =>
{
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
if (oldConfig.FileExists())
{
oldConfig.DeleteFile();
installForm?.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}",
LogTextBox.Action, false);
}
DeleteCreamApiComponents(directory, installForm);
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o,
out _, out _, out _, out _, out _);

View file

@ -20,7 +20,10 @@ public enum Platform
internal sealed class Selection : IEquatable<Selection>
{
internal const string DefaultKoaloaderProxy = "version";
internal const string DefaultProxy = "version";
// TODO: add proxy mode support for CreamAPI and set this to true
internal bool CanUseProxy => Program.UseSmokeAPI || Platform is not Platform.Steam;
internal static readonly ConcurrentDictionary<Selection, byte> All = new();
@ -33,8 +36,8 @@ internal sealed class Selection : IEquatable<Selection>
internal readonly string RootDirectory;
internal readonly TreeNode TreeNode;
internal string Icon;
internal bool Koaloader;
internal string KoaloaderProxy;
internal bool UseProxy;
internal string Proxy;
internal string Product;
internal string Publisher;
internal string SubIcon;
@ -55,7 +58,7 @@ internal sealed class Selection : IEquatable<Selection>
if (selectForm is null)
return;
Enabled = selectForm.allCheckBox.Checked;
Koaloader = selectForm.koaloaderAllCheckBox.Checked;
UseProxy = selectForm.proxyAllCheckBox.Checked;
}
internal static IEnumerable<Selection> AllEnabled => All.Keys.Where(s => s.Enabled);

View file

@ -162,7 +162,7 @@ internal static class ProgramData
}
}
internal static IEnumerable<(Platform platform, string id, string proxy, bool enabled)> ReadKoaloaderChoices()
internal static IEnumerable<(Platform platform, string id, string proxy, bool enabled)> ReadProxyChoices()
{
if (KoaloaderProxyChoicesPath.FileExists())
try
@ -180,7 +180,7 @@ internal static class ProgramData
return Enumerable.Empty<(Platform platform, string id, string proxy, bool enabled)>();
}
internal static void WriteKoaloaderProxyChoices(
internal static void WriteProxyChoices(
IEnumerable<(Platform platform, string id, string proxy, bool enabled)> choices)
{
try

7
global.json Normal file
View file

@ -0,0 +1,7 @@
{
"sdk": {
"version": "8.0.0",
"rollForward": "latestMinor",
"allowPrerelease": false
}
}