v4.1.4.0
- Improved the responsiveness and performance of the program - Fixed the changelog tree view garbling when clicking update - Dialog forms no longer clutter the taskbar - Added a debug form (this is really just for me) - Fixed rescan lag caused by keeping nodes - Minor refactoring
This commit is contained in:
parent
89f42ed35d
commit
1998bdef9b
24 changed files with 532 additions and 274 deletions
|
@ -1,22 +1,55 @@
|
|||
using System.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CreamInstaller.Components;
|
||||
|
||||
internal class CustomForm : Form
|
||||
{
|
||||
internal CustomForm() : base() => Icon = Properties.Resources.Icon;
|
||||
|
||||
internal CustomForm(IWin32Window owner) : this()
|
||||
internal CustomForm() : base()
|
||||
{
|
||||
Owner = (owner as Form) ?? ActiveForm;
|
||||
Icon = Properties.Resources.Icon;
|
||||
KeyPreview = true;
|
||||
KeyPress += OnKeyPress;
|
||||
ResizeRedraw = true;
|
||||
}
|
||||
|
||||
internal CustomForm(IWin32Window owner) : this()
|
||||
{
|
||||
if (owner is Form form)
|
||||
{
|
||||
Owner = form;
|
||||
InheritLocation(form);
|
||||
SizeChanged += (s, e) => InheritLocation(form);
|
||||
form.Activated += OnActivation;
|
||||
FormClosing += (s, e) => form.Activated -= OnActivation;
|
||||
}
|
||||
}
|
||||
|
||||
internal void OnActivation(object sender, EventArgs args) => Activate();
|
||||
|
||||
public static readonly IntPtr HWND_NOTOPMOST = new(-2);
|
||||
public static readonly IntPtr HWND_TOPMOST = new(-1);
|
||||
public const short SWP_NOACTIVATE = 0x0010;
|
||||
public const short SWP_SHOWWINDOW = 0x0040;
|
||||
public const short SWP_NOMOVE = 0x0002;
|
||||
public const short SWP_NOSIZE = 0x0001;
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
internal static extern void SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
|
||||
|
||||
internal void BringToFrontWithoutActivation()
|
||||
{
|
||||
bool topMost = TopMost;
|
||||
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
if (!topMost)
|
||||
SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams // Double buffering for all controls
|
||||
{
|
||||
get
|
||||
|
@ -29,6 +62,8 @@ internal class CustomForm : Form
|
|||
|
||||
internal void InheritLocation(Form fromForm)
|
||||
{
|
||||
if (fromForm is null)
|
||||
return;
|
||||
int X = fromForm.Location.X + fromForm.Size.Width / 2 - Size.Width / 2;
|
||||
int Y = fromForm.Location.Y + fromForm.Size.Height / 2 - Size.Height / 2;
|
||||
Location = new(X, Y);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<UseWindowsForms>True</UseWindowsForms>
|
||||
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
||||
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
|
||||
<Version>4.1.3.1</Version>
|
||||
<Version>4.1.4.0</Version>
|
||||
<PackageIcon>Resources\ini.ico</PackageIcon>
|
||||
<PackageLicenseFile>LICENSE</PackageLicenseFile>
|
||||
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
||||
|
|
69
CreamInstaller/Forms/DebugForm.Designer.cs
generated
Normal file
69
CreamInstaller/Forms/DebugForm.Designer.cs
generated
Normal file
|
@ -0,0 +1,69 @@
|
|||
namespace CreamInstaller;
|
||||
|
||||
partial class DebugForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.debugTextBox = new System.Windows.Forms.RichTextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// debugTextBox
|
||||
//
|
||||
this.debugTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.debugTextBox.Location = new System.Drawing.Point(10, 10);
|
||||
this.debugTextBox.Name = "debugTextBox";
|
||||
this.debugTextBox.ReadOnly = true;
|
||||
this.debugTextBox.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.ForcedBoth;
|
||||
this.debugTextBox.Size = new System.Drawing.Size(544, 321);
|
||||
this.debugTextBox.TabIndex = 0;
|
||||
this.debugTextBox.TabStop = false;
|
||||
this.debugTextBox.Text = "";
|
||||
//
|
||||
// DebugForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(564, 341);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.debugTextBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "DebugForm";
|
||||
this.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.ShowIcon = false;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "Debug";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox debugTextBox;
|
||||
}
|
84
CreamInstaller/Forms/DebugForm.cs
Normal file
84
CreamInstaller/Forms/DebugForm.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
using CreamInstaller.Components;
|
||||
using CreamInstaller.Utility;
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CreamInstaller;
|
||||
|
||||
internal partial class DebugForm : CustomForm
|
||||
{
|
||||
internal static DebugForm current;
|
||||
internal static DebugForm Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (current is not null && (current.Disposing || current.IsDisposed))
|
||||
current = null;
|
||||
return current ??= new();
|
||||
}
|
||||
set => current = value;
|
||||
}
|
||||
|
||||
internal DebugForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
debugTextBox.BackColor = LogTextBox.Background;
|
||||
}
|
||||
|
||||
protected override void WndProc(ref Message message) // make form immovable by user
|
||||
{
|
||||
if (message.Msg == 0x0112) // WM_SYSCOMMAND
|
||||
{
|
||||
int command = message.WParam.ToInt32() & 0xFFF0;
|
||||
if (command == 0xF010) // SC_MOVE
|
||||
return;
|
||||
}
|
||||
base.WndProc(ref message);
|
||||
}
|
||||
|
||||
private Form attachedForm;
|
||||
|
||||
internal void Attach(Form form)
|
||||
{
|
||||
if (attachedForm is not null)
|
||||
{
|
||||
attachedForm.Activated -= OnChange;
|
||||
attachedForm.LocationChanged -= OnChange;
|
||||
attachedForm.SizeChanged -= OnChange;
|
||||
}
|
||||
attachedForm = form;
|
||||
attachedForm.Activated += OnChange;
|
||||
attachedForm.LocationChanged += OnChange;
|
||||
attachedForm.SizeChanged += OnChange;
|
||||
UpdateAttachment();
|
||||
}
|
||||
|
||||
internal void OnChange(object sender, EventArgs args) => UpdateAttachment();
|
||||
|
||||
internal void UpdateAttachment()
|
||||
{
|
||||
if (attachedForm is null)
|
||||
return;
|
||||
Size = new(Size.Width, attachedForm.Size.Height);
|
||||
Location = new(attachedForm.Right, attachedForm.Top);
|
||||
Show();
|
||||
BringToFrontWithoutActivation();
|
||||
}
|
||||
|
||||
internal void Log(string text) => Log(text, LogTextBox.Error);
|
||||
|
||||
internal void Log(string text, Color color)
|
||||
{
|
||||
if (!debugTextBox.Disposing && !debugTextBox.IsDisposed)
|
||||
{
|
||||
debugTextBox.Invoke(() =>
|
||||
{
|
||||
if (debugTextBox.Text.Length > 0)
|
||||
debugTextBox.AppendText(Environment.NewLine, color, scroll: true);
|
||||
debugTextBox.AppendText(text, color, scroll: true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
63
CreamInstaller/Forms/DebugForm.resx
Normal file
63
CreamInstaller/Forms/DebugForm.resx
Normal file
|
@ -0,0 +1,63 @@
|
|||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
</root>
|
1
CreamInstaller/Forms/DialogForm.Designer.cs
generated
1
CreamInstaller/Forms/DialogForm.Designer.cs
generated
|
@ -125,6 +125,7 @@ namespace CreamInstaller
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "DialogForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "DialogForm";
|
||||
((System.ComponentModel.ISupportInitialize)(this.icon)).EndInit();
|
||||
|
|
|
@ -8,7 +8,11 @@ namespace CreamInstaller;
|
|||
|
||||
internal partial class DialogForm : CustomForm
|
||||
{
|
||||
internal DialogForm(IWin32Window owner) : base(owner) => InitializeComponent();
|
||||
internal DialogForm(IWin32Window owner) : base(owner)
|
||||
{
|
||||
InitializeComponent();
|
||||
TopLevel = true;
|
||||
}
|
||||
|
||||
internal DialogResult Show(Icon descriptionIcon, string descriptionText, string acceptButtonText = "OK", string cancelButtonText = null, string customFormText = null, Icon customFormIcon = null)
|
||||
{
|
||||
|
|
2
CreamInstaller/Forms/InstallForm.Designer.cs
generated
2
CreamInstaller/Forms/InstallForm.Designer.cs
generated
|
@ -136,7 +136,7 @@ namespace CreamInstaller
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "InstallForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "InstallForm";
|
||||
this.Load += new System.EventHandler(this.OnLoad);
|
||||
this.ResumeLayout(false);
|
||||
|
|
|
@ -9,7 +9,6 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using static CreamInstaller.Paradox.ParadoxLauncher;
|
||||
using static CreamInstaller.Resources.Resources;
|
||||
|
@ -21,11 +20,11 @@ internal partial class InstallForm : CustomForm
|
|||
internal bool Reselecting;
|
||||
internal readonly bool Uninstalling;
|
||||
|
||||
internal InstallForm(IWin32Window owner, bool uninstall = false) : base(owner)
|
||||
internal InstallForm(bool uninstall = false) : base()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Program.ApplicationName;
|
||||
logTextBox.BackColor = InstallationLog.Background;
|
||||
logTextBox.BackColor = LogTextBox.Background;
|
||||
Uninstalling = uninstall;
|
||||
}
|
||||
|
||||
|
@ -62,46 +61,51 @@ internal partial class InstallForm : CustomForm
|
|||
UpdateProgress(0);
|
||||
if (selection.Id == "PL")
|
||||
{
|
||||
UpdateUser($"Repairing Paradox Launcher . . . ", InstallationLog.Operation);
|
||||
UpdateUser($"Repairing Paradox Launcher . . . ", LogTextBox.Operation);
|
||||
_ = await Repair(this, selection);
|
||||
}
|
||||
UpdateUser($"Checking directories for {selection.Name} . . . ", InstallationLog.Operation);
|
||||
UpdateUser($"Checking directories for {selection.Name} . . . ", LogTextBox.Operation);
|
||||
IEnumerable<string> invalidDirectories = (await selection.RootDirectory.GetExecutables())
|
||||
.Where(d => !selection.ExecutableDirectories.Any(s => d.path.Contains(s.directory)))
|
||||
.Select(d => Path.GetDirectoryName(d.path));
|
||||
?.Where(d => !selection.ExecutableDirectories.Any(s => d.path.Contains(s.directory)))
|
||||
?.Select(d => Path.GetDirectoryName(d.path));
|
||||
if (!selection.ExecutableDirectories.Any(s => s.directory == selection.RootDirectory))
|
||||
invalidDirectories = invalidDirectories.Append(selection.RootDirectory);
|
||||
invalidDirectories = invalidDirectories.Distinct();
|
||||
foreach (string directory in invalidDirectories)
|
||||
{
|
||||
directory.GetKoaloaderComponents(out List<string> proxies, out string config);
|
||||
if (proxies.Any(proxy => File.Exists(proxy) && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||
|| Koaloader.AutoLoadDlls.Any(pair => File.Exists(directory + @"\" + pair.dll))
|
||||
|| File.Exists(config))
|
||||
{
|
||||
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in incorrect directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
await Koaloader.Uninstall(directory, this);
|
||||
}
|
||||
Thread.Sleep(0);
|
||||
}
|
||||
if (Uninstalling || !selection.Koaloader)
|
||||
{
|
||||
foreach ((string directory, BinaryType binaryType) in selection.ExecutableDirectories)
|
||||
invalidDirectories = invalidDirectories?.Append(selection.RootDirectory);
|
||||
invalidDirectories = invalidDirectories?.Distinct();
|
||||
if (invalidDirectories is not null)
|
||||
foreach (string directory in invalidDirectories)
|
||||
{
|
||||
if (Program.Canceled) throw new CustomMessageException("The operation was canceled.");
|
||||
directory.GetKoaloaderComponents(out List<string> proxies, out string config);
|
||||
if (proxies.Any(proxy => File.Exists(proxy) && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||
|| Koaloader.AutoLoadDlls.Any(pair => File.Exists(directory + @"\" + pair.dll))
|
||||
|| File.Exists(config))
|
||||
{
|
||||
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in incorrect directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
await Koaloader.Uninstall(directory, this);
|
||||
}
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
if (Uninstalling || !selection.Koaloader)
|
||||
{
|
||||
foreach ((string directory, BinaryType binaryType) in selection.ExecutableDirectories)
|
||||
{
|
||||
if (Program.Canceled) throw new CustomMessageException("The operation was canceled.");
|
||||
directory.GetKoaloaderComponents(out List<string> proxies, out string config);
|
||||
if (proxies.Any(proxy => File.Exists(proxy) && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||
|| Koaloader.AutoLoadDlls.Any(pair => File.Exists(directory + @"\" + pair.dll))
|
||||
|| File.Exists(config))
|
||||
{
|
||||
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
await Koaloader.Uninstall(directory, this);
|
||||
}
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
bool uninstallProxy = Uninstalling || selection.Koaloader;
|
||||
int count = selection.DllDirectories.Count, cur = 0;
|
||||
foreach (string directory in selection.DllDirectories)
|
||||
{
|
||||
if (Program.Canceled) throw new CustomMessageException("The operation was canceled.");
|
||||
if (selection.Platform is Platform.Steam or Platform.Paradox
|
||||
&& (selection.SelectedDlc.Any(d => d.Value.type is DlcType.Steam or DlcType.SteamHidden)
|
||||
|| selection.ExtraSelectedDlc.Any(item => item.dlc.Any(dlc => dlc.Value.type is DlcType.Steam or DlcType.SteamHidden))))
|
||||
|
@ -112,7 +116,7 @@ internal partial class InstallForm : CustomForm
|
|||
|| !selection.Koaloader && (File.Exists(config) || File.Exists(cache))))
|
||||
{
|
||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} SmokeAPI" +
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
if (uninstallProxy)
|
||||
await SmokeAPI.Uninstall(directory, this);
|
||||
else
|
||||
|
@ -129,7 +133,7 @@ internal partial class InstallForm : CustomForm
|
|||
|| !selection.Koaloader && File.Exists(config)))
|
||||
{
|
||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} ScreamAPI" +
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
if (uninstallProxy)
|
||||
await ScreamAPI.Uninstall(directory, this);
|
||||
else
|
||||
|
@ -144,7 +148,7 @@ internal partial class InstallForm : CustomForm
|
|||
|| !selection.Koaloader && File.Exists(config)))
|
||||
{
|
||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" +
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
if (uninstallProxy)
|
||||
await UplayR1.Uninstall(directory, this);
|
||||
else
|
||||
|
@ -156,7 +160,7 @@ internal partial class InstallForm : CustomForm
|
|||
|| !selection.Koaloader && File.Exists(config)))
|
||||
{
|
||||
UpdateUser($"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" +
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
$" {(uninstallProxy ? "from" : "for")} " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
if (uninstallProxy)
|
||||
await UplayR2.Uninstall(directory, this);
|
||||
else
|
||||
|
@ -164,13 +168,16 @@ internal partial class InstallForm : CustomForm
|
|||
}
|
||||
}
|
||||
UpdateProgress(++cur / count * 100);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
if (selection.Koaloader && !Uninstalling)
|
||||
{
|
||||
foreach ((string directory, BinaryType binaryType) in selection.ExecutableDirectories)
|
||||
{
|
||||
UpdateUser("Installing Koaloader to " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
if (Program.Canceled) throw new CustomMessageException("The operation was canceled.");
|
||||
UpdateUser("Installing Koaloader to " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
await Koaloader.Install(directory, binaryType, selection, this);
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
}
|
||||
UpdateProgress(100);
|
||||
|
@ -189,13 +196,13 @@ internal partial class InstallForm : CustomForm
|
|||
try
|
||||
{
|
||||
await OperateFor(selection);
|
||||
UpdateUser($"Operation succeeded for {selection.Name}.", InstallationLog.Success);
|
||||
UpdateUser($"Operation succeeded for {selection.Name}.", LogTextBox.Success);
|
||||
selection.Enabled = false;
|
||||
DisabledSelections.Add(selection);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UpdateUser($"Operation failed for {selection.Name}: " + exception, InstallationLog.Error);
|
||||
UpdateUser($"Operation failed for {selection.Name}: " + exception, LogTextBox.Error);
|
||||
}
|
||||
++CompleteOperationsCount;
|
||||
}
|
||||
|
@ -224,11 +231,11 @@ internal partial class InstallForm : CustomForm
|
|||
try
|
||||
{
|
||||
await Operate();
|
||||
UpdateUser($"DLC unlocker(s) successfully {(Uninstalling ? "uninstalled" : "installed and generated")} for " + ProgramCount + " program(s).", InstallationLog.Success);
|
||||
UpdateUser($"DLC unlocker(s) successfully {(Uninstalling ? "uninstalled" : "installed and generated")} for " + ProgramCount + " program(s).", LogTextBox.Success);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
UpdateUser($"DLC unlocker {(Uninstalling ? "uninstallation" : "installation and/or generation")} failed: " + exception, InstallationLog.Error);
|
||||
UpdateUser($"DLC unlocker {(Uninstalling ? "uninstallation" : "installation and/or generation")} failed: " + exception, LogTextBox.Error);
|
||||
retryButton.Enabled = true;
|
||||
}
|
||||
userProgressBar.Value = userProgressBar.Maximum;
|
||||
|
|
|
@ -37,10 +37,16 @@ internal partial class MainForm : CustomForm
|
|||
cancellationTokenSource.Dispose();
|
||||
cancellationTokenSource = null;
|
||||
}
|
||||
#pragma warning disable CA2000 // Dispose objects before losing scope
|
||||
SelectForm form = new();
|
||||
#pragma warning restore CA2000 // Dispose objects before losing scope
|
||||
form.InheritLocation(this);
|
||||
form.FormClosing += (s, e) => Close();
|
||||
form.Show();
|
||||
Hide();
|
||||
using SelectForm form = new(this);
|
||||
_ = form.ShowDialog();
|
||||
Close();
|
||||
#if DEBUG
|
||||
DebugForm.Current.Attach(form);
|
||||
#endif
|
||||
}
|
||||
|
||||
private UpdateManager updateManager;
|
||||
|
@ -56,8 +62,10 @@ internal partial class MainForm : CustomForm
|
|||
progressLabel.Text = "Checking for updates . . .";
|
||||
changelogTreeView.Visible = false;
|
||||
changelogTreeView.Location = new(progressLabel.Location.X, progressLabel.Location.Y + progressLabel.Size.Height + 13);
|
||||
Invalidate();
|
||||
|
||||
Refresh();
|
||||
#if DEBUG
|
||||
DebugForm.Current.Attach(this);
|
||||
#endif
|
||||
GithubPackageResolver resolver = new("pointfeev", "CreamInstaller", "CreamInstaller.zip");
|
||||
ZipPackageExtractor extractor = new();
|
||||
updateManager = new(AssemblyMetadata.FromAssembly(Program.EntryAssembly, Program.CurrentProcessFilePath), resolver, extractor);
|
||||
|
@ -72,16 +80,17 @@ internal partial class MainForm : CustomForm
|
|||
if (checkForUpdatesResult.CanUpdate)
|
||||
{
|
||||
#endif
|
||||
latestVersion = checkForUpdatesResult.LastVersion;
|
||||
versions = checkForUpdatesResult.Versions;
|
||||
latestVersion = checkForUpdatesResult.LastVersion;
|
||||
versions = checkForUpdatesResult.Versions;
|
||||
#if !DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if DEBUG
|
||||
catch (TaskCanceledException) { }
|
||||
catch (Exception e)
|
||||
{
|
||||
e.HandleException(form: this, caption: "Debug exception", acceptButtonText: "OK", cancelButtonText: null);
|
||||
DebugForm.Current.Log($"Exception while checking for updates: {e.GetType()} ({e.Message})", LogTextBox.Warning);
|
||||
}
|
||||
#else
|
||||
catch { }
|
||||
|
@ -124,10 +133,12 @@ internal partial class MainForm : CustomForm
|
|||
HtmlNodeCollection nodes = await HttpClientManager.GetDocumentNodes(
|
||||
$"https://github.com/pointfeev/CreamInstaller/releases/tag/v{version}",
|
||||
"//div[@data-test-selector='body-content']/ul/li");
|
||||
if (nodes is null) changelogTreeView.Nodes.Remove(root);
|
||||
else foreach (HtmlNode node in nodes)
|
||||
if (nodes is null)
|
||||
changelogTreeView.Nodes.Remove(root);
|
||||
else
|
||||
foreach (HtmlNode node in nodes)
|
||||
{
|
||||
Program.Invoke(changelogTreeView, delegate
|
||||
changelogTreeView.Invoke(delegate
|
||||
{
|
||||
TreeNode change = new()
|
||||
{
|
||||
|
@ -181,7 +192,7 @@ internal partial class MainForm : CustomForm
|
|||
updateButton.Click -= OnUpdate;
|
||||
updateButton.Click += new(OnUpdateCancel);
|
||||
changelogTreeView.Location = new(progressBar.Location.X, progressBar.Location.Y + progressBar.Size.Height + 6);
|
||||
Invalidate();
|
||||
Refresh();
|
||||
|
||||
Progress<double> progress = new();
|
||||
progress.ProgressChanged += new(delegate (object sender, double _progress)
|
||||
|
@ -197,9 +208,10 @@ internal partial class MainForm : CustomForm
|
|||
await updateManager.PrepareUpdateAsync(latestVersion, progress, cancellationTokenSource.Token);
|
||||
}
|
||||
#if DEBUG
|
||||
catch (TaskCanceledException) { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.HandleException(form: this, caption: "Debug exception", acceptButtonText: "OK", cancelButtonText: null);
|
||||
DebugForm.Current.Log($"Exception while preparing update: {ex.GetType()} ({ex.Message})", LogTextBox.Warning);
|
||||
}
|
||||
#else
|
||||
catch { }
|
||||
|
|
|
@ -185,7 +185,8 @@ namespace CreamInstaller
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SelectDialogForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.ShowInTaskbar = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "SelectDialogForm";
|
||||
this.groupBox.ResumeLayout(false);
|
||||
this.groupBox.PerformLayout();
|
||||
|
|
|
@ -12,7 +12,11 @@ namespace CreamInstaller;
|
|||
|
||||
internal partial class SelectDialogForm : CustomForm
|
||||
{
|
||||
internal SelectDialogForm(IWin32Window owner) : base(owner) => InitializeComponent();
|
||||
internal SelectDialogForm(IWin32Window owner) : base(owner)
|
||||
{
|
||||
InitializeComponent();
|
||||
TopLevel = true;
|
||||
}
|
||||
|
||||
private readonly List<(Platform platform, string id, string name)> selected = new();
|
||||
internal List<(Platform platform, string id, string name)> QueryUser(string groupBoxText, List<(Platform platform, string id, string name, bool alreadySelected)> choices)
|
||||
|
|
2
CreamInstaller/Forms/SelectForm.Designer.cs
generated
2
CreamInstaller/Forms/SelectForm.Designer.cs
generated
|
@ -321,7 +321,7 @@ namespace CreamInstaller
|
|||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "SelectForm";
|
||||
this.StartPosition = FormStartPosition.CenterParent;
|
||||
this.StartPosition = FormStartPosition.Manual;
|
||||
this.Text = "SelectForm";
|
||||
this.Load += this.OnLoad;
|
||||
this.programsGroupBox.ResumeLayout(false);
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace CreamInstaller;
|
|||
|
||||
internal partial class SelectForm : CustomForm
|
||||
{
|
||||
internal SelectForm(IWin32Window owner) : base(owner)
|
||||
internal SelectForm() : base()
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = Program.ApplicationName;
|
||||
|
@ -43,7 +43,7 @@ internal partial class SelectForm : CustomForm
|
|||
private void AddToRemainingGames(string gameName)
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
Program.Invoke(progressLabelGames, delegate
|
||||
progressLabelGames.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
if (!RemainingGames.Contains(gameName))
|
||||
|
@ -54,7 +54,7 @@ internal partial class SelectForm : CustomForm
|
|||
private void RemoveFromRemainingGames(string gameName)
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
Program.Invoke(progressLabelGames, delegate
|
||||
progressLabelGames.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
RemainingGames.Remove(gameName);
|
||||
|
@ -67,7 +67,7 @@ internal partial class SelectForm : CustomForm
|
|||
private void AddToRemainingDLCs(string dlcId)
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
Program.Invoke(progressLabelDLCs, delegate
|
||||
progressLabelDLCs.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
if (!RemainingDLCs.Contains(dlcId))
|
||||
|
@ -78,7 +78,7 @@ internal partial class SelectForm : CustomForm
|
|||
private void RemoveFromRemainingDLCs(string dlcId)
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
Program.Invoke(progressLabelDLCs, delegate
|
||||
progressLabelDLCs.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
RemainingDLCs.Remove(dlcId);
|
||||
|
@ -128,8 +128,8 @@ internal partial class SelectForm : CustomForm
|
|||
programNode.Name = selection.Id;
|
||||
programNode.Text = selection.Name;
|
||||
programNode.Checked = selection.Enabled;
|
||||
programNode.Remove();
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
if (programNode.TreeView is null)
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
}
|
||||
}
|
||||
int steamGamesToCheck;
|
||||
|
@ -244,7 +244,7 @@ internal partial class SelectForm : CustomForm
|
|||
selection.WebsiteUrl = appData?.website;
|
||||
|
||||
if (Program.Canceled) return;
|
||||
Program.Invoke(selectionTreeView, delegate
|
||||
selectionTreeView.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
TreeNode programNode = treeNodes.Find(s => s.Tag is Platform.Steam && s.Name == appId) ?? new();
|
||||
|
@ -252,8 +252,8 @@ internal partial class SelectForm : CustomForm
|
|||
programNode.Name = appId;
|
||||
programNode.Text = appData?.name ?? name;
|
||||
programNode.Checked = selection.Enabled;
|
||||
programNode.Remove();
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
if (programNode.TreeView is null)
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
foreach (KeyValuePair<string, (DlcType type, string name, string icon)> pair in dlc)
|
||||
{
|
||||
if (Program.Canceled || programNode is null) return;
|
||||
|
@ -266,8 +266,8 @@ internal partial class SelectForm : CustomForm
|
|||
dlcNode.Name = appId;
|
||||
dlcNode.Text = dlcApp.name;
|
||||
dlcNode.Checked = selection.SelectedDlc.ContainsKey(appId);
|
||||
dlcNode.Remove();
|
||||
_ = programNode.Nodes.Add(dlcNode);
|
||||
if (dlcNode.Parent is null)
|
||||
_ = programNode.Nodes.Add(dlcNode);
|
||||
}
|
||||
});
|
||||
if (Program.Canceled) return;
|
||||
|
@ -344,7 +344,7 @@ internal partial class SelectForm : CustomForm
|
|||
}
|
||||
|
||||
if (Program.Canceled) return;
|
||||
Program.Invoke(selectionTreeView, delegate
|
||||
selectionTreeView.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
TreeNode programNode = treeNodes.Find(s => s.Tag is Platform.Epic && s.Name == @namespace) ?? new();
|
||||
|
@ -352,15 +352,15 @@ internal partial class SelectForm : CustomForm
|
|||
programNode.Name = @namespace;
|
||||
programNode.Text = name;
|
||||
programNode.Checked = selection.Enabled;
|
||||
programNode.Remove();
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
if (programNode.TreeView is null)
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
/*TreeNode catalogItemsNode = treeNodes.Find(s => s.Tag is Platform.Epic && s.Name == @namespace + "_catalogItems") ?? new();
|
||||
catalogItemsNode.Tag = selection.Platform;
|
||||
catalogItemsNode.Name = @namespace + "_catalogItems";
|
||||
catalogItemsNode.Text = "Catalog Items";
|
||||
catalogItemsNode.Checked = selection.SelectedDlc.Any(pair => pair.Value.type == DlcType.CatalogItem);
|
||||
catalogItemsNode.Remove();
|
||||
programNode.Nodes.Add(catalogItemsNode);*/
|
||||
if (catalogItemsNode.Parent is null)
|
||||
programNode.Nodes.Add(catalogItemsNode);*/
|
||||
if (entitlements.Any())
|
||||
{
|
||||
/*TreeNode entitlementsNode = treeNodes.Find(s => s.Tag is Platform.Epic && s.Name == @namespace + "_entitlements") ?? new();
|
||||
|
@ -368,8 +368,8 @@ internal partial class SelectForm : CustomForm
|
|||
entitlementsNode.Name = @namespace + "_entitlements";
|
||||
entitlementsNode.Text = "Entitlements";
|
||||
entitlementsNode.Checked = selection.SelectedDlc.Any(pair => pair.Value.type == DlcType.Entitlement);
|
||||
entitlementsNode.Remove();
|
||||
programNode.Nodes.Add(entitlementsNode);*/
|
||||
if (entitlementsNode.Parent is null)
|
||||
programNode.Nodes.Add(entitlementsNode);*/
|
||||
foreach (KeyValuePair<string, (string name, string product, string icon, string developer)> pair in entitlements)
|
||||
{
|
||||
if (programNode is null/* || entitlementsNode is null*/) return;
|
||||
|
@ -382,8 +382,8 @@ internal partial class SelectForm : CustomForm
|
|||
dlcNode.Name = dlcId;
|
||||
dlcNode.Text = dlcApp.name;
|
||||
dlcNode.Checked = selection.SelectedDlc.ContainsKey(dlcId);
|
||||
dlcNode.Remove();
|
||||
_ = programNode.Nodes.Add(dlcNode); //entitlementsNode.Nodes.Add(dlcNode);
|
||||
if (dlcNode.Parent is null)
|
||||
_ = programNode.Nodes.Add(dlcNode); //entitlementsNode.Nodes.Add(dlcNode);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -423,7 +423,7 @@ internal partial class SelectForm : CustomForm
|
|||
selection.Platform = Platform.Ubisoft;
|
||||
selection.IconUrl = IconGrabber.GetDomainFaviconUrl("store.ubi.com");
|
||||
|
||||
Program.Invoke(selectionTreeView, delegate
|
||||
selectionTreeView.Invoke(delegate
|
||||
{
|
||||
if (Program.Canceled) return;
|
||||
TreeNode programNode = treeNodes.Find(s => s.Tag is Platform.Ubisoft && s.Name == gameId) ?? new();
|
||||
|
@ -431,8 +431,8 @@ internal partial class SelectForm : CustomForm
|
|||
programNode.Name = gameId;
|
||||
programNode.Text = name;
|
||||
programNode.Checked = selection.Enabled;
|
||||
programNode.Remove();
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
if (programNode.TreeView is null)
|
||||
_ = selectionTreeView.Nodes.Add(programNode);
|
||||
});
|
||||
if (Program.Canceled) return;
|
||||
RemoveFromRemainingGames(name);
|
||||
|
@ -524,14 +524,15 @@ internal partial class SelectForm : CustomForm
|
|||
setup = false;
|
||||
progressLabel.Text = "Gathering and caching your applicable games and their DLCs . . . ";
|
||||
ProgramSelection.ValidateAll(ProgramsToScan);
|
||||
TreeNodes.ForEach(node =>
|
||||
/*TreeNodes.ForEach(node =>
|
||||
{
|
||||
if (node.Tag is not Platform platform
|
||||
|| node.Name is not string platformId
|
||||
|| ProgramSelection.FromPlatformId(platform, platformId) is null
|
||||
&& ProgramSelection.GetDlcFromPlatformId(platform, platformId) is null)
|
||||
node.Remove();
|
||||
});
|
||||
});*/
|
||||
TreeNodes.ForEach(node => node.Remove()); // nodes cause lots of lag during rescan for now
|
||||
await GetApplicablePrograms(iProgress);
|
||||
await SteamCMD.Cleanup();
|
||||
}
|
||||
|
@ -835,15 +836,28 @@ internal partial class SelectForm : CustomForm
|
|||
if (!Program.IsProgramRunningDialog(this, selection)) return;
|
||||
if (!uninstall && ParadoxLauncher.DlcDialog(this)) return;
|
||||
Hide();
|
||||
using InstallForm installForm = new(this, uninstall);
|
||||
_ = installForm.ShowDialog();
|
||||
if (installForm.Reselecting)
|
||||
#pragma warning disable CA2000 // Dispose objects before losing scope
|
||||
InstallForm form = new(uninstall);
|
||||
#pragma warning restore CA2000 // Dispose objects before losing scope
|
||||
form.InheritLocation(this);
|
||||
form.FormClosing += (s, e) =>
|
||||
{
|
||||
InheritLocation(installForm);
|
||||
Show();
|
||||
OnLoad();
|
||||
}
|
||||
else Close();
|
||||
if (form.Reselecting)
|
||||
{
|
||||
InheritLocation(form);
|
||||
Show();
|
||||
#if DEBUG
|
||||
DebugForm.Current.Attach(this);
|
||||
#endif
|
||||
OnLoad();
|
||||
}
|
||||
else Close();
|
||||
};
|
||||
form.Show();
|
||||
Hide();
|
||||
#if DEBUG
|
||||
DebugForm.Current.Attach(form);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,14 +120,14 @@ internal static class ParadoxLauncher
|
|||
{
|
||||
steamOriginalSdk32.Write(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Corrected Steamworks: " + api32, InstallationLog.Action);
|
||||
installForm.UpdateUser("Corrected Steamworks: " + api32, LogTextBox.Action);
|
||||
neededRepair = true;
|
||||
}
|
||||
if (steamOriginalSdk64 is not null && api64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
||||
{
|
||||
steamOriginalSdk64.Write(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Corrected Steamworks: " + api64, InstallationLog.Action);
|
||||
installForm.UpdateUser("Corrected Steamworks: " + api64, LogTextBox.Action);
|
||||
neededRepair = true;
|
||||
}
|
||||
if (!selection.Koaloader && smokeConfig)
|
||||
|
@ -138,14 +138,14 @@ internal static class ParadoxLauncher
|
|||
{
|
||||
epicOriginalSdk32.Write(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Corrected Epic Online Services: " + api32, InstallationLog.Action);
|
||||
installForm.UpdateUser("Corrected Epic Online Services: " + api32, LogTextBox.Action);
|
||||
neededRepair = true;
|
||||
}
|
||||
if (epicOriginalSdk64 is not null && api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64))
|
||||
{
|
||||
epicOriginalSdk64.Write(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Corrected Epic Online Services: " + api64, InstallationLog.Action);
|
||||
installForm.UpdateUser("Corrected Epic Online Services: " + api64, LogTextBox.Action);
|
||||
neededRepair = true;
|
||||
}
|
||||
if (!selection.Koaloader && screamConfig)
|
||||
|
@ -154,7 +154,7 @@ internal static class ParadoxLauncher
|
|||
if (neededRepair)
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Paradox Launcher successfully repaired!", InstallationLog.Success);
|
||||
installForm.UpdateUser("Paradox Launcher successfully repaired!", LogTextBox.Success);
|
||||
else
|
||||
_ = dialogForm.Show(form.Icon, "Paradox Launcher successfully repaired!", "OK", customFormText: "Paradox Launcher");
|
||||
return RepairResult.Success;
|
||||
|
@ -162,7 +162,7 @@ internal static class ParadoxLauncher
|
|||
else
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Paradox Launcher did not need to be repaired.", InstallationLog.Success);
|
||||
installForm.UpdateUser("Paradox Launcher did not need to be repaired.", LogTextBox.Success);
|
||||
else
|
||||
_ = dialogForm.Show(SystemIcons.Information, "Paradox Launcher does not need to be repaired.", "OK", customFormText: "Paradox Launcher");
|
||||
return RepairResult.Unnecessary;
|
||||
|
|
|
@ -74,6 +74,9 @@ internal static class Program
|
|||
{
|
||||
HttpClientManager.Setup();
|
||||
using MainForm form = new();
|
||||
#if DEBUG
|
||||
DebugForm.Current.Attach(form);
|
||||
#endif
|
||||
Application.Run(form);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -86,8 +89,6 @@ internal static class Program
|
|||
mutex.Close();
|
||||
}
|
||||
|
||||
internal static void Invoke(this Control control, MethodInvoker methodInvoker) => control.Invoke(methodInvoker);
|
||||
|
||||
internal static bool Canceled;
|
||||
internal static async void Cleanup(bool cancel = true)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ internal static class Koaloader
|
|||
if (targets.Any() || modules.Any())
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Generating Koaloader configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
installForm.UpdateUser("Generating Koaloader configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
File.Create(config).Close();
|
||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||
WriteConfig(writer, targets, modules, installForm);
|
||||
|
@ -79,7 +79,7 @@ internal static class Koaloader
|
|||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ internal static class Koaloader
|
|||
string path = pair.Value;
|
||||
writer.WriteLine($" \"{path}\"{(pair.Equals(lastTarget) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added target to Koaloader.json with path {path}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added target to Koaloader.json with path {path}", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ]");
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ internal static class Koaloader
|
|||
writer.WriteLine($" \"required\": true");
|
||||
writer.WriteLine(" }" + (pair.Equals(lastModule) ? "" : ","));
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added module to Koaloader.json with path {path}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added module to Koaloader.json with path {path}", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ]");
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ internal static class Koaloader
|
|||
{
|
||||
File.Delete(proxyPath);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(proxyPath)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(proxyPath)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
foreach ((string unlocker, string path) in AutoLoadDlls
|
||||
.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
||||
|
@ -140,13 +140,13 @@ internal static class Koaloader
|
|||
{
|
||||
File.Delete(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted {unlocker}: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted {unlocker}: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
await SmokeAPI.Uninstall(directory, installForm, deleteConfig);
|
||||
await ScreamAPI.Uninstall(directory, installForm, deleteConfig);
|
||||
|
@ -162,13 +162,13 @@ internal static class Koaloader
|
|||
{
|
||||
File.Delete(_path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", LogTextBox.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);
|
||||
installForm.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
bool bit32 = false, bit64 = false;
|
||||
foreach (string executable in Directory.EnumerateFiles(directory, "*.exe"))
|
||||
if (executable.TryGetFileBinaryType(out BinaryType binaryType))
|
||||
|
@ -187,14 +187,14 @@ internal static class Koaloader
|
|||
path = directory + @"\SmokeAPI32.dll";
|
||||
"SmokeAPI.steam_api.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (bit64)
|
||||
{
|
||||
path = directory + @"\SmokeAPI64.dll";
|
||||
"SmokeAPI.steam_api64.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
SmokeAPI.CheckConfig(directory, selection, installForm);
|
||||
}
|
||||
|
@ -205,14 +205,14 @@ internal static class Koaloader
|
|||
path = directory + @"\ScreamAPI32.dll";
|
||||
"ScreamAPI.EOSSDK-Win32-Shipping.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (bit64)
|
||||
{
|
||||
path = directory + @"\ScreamAPI64.dll";
|
||||
"ScreamAPI.EOSSDK-Win64-Shipping.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
ScreamAPI.CheckConfig(directory, selection, installForm);
|
||||
}
|
||||
|
@ -223,14 +223,14 @@ internal static class Koaloader
|
|||
path = directory + @"\UplayR1Unlocker32.dll";
|
||||
"UplayR1.uplay_r1_loader.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (bit64)
|
||||
{
|
||||
path = directory + @"\UplayR1Unlocker64.dll";
|
||||
"UplayR1.uplay_r1_loader64.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
UplayR1.CheckConfig(directory, selection, installForm);
|
||||
if (bit32)
|
||||
|
@ -238,14 +238,14 @@ internal static class Koaloader
|
|||
path = directory + @"\UplayR2Unlocker32.dll";
|
||||
"UplayR2.upc_r2_loader.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (bit64)
|
||||
{
|
||||
path = directory + @"\UplayR2Unlocker64.dll";
|
||||
"UplayR2.upc_r2_loader64.dll".Write(path);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(path)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(path)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
UplayR2.CheckConfig(directory, selection, installForm);
|
||||
}
|
||||
|
|
|
@ -78,36 +78,35 @@ internal static class Resources
|
|||
internal static bool TryGetFileBinaryType(this string path, out BinaryType binaryType) => GetBinaryType(path, out binaryType);
|
||||
|
||||
internal static async Task<List<(string directory, BinaryType binaryType)>> GetExecutableDirectories(this string rootDirectory, bool filterCommon = false, Func<string, bool> validFunc = null) =>
|
||||
await Task.Run(async () => (await rootDirectory.GetExecutables(filterCommon: filterCommon, validFunc: validFunc) ?? await rootDirectory.GetExecutables()).Select(e =>
|
||||
await Task.Run(async () => (await rootDirectory.GetExecutables(filterCommon: filterCommon, validFunc: validFunc) ?? await rootDirectory.GetExecutables())?.Select(e =>
|
||||
{
|
||||
e.path = Path.GetDirectoryName(e.path);
|
||||
return e;
|
||||
}).DistinctBy(e => e.path).ToList());
|
||||
})?.DistinctBy(e => e.path).ToList());
|
||||
|
||||
internal static async Task<List<(string path, BinaryType binaryType)>> GetExecutables(this string rootDirectory, bool filterCommon = false, Func<string, bool> validFunc = null) => await Task.Run(() =>
|
||||
{
|
||||
List<(string path, BinaryType binaryType)> executables = new();
|
||||
if (Program.Canceled || !Directory.Exists(rootDirectory)) return null;
|
||||
List<string> files = new(Directory.EnumerateFiles(rootDirectory, "*.exe", new EnumerationOptions() { RecurseSubdirectories = true }));
|
||||
foreach (string path in files)
|
||||
foreach (string path in Directory.EnumerateFiles(rootDirectory, "*.exe", new EnumerationOptions() { RecurseSubdirectories = true }))
|
||||
{
|
||||
if (Program.Canceled) return null;
|
||||
Thread.Sleep(0);
|
||||
if (!executables.Any(e => e.path == path)
|
||||
&& (!filterCommon || !rootDirectory.IsCommonIncorrectExecutable(path))
|
||||
&& (validFunc is null || validFunc(path))
|
||||
&& path.TryGetFileBinaryType(out BinaryType binaryType) && binaryType is BinaryType.BIT64)
|
||||
executables.Add((path, binaryType));
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
foreach (string path in files)
|
||||
foreach (string path in Directory.EnumerateFiles(rootDirectory, "*.exe", new EnumerationOptions() { RecurseSubdirectories = true }))
|
||||
{
|
||||
if (Program.Canceled) return null;
|
||||
Thread.Sleep(0);
|
||||
if (!executables.Any(e => e.path == path)
|
||||
&& (!filterCommon || !rootDirectory.IsCommonIncorrectExecutable(path))
|
||||
&& (validFunc is null || validFunc(path))
|
||||
&& path.TryGetFileBinaryType(out BinaryType binaryType) && binaryType is BinaryType.BIT32)
|
||||
executables.Add((path, binaryType));
|
||||
Thread.Sleep(1);
|
||||
}
|
||||
return !executables.Any() ? null : executables;
|
||||
});
|
||||
|
@ -115,7 +114,7 @@ internal static class Resources
|
|||
internal static bool IsCommonIncorrectExecutable(this string rootDirectory, string path)
|
||||
{
|
||||
string subPath = path[rootDirectory.Length..].ToUpperInvariant().BeautifyPath();
|
||||
return subPath.Contains("SETUP") || subPath.Contains("REDIST")
|
||||
return subPath.Contains("SETUP") || subPath.Contains("REDIST") //|| subPath.Contains("SUPPORT")
|
||||
|| subPath.Contains("CRASH") && (subPath.Contains("PAD") || subPath.Contains("REPORT"));
|
||||
}
|
||||
|
||||
|
@ -123,52 +122,55 @@ internal static class Resources
|
|||
{
|
||||
List<string> dllDirectories = new();
|
||||
if (Program.Canceled || !Directory.Exists(gameDirectory)) return null;
|
||||
foreach (string subDirectory in new List<string>(Directory.EnumerateDirectories(gameDirectory, "*", new EnumerationOptions() { RecurseSubdirectories = true })) { gameDirectory })
|
||||
foreach (string directory in Directory.EnumerateDirectories(gameDirectory, "*", new EnumerationOptions() { RecurseSubdirectories = true }).Append(gameDirectory))
|
||||
{
|
||||
if (Program.Canceled) return null;
|
||||
Thread.Sleep(0);
|
||||
if (platform is Platform.Steam or Platform.Paradox)
|
||||
string subDirectory = directory.BeautifyPath();
|
||||
if (!dllDirectories.Contains(subDirectory))
|
||||
{
|
||||
subDirectory.GetSmokeApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string config, out string cache);
|
||||
if (File.Exists(api)
|
||||
|| File.Exists(api_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config)
|
||||
|| File.Exists(cache))
|
||||
dllDirectories.Add(subDirectory.BeautifyPath());
|
||||
}
|
||||
if (platform is Platform.Epic or Platform.Paradox)
|
||||
{
|
||||
subDirectory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||
if (File.Exists(api32)
|
||||
|| File.Exists(api32_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config))
|
||||
dllDirectories.Add(subDirectory.BeautifyPath());
|
||||
}
|
||||
if (platform is Platform.Ubisoft)
|
||||
{
|
||||
subDirectory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||
if (File.Exists(api32)
|
||||
|| File.Exists(api32_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config))
|
||||
dllDirectories.Add(subDirectory.BeautifyPath());
|
||||
subDirectory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config);
|
||||
if (File.Exists(old_api32)
|
||||
|| File.Exists(old_api64)
|
||||
|| File.Exists(api32)
|
||||
|| File.Exists(api32_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config))
|
||||
dllDirectories.Add(subDirectory.BeautifyPath());
|
||||
if (platform is Platform.Steam or Platform.Paradox)
|
||||
{
|
||||
subDirectory.GetSmokeApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string config, out string cache);
|
||||
if (File.Exists(api)
|
||||
|| File.Exists(api_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config)
|
||||
|| File.Exists(cache))
|
||||
dllDirectories.Add(subDirectory);
|
||||
}
|
||||
if (platform is Platform.Epic or Platform.Paradox)
|
||||
{
|
||||
subDirectory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||
if (File.Exists(api32)
|
||||
|| File.Exists(api32_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config))
|
||||
dllDirectories.Add(subDirectory);
|
||||
}
|
||||
if (platform is Platform.Ubisoft)
|
||||
{
|
||||
subDirectory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||
if (File.Exists(api32)
|
||||
|| File.Exists(api32_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config))
|
||||
dllDirectories.Add(subDirectory);
|
||||
subDirectory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config);
|
||||
if (File.Exists(old_api32)
|
||||
|| File.Exists(old_api64)
|
||||
|| File.Exists(api32)
|
||||
|| File.Exists(api32_o)
|
||||
|| File.Exists(api64)
|
||||
|| File.Exists(api64_o)
|
||||
|| File.Exists(config))
|
||||
dllDirectories.Add(subDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
return !dllDirectories.Any() ? null : new List<string>(dllDirectories.Distinct());
|
||||
return !dllDirectories.Any() ? null : dllDirectories;
|
||||
});
|
||||
|
||||
internal static void GetCreamApiComponents(
|
||||
|
|
|
@ -37,7 +37,7 @@ internal static class ScreamAPI
|
|||
if (overrideCatalogItems.Any() || entitlements.Any())
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
File.Create(config).Close();
|
||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||
WriteConfig(writer,
|
||||
|
@ -51,7 +51,7 @@ internal static class ScreamAPI
|
|||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ internal static class ScreamAPI
|
|||
(_, string name, _) = pair.Value;
|
||||
writer.WriteLine($" \"{id}\"{(pair.Equals(lastOverrideCatalogItem) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added override catalog item to ScreamAPI.json with id {id} ({name})", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added override catalog item to ScreamAPI.json with id {id} ({name})", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ]");
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ internal static class ScreamAPI
|
|||
(_, string name, _) = pair.Value;
|
||||
writer.WriteLine($" \"{id}\"{(pair.Equals(lastEntitlement) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added entitlement to ScreamAPI.json with id {id} ({name})", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added entitlement to ScreamAPI.json with id {id} ({name})", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ]");
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ internal static class ScreamAPI
|
|||
{
|
||||
File.Delete(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api32_o, api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Epic Online Services: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Epic Online Services: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
|
@ -125,17 +125,17 @@ internal static class ScreamAPI
|
|||
{
|
||||
File.Delete(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api64_o, api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Epic Online Services: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Epic Online Services: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -146,25 +146,25 @@ internal static class ScreamAPI
|
|||
{
|
||||
File.Move(api32, api32_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Epic Online Services: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Epic Online Services: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
{
|
||||
"ScreamAPI.EOSSDK-Win32-Shipping.dll".Write(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api64, api64_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Epic Online Services: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Epic Online Services: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
"ScreamAPI.EOSSDK-Win64-Shipping.dll".Write(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (generateConfig)
|
||||
CheckConfig(directory, selection, installForm);
|
||||
|
|
|
@ -43,7 +43,7 @@ internal static class SmokeAPI
|
|||
if (overrideDlc.Any() || injectDlc.Any())
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Generating SmokeAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
installForm.UpdateUser("Generating SmokeAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
File.Create(config).Close();
|
||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||
WriteConfig(writer,
|
||||
|
@ -57,7 +57,7 @@ internal static class SmokeAPI
|
|||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ internal static class SmokeAPI
|
|||
(_, string dlcName, _) = pair.Value;
|
||||
writer.WriteLine($" {dlcId}{(pair.Equals(lastOverrideDlc) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added override DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added override DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ],");
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ internal static class SmokeAPI
|
|||
(_, string dlcName, _) = pair.Value;
|
||||
writer.WriteLine($" {dlcId}{(pair.Equals(lastInjectDlc) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added inject DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added inject DLC to SmokeAPI.json with appid {dlcId} ({dlcName})", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ],");
|
||||
}
|
||||
|
@ -114,11 +114,11 @@ internal static class SmokeAPI
|
|||
{
|
||||
File.Delete(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api32_o, api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Steamworks: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Steamworks: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
|
@ -126,23 +126,23 @@ internal static class SmokeAPI
|
|||
{
|
||||
File.Delete(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api64_o, api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Steamworks: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Steamworks: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(cache))
|
||||
{
|
||||
File.Delete(cache);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted cache: {Path.GetFileName(cache)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted cache: {Path.GetFileName(cache)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -153,32 +153,32 @@ internal static class SmokeAPI
|
|||
{
|
||||
File.Delete(oldConfig);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out _);
|
||||
if (File.Exists(api32) && !File.Exists(api32_o))
|
||||
{
|
||||
File.Move(api32, api32_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
{
|
||||
"SmokeAPI.steam_api.dll".Write(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api64, api64_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
"SmokeAPI.steam_api64.dll".Write(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (generateConfig)
|
||||
CheckConfig(directory, selection, installForm);
|
||||
|
|
|
@ -34,7 +34,7 @@ internal static class UplayR1
|
|||
if (blacklistDlc.Any())
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Generating Uplay R1 Unlocker configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
installForm.UpdateUser("Generating Uplay R1 Unlocker configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
File.Create(config).Close();
|
||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||
WriteConfig(writer, new(blacklistDlc.ToDictionary(pair => pair.Key, pair => pair.Value), PlatformIdComparer.String), installForm);
|
||||
|
@ -45,7 +45,7 @@ internal static class UplayR1
|
|||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ internal static class UplayR1
|
|||
(_, string dlcName, _) = pair.Value;
|
||||
writer.WriteLine($" {dlcId}{(pair.Equals(lastBlacklistDlc) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added blacklist DLC to UplayR1Unlocker.jsonc with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added blacklist DLC to UplayR1Unlocker.jsonc with appid {dlcId} ({dlcName})", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ],");
|
||||
}
|
||||
|
@ -83,11 +83,11 @@ internal static class UplayR1
|
|||
{
|
||||
File.Delete(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api32_o, api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
|
@ -95,17 +95,17 @@ internal static class UplayR1
|
|||
{
|
||||
File.Delete(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api64_o, api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -116,25 +116,25 @@ internal static class UplayR1
|
|||
{
|
||||
File.Move(api32, api32_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
{
|
||||
"UplayR1.uplay_r1_loader.dll".Write(api32);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api32)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api64, api64_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
"UplayR1.uplay_r1_loader64.dll".Write(api64);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api64)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (generateConfig)
|
||||
CheckConfig(directory, selection, installForm);
|
||||
|
|
|
@ -36,7 +36,7 @@ internal static class UplayR2
|
|||
if (blacklistDlc.Any())
|
||||
{
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser("Generating Uplay R2 Unlocker configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
|
||||
installForm.UpdateUser("Generating Uplay R2 Unlocker configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||
File.Create(config).Close();
|
||||
StreamWriter writer = new(config, true, Encoding.UTF8);
|
||||
WriteConfig(writer, new(blacklistDlc.ToDictionary(pair => pair.Key, pair => pair.Value), PlatformIdComparer.String), installForm);
|
||||
|
@ -47,7 +47,7 @@ internal static class UplayR2
|
|||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ internal static class UplayR2
|
|||
(_, string dlcName, _) = pair.Value;
|
||||
writer.WriteLine($" {dlcId}{(pair.Equals(lastBlacklistDlc) ? "" : ",")}");
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Added blacklist DLC to UplayR2Unlocker.jsonc with appid {dlcId} ({dlcName})", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Added blacklist DLC to UplayR2Unlocker.jsonc with appid {dlcId} ({dlcName})", LogTextBox.Action, info: false);
|
||||
}
|
||||
writer.WriteLine(" ],");
|
||||
}
|
||||
|
@ -88,11 +88,11 @@ internal static class UplayR2
|
|||
{
|
||||
File.Delete(api);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api32_o, api);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
|
@ -101,17 +101,17 @@ internal static class UplayR2
|
|||
{
|
||||
File.Delete(api);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
File.Move(api64_o, api);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
{
|
||||
File.Delete(config);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -123,26 +123,26 @@ internal static class UplayR2
|
|||
{
|
||||
File.Move(api, api32_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api32_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
{
|
||||
"UplayR2.upc_r2_loader.dll".Write(api);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
api = File.Exists(old_api64) ? old_api64 : api64;
|
||||
if (File.Exists(api) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api, api64_o);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api64_o)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
{
|
||||
"UplayR2.upc_r2_loader64.dll".Write(api);
|
||||
if (installForm is not null)
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", InstallationLog.Action, info: false);
|
||||
installForm.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, info: false);
|
||||
}
|
||||
if (generateConfig)
|
||||
CheckConfig(directory, selection, installForm);
|
||||
|
|
|
@ -10,8 +10,6 @@ using System.Threading.Tasks;
|
|||
|
||||
#if DEBUG
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
#endif
|
||||
|
||||
namespace CreamInstaller.Steam;
|
||||
|
@ -54,11 +52,7 @@ internal static class SteamStore
|
|||
if (!appDetails.success)
|
||||
{
|
||||
#if DEBUG
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Query unsuccessful for appid: " + appId + $"\nisDlc: {isDlc}\ndata is null: {data is null}\n\n" + app.Value.ToString());
|
||||
});
|
||||
DebugForm.Current.Log($"Query unsuccessful for appid {appId}{(isDlc ? " (DLC)" : "")}: {app.Value.ToString(Formatting.None)}", LogTextBox.Warning);
|
||||
#endif
|
||||
if (data is null)
|
||||
return null;
|
||||
|
@ -73,11 +67,7 @@ internal static class SteamStore
|
|||
#if DEBUG
|
||||
(Exception e)
|
||||
{
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Unsuccessful serialization of query for appid " + appId + ":\n\n" + e.ToString());
|
||||
});
|
||||
DebugForm.Current.Log($"Unsuccessful serialization of query for appid {appId}{(isDlc ? " (DLC)" : "")}: {e.GetType()} ({e.Message})");
|
||||
}
|
||||
#else
|
||||
{ }
|
||||
|
@ -85,36 +75,18 @@ internal static class SteamStore
|
|||
return data;
|
||||
}
|
||||
#if DEBUG
|
||||
else
|
||||
{
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Response data null for appid: " + appId + "\n\n" + app.Value.ToString());
|
||||
});
|
||||
}
|
||||
else DebugForm.Current.Log($"Response data null for appid {appId}{(isDlc ? " (DLC)" : "")}: {app.Value.ToString(Formatting.None)}");
|
||||
#endif
|
||||
}
|
||||
#if DEBUG
|
||||
else
|
||||
{
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Response details null for appid: " + appId + "\n\n" + app.Value.ToString());
|
||||
});
|
||||
}
|
||||
else DebugForm.Current.Log($"Response details null for appid {appId}{(isDlc ? " (DLC)" : "")}: {app.Value.ToString(Formatting.None)}");
|
||||
#endif
|
||||
}
|
||||
catch
|
||||
#if DEBUG
|
||||
(Exception e)
|
||||
{
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Unsuccessful deserialization of query for appid " + appId + ":\n\n" + e.ToString());
|
||||
});
|
||||
DebugForm.Current.Log($"Unsuccessful deserialization of query for appid {appId}{(isDlc ? " (DLC)" : "")}: {e.GetType()} ({e.Message})");
|
||||
}
|
||||
#else
|
||||
{ }
|
||||
|
@ -122,25 +94,11 @@ internal static class SteamStore
|
|||
}
|
||||
}
|
||||
#if DEBUG
|
||||
else
|
||||
{
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Response deserialization null for appid: " + appId);
|
||||
});
|
||||
}
|
||||
else DebugForm.Current.Log("Response deserialization null for appid " + appId);
|
||||
#endif
|
||||
}
|
||||
#if DEBUG
|
||||
else
|
||||
{
|
||||
Form.ActiveForm.Invoke(() =>
|
||||
{
|
||||
using DialogForm dialogForm = new(Form.ActiveForm);
|
||||
dialogForm.Show(SystemIcons.Error, "Response null for appid: " + appId);
|
||||
});
|
||||
}
|
||||
else DebugForm.Current.Log("Response null for appid " + appId, LogTextBox.Warning);
|
||||
#endif
|
||||
}
|
||||
if (cachedExists)
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Windows.Forms;
|
|||
|
||||
namespace CreamInstaller.Utility;
|
||||
|
||||
internal static class InstallationLog
|
||||
internal static class LogTextBox
|
||||
{
|
||||
internal static readonly Color Background = Color.DarkSlateGray;
|
||||
internal static readonly Color Operation = Color.LightGray;
|
||||
|
@ -13,12 +13,15 @@ internal static class InstallationLog
|
|||
internal static readonly Color Warning = Color.Yellow;
|
||||
internal static readonly Color Error = Color.DarkOrange;
|
||||
|
||||
internal static void AppendText(this RichTextBox logTextBox, string text, Color color)
|
||||
internal static void AppendText(this RichTextBox textBox, string text, Color color, bool scroll = false)
|
||||
{
|
||||
logTextBox.SelectionStart = logTextBox.TextLength;
|
||||
logTextBox.SelectionLength = 0;
|
||||
logTextBox.SelectionColor = color;
|
||||
logTextBox.AppendText(text);
|
||||
logTextBox.SelectionColor = logTextBox.ForeColor;
|
||||
textBox.SelectionStart = textBox.TextLength;
|
||||
textBox.SelectionLength = 0;
|
||||
textBox.SelectionColor = color;
|
||||
if (scroll) textBox.ScrollToCaret();
|
||||
textBox.AppendText(text);
|
||||
if (scroll) textBox.ScrollToCaret();
|
||||
textBox.SelectionColor = textBox.ForeColor;
|
||||
textBox.Invalidate();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue