more refactoring & optimization
This commit is contained in:
parent
d67b29d48b
commit
a9a701a988
18 changed files with 140 additions and 133 deletions
|
@ -30,15 +30,14 @@ internal class CustomForm : Form
|
|||
|
||||
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;
|
||||
TopLevel = true;
|
||||
}
|
||||
if (owner is not Form form)
|
||||
return;
|
||||
Owner = form;
|
||||
InheritLocation(form);
|
||||
SizeChanged += (_, _) => InheritLocation(form);
|
||||
form.Activated += OnActivation;
|
||||
FormClosing += (_, _) => form.Activated -= OnActivation;
|
||||
TopLevel = true;
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams // Double buffering for all controls
|
||||
|
@ -51,7 +50,7 @@ internal class CustomForm : Form
|
|||
}
|
||||
}
|
||||
|
||||
internal void OnHelpButtonClicked(object sender, EventArgs args)
|
||||
private void OnHelpButtonClicked(object sender, EventArgs args)
|
||||
{
|
||||
using DialogForm helpDialog = new(this);
|
||||
helpDialog.HelpButton = false;
|
||||
|
@ -85,11 +84,11 @@ internal class CustomForm : Form
|
|||
+ $"The program source and other information can be found on [GitHub]({repository}).");
|
||||
}
|
||||
|
||||
internal void OnActivation(object sender, EventArgs args) => Activate();
|
||||
private void OnActivation(object sender, EventArgs args) => Activate();
|
||||
|
||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
internal static extern void SetWindowPos(nint hWnd, nint hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
|
||||
private static extern void SetWindowPos(nint hWnd, nint hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
|
||||
|
||||
internal void BringToFrontWithoutActivation()
|
||||
{
|
||||
|
|
|
@ -206,7 +206,7 @@ internal sealed class CustomTreeView : TreeView
|
|||
foreach (string proxy in proxies)
|
||||
{
|
||||
bool canUse = true;
|
||||
foreach ((string directory, BinaryType binaryType) in pair.Key.ExecutableDirectories)
|
||||
foreach ((string directory, BinaryType _) in pair.Key.ExecutableDirectories)
|
||||
{
|
||||
string path = directory + @"\" + proxy + ".dll";
|
||||
if (!File.Exists(path) || path.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||
|
@ -215,7 +215,7 @@ internal sealed class CustomTreeView : TreeView
|
|||
break;
|
||||
}
|
||||
if (canUse)
|
||||
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (s, e) =>
|
||||
_ = comboBoxDropDown.Items.Add(new ToolStripButton(proxy + ".dll", null, (_, _) =>
|
||||
{
|
||||
pair.Key.KoaloaderProxy = proxy == ProgramSelection.DefaultKoaloaderProxy ? null : proxy;
|
||||
selectForm.OnKoaloaderChanged();
|
||||
|
|
|
@ -39,9 +39,9 @@ internal sealed class StringComparer : IComparer<string>
|
|||
internal sealed class NodeComparer : IComparer<TreeNode>
|
||||
{
|
||||
public int Compare(TreeNode a, TreeNode b)
|
||||
=> a.Tag is not Platform A
|
||||
=> a?.Tag is not Platform A
|
||||
? 1
|
||||
: b.Tag is not Platform B
|
||||
: b?.Tag is not Platform B
|
||||
? -1
|
||||
: A > B
|
||||
? 1
|
||||
|
@ -57,7 +57,7 @@ internal sealed class NodeNameComparer : IComparer
|
|||
? 1
|
||||
: b is not TreeNode B
|
||||
? -1
|
||||
: PlatformIdComparer.Node.Compare(A, B) is int c && c != 0
|
||||
: PlatformIdComparer.Node.Compare(A, B) is var c && c != 0
|
||||
? c
|
||||
: PlatformIdComparer.String.Compare(A.Name, B.Name);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ internal sealed class NodeTextComparer : IComparer
|
|||
? 1
|
||||
: b is not TreeNode B
|
||||
? -1
|
||||
: PlatformIdComparer.Node.Compare(A, B) is int c && c != 0
|
||||
: PlatformIdComparer.Node.Compare(A, B) is var c && c != 0
|
||||
? c
|
||||
: PlatformIdComparer.String.Compare(A.Text, B.Text);
|
||||
}
|
|
@ -56,7 +56,11 @@ internal sealed partial class DialogForm : CustomForm
|
|||
return ShowDialog();
|
||||
foreach (LinkLabel.Link link in links)
|
||||
_ = descriptionLabel.Links.Add(link);
|
||||
descriptionLabel.LinkClicked += (s, e) => Process.Start(new ProcessStartInfo((string)e.Link.LinkData) { UseShellExecute = true });
|
||||
descriptionLabel.LinkClicked += (_, e) =>
|
||||
{
|
||||
if (e.Link != null)
|
||||
Process.Start(new ProcessStartInfo((string)e.Link.LinkData) { UseShellExecute = true });
|
||||
};
|
||||
return ShowDialog();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ internal sealed partial class InstallForm : CustomForm
|
|||
+ $" with root directory \"{selection.RootDirectory}\" . . . ", LogTextBox.Operation);
|
||||
IEnumerable<string> invalidDirectories = (await selection.RootDirectory.GetExecutables())
|
||||
?.Where(d => selection.ExecutableDirectories.All(s => s.directory != Path.GetDirectoryName(d.path)))
|
||||
?.Select(d => Path.GetDirectoryName(d.path));
|
||||
.Select(d => Path.GetDirectoryName(d.path));
|
||||
if (selection.ExecutableDirectories.All(s => s.directory != selection.RootDirectory))
|
||||
invalidDirectories = invalidDirectories?.Append(selection.RootDirectory);
|
||||
invalidDirectories = invalidDirectories?.Distinct();
|
||||
|
@ -91,7 +91,7 @@ internal sealed partial class InstallForm : CustomForm
|
|||
Thread.Sleep(1);
|
||||
}
|
||||
if (uninstalling || !selection.Koaloader)
|
||||
foreach ((string directory, BinaryType binaryType) in selection.ExecutableDirectories)
|
||||
foreach ((string directory, BinaryType _) in selection.ExecutableDirectories)
|
||||
{
|
||||
if (Program.Canceled)
|
||||
throw new CustomMessageException("The operation was canceled.");
|
||||
|
|
|
@ -42,7 +42,7 @@ internal sealed partial class MainForm : CustomForm
|
|||
SelectForm form = new();
|
||||
#pragma warning restore CA2000 // Dispose objects before losing scope
|
||||
form.InheritLocation(this);
|
||||
form.FormClosing += (s, e) => Close();
|
||||
form.FormClosing += (_, _) => Close();
|
||||
form.Show();
|
||||
Hide();
|
||||
#if DEBUG
|
||||
|
@ -89,7 +89,10 @@ internal sealed partial class MainForm : CustomForm
|
|||
DebugForm.Current.Log($"Exception while checking for updates: {e.GetType()} ({e.Message})", LogTextBox.Warning);
|
||||
}
|
||||
#else
|
||||
catch { }
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#endif
|
||||
finally
|
||||
{
|
||||
|
@ -182,7 +185,7 @@ internal sealed partial class MainForm : CustomForm
|
|||
changelogTreeView.Location = progressBar.Location with { Y = progressBar.Location.Y + progressBar.Size.Height + 6 };
|
||||
Refresh();
|
||||
Progress<double> progress = new();
|
||||
progress.ProgressChanged += delegate(object sender, double _progress)
|
||||
progress.ProgressChanged += delegate(object _, double _progress)
|
||||
{
|
||||
progressLabel.Text = $"Updating . . . {(int)_progress}%";
|
||||
progressBar.Value = (int)_progress;
|
||||
|
@ -200,7 +203,10 @@ internal sealed partial class MainForm : CustomForm
|
|||
DebugForm.Current.Log($"Exception while preparing update: {ex.GetType()} ({ex.Message})", LogTextBox.Warning);
|
||||
}
|
||||
#else
|
||||
catch { }
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
#endif
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -223,10 +223,10 @@ internal sealed partial class SelectForm : CustomForm
|
|||
VProperty dlcAppInfo = await SteamCMD.GetAppInfo(dlcAppId);
|
||||
if (dlcAppInfo is not null)
|
||||
{
|
||||
dlcName = dlcAppInfo.Value?.GetChild("common")?.GetChild("name")?.ToString();
|
||||
string dlcIconStaticId = dlcAppInfo.Value?.GetChild("common")?.GetChild("icon")?.ToString();
|
||||
dlcIconStaticId ??= dlcAppInfo.Value?.GetChild("common")?.GetChild("logo_small")?.ToString();
|
||||
dlcIconStaticId ??= dlcAppInfo.Value?.GetChild("common")?.GetChild("logo")?.ToString();
|
||||
dlcName = dlcAppInfo.Value.GetChild("common")?.GetChild("name")?.ToString();
|
||||
string dlcIconStaticId = dlcAppInfo.Value.GetChild("common")?.GetChild("icon")?.ToString();
|
||||
dlcIconStaticId ??= dlcAppInfo.Value.GetChild("common")?.GetChild("logo_small")?.ToString();
|
||||
dlcIconStaticId ??= dlcAppInfo.Value.GetChild("common")?.GetChild("logo")?.ToString();
|
||||
if (dlcIconStaticId is not null)
|
||||
dlcIcon = IconGrabber.SteamAppImagesPath + @$"\{dlcAppId}\{dlcIconStaticId}.jpg";
|
||||
}
|
||||
|
@ -265,10 +265,10 @@ internal sealed partial class SelectForm : CustomForm
|
|||
selection.DllDirectories = dllDirectories;
|
||||
selection.Platform = Platform.Steam;
|
||||
selection.ProductUrl = "https://store.steampowered.com/app/" + appId;
|
||||
selection.IconUrl = IconGrabber.SteamAppImagesPath + @$"\{appId}\{appInfo?.Value?.GetChild("common")?.GetChild("icon")}.jpg";
|
||||
selection.IconUrl = IconGrabber.SteamAppImagesPath + @$"\{appId}\{appInfo?.Value.GetChild("common")?.GetChild("icon")}.jpg";
|
||||
selection.SubIconUrl = appData?.header_image ?? IconGrabber.SteamAppImagesPath
|
||||
+ @$"\{appId}\{appInfo?.Value?.GetChild("common")?.GetChild("clienticon")}.ico";
|
||||
selection.Publisher = appData?.publishers[0] ?? appInfo?.Value?.GetChild("extended")?.GetChild("publisher")?.ToString();
|
||||
+ @$"\{appId}\{appInfo?.Value.GetChild("common")?.GetChild("clienticon")}.ico";
|
||||
selection.Publisher = appData?.publishers[0] ?? appInfo?.Value.GetChild("extended")?.GetChild("publisher")?.ToString();
|
||||
selection.WebsiteUrl = appData?.website;
|
||||
if (Program.Canceled)
|
||||
return;
|
||||
|
@ -412,8 +412,6 @@ internal sealed partial class SelectForm : CustomForm
|
|||
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;
|
||||
string dlcId = pair.Key;
|
||||
(DlcType type, string name, string icon) dlcApp = (DlcType.EpicEntitlement, pair.Value.name, pair.Value.icon);
|
||||
selection.AllDlc[dlcId] = dlcApp;
|
||||
|
@ -526,7 +524,7 @@ internal sealed partial class SelectForm : CustomForm
|
|||
gameChoices.Add((Platform.Paradox, "PL", "Paradox Launcher",
|
||||
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Paradox && p.id == "PL")));
|
||||
if (Directory.Exists(SteamLibrary.InstallPath))
|
||||
foreach ((string appId, string name, string branch, int buildId, string gameDirectory) in (await SteamLibrary.GetGames()).Where(g
|
||||
foreach ((string appId, string name, string _, int _, string _) in (await SteamLibrary.GetGames()).Where(g
|
||||
=> !Program.IsGameBlocked(g.name, g.gameDirectory)))
|
||||
gameChoices.Add((Platform.Steam, appId, name,
|
||||
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Steam && p.id == appId)));
|
||||
|
@ -534,8 +532,7 @@ internal sealed partial class SelectForm : CustomForm
|
|||
foreach (Manifest manifest in (await EpicLibrary.GetGames()).Where(m => !Program.IsGameBlocked(m.DisplayName, m.InstallLocation)))
|
||||
gameChoices.Add((Platform.Epic, manifest.CatalogNamespace, manifest.DisplayName,
|
||||
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Epic && p.id == manifest.CatalogNamespace)));
|
||||
foreach ((string gameId, string name, string gameDirectory) in (await UbisoftLibrary.GetGames()).Where(g
|
||||
=> !Program.IsGameBlocked(g.name, g.gameDirectory)))
|
||||
foreach ((string gameId, string name, string _) in (await UbisoftLibrary.GetGames()).Where(g => !Program.IsGameBlocked(g.name, g.gameDirectory)))
|
||||
gameChoices.Add((Platform.Ubisoft, gameId, name,
|
||||
programsToScan is not null && programsToScan.Any(p => p.platform is Platform.Ubisoft && p.id == gameId)));
|
||||
if (gameChoices.Any())
|
||||
|
@ -562,7 +559,7 @@ internal sealed partial class SelectForm : CustomForm
|
|||
int curProgress = 0;
|
||||
Progress<int> progress = new();
|
||||
IProgress<int> iProgress = progress;
|
||||
progress.ProgressChanged += (sender, _progress) =>
|
||||
progress.ProgressChanged += (_, _progress) =>
|
||||
{
|
||||
if (Program.Canceled)
|
||||
return;
|
||||
|
@ -761,16 +758,16 @@ internal sealed partial class SelectForm : CustomForm
|
|||
: selection.Platform is Platform.Epic
|
||||
? "Epic GraphQL "
|
||||
: "";
|
||||
queries.Add(new($"Open {platformString}Query", "Notepad", (sender, e) => Diagnostics.OpenFileInNotepad(appInfoJSON)));
|
||||
queries.Add(new($"Open {platformString}Query", "Notepad", (_, _) => Diagnostics.OpenFileInNotepad(appInfoJSON)));
|
||||
}
|
||||
if (File.Exists(appInfoVDF))
|
||||
queries.Add(new("Open SteamCMD Query", "Notepad", (sender, e) => Diagnostics.OpenFileInNotepad(appInfoVDF)));
|
||||
queries.Add(new("Open SteamCMD Query", "Notepad", (_, _) => Diagnostics.OpenFileInNotepad(appInfoVDF)));
|
||||
if (queries.Any())
|
||||
{
|
||||
items.Add(new ToolStripSeparator());
|
||||
foreach (ContextMenuItem query in queries)
|
||||
items.Add(query);
|
||||
items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt", (sender, e) =>
|
||||
items.Add(new ContextMenuItem("Refresh Queries", "Command Prompt", (_, _) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -810,11 +807,11 @@ internal sealed partial class SelectForm : CustomForm
|
|||
}
|
||||
items.Add(new ToolStripSeparator());
|
||||
items.Add(new ContextMenuItem("Open Root Directory", "File Explorer",
|
||||
(sender, e) => Diagnostics.OpenDirectoryInFileExplorer(selection.RootDirectory)));
|
||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(selection.RootDirectory)));
|
||||
int executables = 0;
|
||||
foreach ((string directory, BinaryType binaryType) in selection.ExecutableDirectories.ToList())
|
||||
items.Add(new ContextMenuItem($"Open Executable Directory #{++executables} ({(binaryType == BinaryType.BIT32 ? "32" : "64")}-bit)",
|
||||
"File Explorer", (sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
"File Explorer", (_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
List<string> directories = selection.DllDirectories.ToList();
|
||||
int steam = 0, epic = 0, r1 = 0, r2 = 0;
|
||||
if (selection.Platform is Platform.Steam or Platform.Paradox)
|
||||
|
@ -825,7 +822,7 @@ internal sealed partial class SelectForm : CustomForm
|
|||
if (File.Exists(api32) || File.Exists(api32_o) || File.Exists(api64) || File.Exists(api64_o) || File.Exists(old_config)
|
||||
|| File.Exists(config) || File.Exists(cache))
|
||||
items.Add(new ContextMenuItem($"Open Steamworks Directory #{++steam}", "File Explorer",
|
||||
(sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
}
|
||||
if (selection.Platform is Platform.Epic or Platform.Paradox)
|
||||
foreach (string directory in directories)
|
||||
|
@ -833,7 +830,7 @@ internal sealed partial class SelectForm : CustomForm
|
|||
directory.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))
|
||||
items.Add(new ContextMenuItem($"Open EOS Directory #{++epic}", "File Explorer",
|
||||
(sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
}
|
||||
if (selection.Platform is Platform.Ubisoft)
|
||||
foreach (string directory in directories)
|
||||
|
@ -841,12 +838,12 @@ internal sealed partial class SelectForm : CustomForm
|
|||
directory.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))
|
||||
items.Add(new ContextMenuItem($"Open Uplay R1 Directory #{++r1}", "File Explorer",
|
||||
(sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
directory.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))
|
||||
items.Add(new ContextMenuItem($"Open Uplay R2 Directory #{++r2}", "File Explorer",
|
||||
(sender, e) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||
}
|
||||
}
|
||||
if (id != "PL")
|
||||
|
@ -854,36 +851,35 @@ internal sealed partial class SelectForm : CustomForm
|
|||
if (selection?.Platform is Platform.Steam || dlcParentSelection?.Platform is Platform.Steam)
|
||||
{
|
||||
items.Add(new ToolStripSeparator());
|
||||
items.Add(new ContextMenuItem("Open SteamDB", "SteamDB",
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser("https://steamdb.info/app/" + id)));
|
||||
items.Add(new ContextMenuItem("Open SteamDB", "SteamDB", (_, _) => Diagnostics.OpenUrlInInternetBrowser("https://steamdb.info/app/" + id)));
|
||||
}
|
||||
if (selection is not null)
|
||||
switch (selection.Platform)
|
||||
{
|
||||
case Platform.Steam:
|
||||
items.Add(new ContextMenuItem("Open Steam Store", "Steam Store",
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser(selection.ProductUrl)));
|
||||
(_, _) => Diagnostics.OpenUrlInInternetBrowser(selection.ProductUrl)));
|
||||
items.Add(new ContextMenuItem("Open Steam Community", ("Sub_" + id, selection.SubIconUrl), "Steam Community",
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser("https://steamcommunity.com/app/" + id)));
|
||||
(_, _) => Diagnostics.OpenUrlInInternetBrowser("https://steamcommunity.com/app/" + id)));
|
||||
break;
|
||||
case Platform.Epic:
|
||||
items.Add(new ToolStripSeparator());
|
||||
items.Add(new ContextMenuItem("Open ScreamDB", "ScreamDB",
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser("https://scream-db.web.app/offers/" + id)));
|
||||
(_, _) => Diagnostics.OpenUrlInInternetBrowser("https://scream-db.web.app/offers/" + id)));
|
||||
items.Add(new ContextMenuItem("Open Epic Games Store", "Epic Games",
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser(selection.ProductUrl)));
|
||||
(_, _) => Diagnostics.OpenUrlInInternetBrowser(selection.ProductUrl)));
|
||||
break;
|
||||
case Platform.Ubisoft:
|
||||
items.Add(new ToolStripSeparator());
|
||||
items.Add(new ContextMenuItem("Open Ubisoft Store", "Ubisoft Store",
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser("https://store.ubi.com/us/"
|
||||
+ selection.Name.Replace(" ", "-").ToLowerInvariant())));
|
||||
(_, _) => Diagnostics.OpenUrlInInternetBrowser(
|
||||
"https://store.ubi.com/us/" + selection.Name.Replace(" ", "-").ToLowerInvariant())));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (selection?.WebsiteUrl != null)
|
||||
items.Add(new ContextMenuItem("Open Official Website", ("Web_" + id, IconGrabber.GetDomainFaviconUrl(selection.WebsiteUrl)),
|
||||
(sender, e) => Diagnostics.OpenUrlInInternetBrowser(selection.WebsiteUrl)));
|
||||
(_, _) => Diagnostics.OpenUrlInInternetBrowser(selection.WebsiteUrl)));
|
||||
contextMenuStrip.Show(selectionTreeView, location);
|
||||
contextMenuStrip.Refresh();
|
||||
ContextMenuStrip.Tag = null;
|
||||
|
@ -917,7 +913,7 @@ internal sealed partial class SelectForm : CustomForm
|
|||
Hide();
|
||||
InstallForm form = new(uninstall);
|
||||
form.InheritLocation(this);
|
||||
form.FormClosing += (s, e) =>
|
||||
form.FormClosing += (_, _) =>
|
||||
{
|
||||
if (form.Reselecting)
|
||||
{
|
||||
|
|
|
@ -100,8 +100,7 @@ internal static class ParadoxLauncher
|
|||
{
|
||||
bool koaloaderInstalled = Koaloader.AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
||||
.Any(pair => File.Exists(pair.path) && 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 _);
|
||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string _, out string config, out _);
|
||||
smokeInstalled = smokeInstalled || File.Exists(api32_o) || File.Exists(api64_o)
|
||||
|| (File.Exists(config) || File.Exists(config)) && !koaloaderInstalled
|
||||
|| File.Exists(api32) && api32.IsResourceFile(ResourceIdentifier.Steamworks32)
|
||||
|
|
|
@ -141,7 +141,7 @@ internal static class SteamCMD
|
|||
progress.Report(-1660); // install
|
||||
int cur = 0;
|
||||
progress.Report(cur);
|
||||
watcher.Changed += (sender, e) => progress.Report(++cur);
|
||||
watcher.Changed += (_, _) => progress.Report(++cur);
|
||||
_ = await Run(null);
|
||||
watcher.Dispose();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ internal static class SteamLibrary
|
|||
return games;
|
||||
});
|
||||
|
||||
internal static async Task<List<(string appId, string name, string branch, int buildId, string gameDirectory)>>
|
||||
private static async Task<List<(string appId, string name, string branch, int buildId, string gameDirectory)>>
|
||||
GetGamesFromLibraryDirectory(string libraryDirectory)
|
||||
=> await Task.Run(() =>
|
||||
{
|
||||
|
@ -55,58 +55,55 @@ internal static class SteamLibrary
|
|||
{
|
||||
if (Program.Canceled)
|
||||
return games;
|
||||
if (ValveDataFile.TryDeserialize(File.ReadAllText(file, Encoding.UTF8), out VProperty result))
|
||||
{
|
||||
string appId = result.Value.GetChild("appid")?.ToString();
|
||||
string installdir = result.Value.GetChild("installdir")?.ToString();
|
||||
string name = result.Value.GetChild("name")?.ToString();
|
||||
string buildId = result.Value.GetChild("buildid")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(installdir) || string.IsNullOrWhiteSpace(name)
|
||||
|| string.IsNullOrWhiteSpace(buildId))
|
||||
continue;
|
||||
string gameDirectory = (libraryDirectory + @"\common\" + installdir).BeautifyPath();
|
||||
if (games.Any(g => g.appId == appId && g.gameDirectory == gameDirectory))
|
||||
continue;
|
||||
if (!int.TryParse(appId, out int appIdInt))
|
||||
continue;
|
||||
if (!int.TryParse(buildId, out int buildIdInt))
|
||||
continue;
|
||||
string branch = result.Value.GetChild("UserConfig")?.GetChild("betakey")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(branch))
|
||||
branch = "public";
|
||||
games.Add((appId, name, branch, buildIdInt, gameDirectory));
|
||||
}
|
||||
if (!ValveDataFile.TryDeserialize(File.ReadAllText(file, Encoding.UTF8), out VProperty result))
|
||||
continue;
|
||||
string appId = result.Value.GetChild("appid")?.ToString();
|
||||
string installdir = result.Value.GetChild("installdir")?.ToString();
|
||||
string name = result.Value.GetChild("name")?.ToString();
|
||||
string buildId = result.Value.GetChild("buildid")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(appId) || string.IsNullOrWhiteSpace(installdir) || string.IsNullOrWhiteSpace(name)
|
||||
|| string.IsNullOrWhiteSpace(buildId))
|
||||
continue;
|
||||
string gameDirectory = (libraryDirectory + @"\common\" + installdir).BeautifyPath();
|
||||
if (games.Any(g => g.appId == appId && g.gameDirectory == gameDirectory))
|
||||
continue;
|
||||
if (!int.TryParse(appId, out int _))
|
||||
continue;
|
||||
if (!int.TryParse(buildId, out int buildIdInt))
|
||||
continue;
|
||||
string branch = result.Value.GetChild("UserConfig")?.GetChild("betakey")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(branch))
|
||||
branch = "public";
|
||||
games.Add((appId, name, branch, buildIdInt, gameDirectory));
|
||||
}
|
||||
return games;
|
||||
});
|
||||
|
||||
internal static async Task<List<string>> GetLibraryDirectories()
|
||||
private static async Task<List<string>> GetLibraryDirectories()
|
||||
=> await Task.Run(() =>
|
||||
{
|
||||
List<string> gameDirectories = new();
|
||||
if (Program.Canceled)
|
||||
return gameDirectories;
|
||||
string steamInstallPath = InstallPath;
|
||||
if (steamInstallPath != null && Directory.Exists(steamInstallPath))
|
||||
if (steamInstallPath == null || !Directory.Exists(steamInstallPath))
|
||||
return gameDirectories;
|
||||
string libraryFolder = steamInstallPath + @"\steamapps";
|
||||
if (!Directory.Exists(libraryFolder))
|
||||
return gameDirectories;
|
||||
gameDirectories.Add(libraryFolder);
|
||||
string libraryFolders = libraryFolder + @"\libraryfolders.vdf";
|
||||
if (!File.Exists(libraryFolders) || !ValveDataFile.TryDeserialize(File.ReadAllText(libraryFolders, Encoding.UTF8), out VProperty result))
|
||||
return gameDirectories;
|
||||
foreach (VToken vToken in result.Value.Where(p => p is VProperty property && int.TryParse(property.Key, out int _)))
|
||||
{
|
||||
string libraryFolder = steamInstallPath + @"\steamapps";
|
||||
if (Directory.Exists(libraryFolder))
|
||||
{
|
||||
gameDirectories.Add(libraryFolder);
|
||||
string libraryFolders = libraryFolder + @"\libraryfolders.vdf";
|
||||
if (File.Exists(libraryFolders) && ValveDataFile.TryDeserialize(File.ReadAllText(libraryFolders, Encoding.UTF8), out VProperty result))
|
||||
#pragma warning disable IDE0220 // Add explicit cast
|
||||
foreach (VProperty property in result.Value.Where(p => p is VProperty && int.TryParse((p as VProperty).Key, out int _)))
|
||||
{
|
||||
string path = property.Value.GetChild("path")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
continue;
|
||||
path += @"\steamapps";
|
||||
if (Directory.Exists(path) && !gameDirectories.Contains(path))
|
||||
gameDirectories.Add(path);
|
||||
}
|
||||
#pragma warning restore IDE0220 // Add explicit cast
|
||||
}
|
||||
VProperty property = (VProperty)vToken;
|
||||
string path = property.Value.GetChild("path")?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
continue;
|
||||
path += @"\steamapps";
|
||||
if (Directory.Exists(path) && !gameDirectories.Contains(path))
|
||||
gameDirectories.Add(path);
|
||||
}
|
||||
return gameDirectories;
|
||||
});
|
||||
|
|
|
@ -3,12 +3,12 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using CreamInstaller.Forms;
|
||||
using CreamInstaller.Utility;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
#if DEBUG
|
||||
using System;
|
||||
using CreamInstaller.Forms;
|
||||
#endif
|
||||
|
||||
namespace CreamInstaller.Platforms.Steam;
|
||||
|
|
|
@ -79,9 +79,9 @@ internal static class Program
|
|||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.ApplicationExit += OnApplicationExit;
|
||||
Application.ThreadException += (s, e) => e.Exception?.HandleFatalException();
|
||||
Application.ThreadException += (_, e) => e.Exception.HandleFatalException();
|
||||
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
|
||||
AppDomain.CurrentDomain.UnhandledException += (s, e) => (e.ExceptionObject as Exception)?.HandleFatalException();
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) => (e.ExceptionObject as Exception)?.HandleFatalException();
|
||||
retry:
|
||||
try
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ internal static class Koaloader
|
|||
binaryType = bitness switch { "32" => BinaryType.BIT32, "64" => BinaryType.BIT64, _ => BinaryType.Unknown };
|
||||
}
|
||||
|
||||
private static void CheckConfig(string directory, ProgramSelection selection, InstallForm installForm = null)
|
||||
private static void CheckConfig(string directory, InstallForm installForm = null)
|
||||
{
|
||||
directory.GetKoaloaderComponents(out _, out string old_config, out string config);
|
||||
if (File.Exists(old_config))
|
||||
|
@ -345,6 +345,6 @@ internal static class Koaloader
|
|||
}
|
||||
}
|
||||
if (generateConfig)
|
||||
CheckConfig(directory, selection, installForm);
|
||||
CheckConfig(directory, installForm);
|
||||
});
|
||||
}
|
|
@ -432,7 +432,7 @@ internal static class Resources
|
|||
{
|
||||
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)
|
||||
|
|
|
@ -26,12 +26,14 @@ internal static class ScreamAPI
|
|||
directory.GetScreamApiComponents(out _, out _, out _, out _, out string config);
|
||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> overrideCatalogItems
|
||||
= selection.AllDlc.Where(pair => pair.Value.type is DlcType.EpicCatalogItem).Except(selection.SelectedDlc);
|
||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
foreach ((string _, string _, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
overrideCatalogItems = overrideCatalogItems.Except(extraDlc);
|
||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> entitlements
|
||||
= selection.SelectedDlc.Where(pair => pair.Value.type == DlcType.EpicEntitlement);
|
||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> _dlc) in selection.ExtraSelectedDlc)
|
||||
foreach ((string _, string _, SortedList<string, (DlcType type, string name, string icon)> _dlc) in selection.ExtraSelectedDlc)
|
||||
entitlements = entitlements.Concat(_dlc.Where(pair => pair.Value.type == DlcType.EpicEntitlement));
|
||||
overrideCatalogItems = overrideCatalogItems.ToList();
|
||||
entitlements = entitlements.ToList();
|
||||
if (overrideCatalogItems.Any() || entitlements.Any())
|
||||
{
|
||||
/*if (installForm is not null)
|
||||
|
@ -109,7 +111,7 @@ internal static class ScreamAPI
|
|||
File.Delete(api32);
|
||||
installForm?.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api32_o, api32);
|
||||
File.Move(api32_o, api32!);
|
||||
installForm?.UpdateUser($"Restored EOS: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
@ -119,7 +121,7 @@ internal static class ScreamAPI
|
|||
File.Delete(api64);
|
||||
installForm?.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api64_o, api64);
|
||||
File.Move(api64_o, api64!);
|
||||
installForm?.UpdateUser($"Restored EOS: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
|
@ -132,10 +134,10 @@ internal static class ScreamAPI
|
|||
internal static async Task Install(string directory, ProgramSelection selection, InstallForm installForm = null, bool generateConfig = true)
|
||||
=> await Task.Run(() =>
|
||||
{
|
||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string _);
|
||||
if (File.Exists(api32) && !File.Exists(api32_o))
|
||||
{
|
||||
File.Move(api32, api32_o);
|
||||
File.Move(api32, api32_o!);
|
||||
installForm?.UpdateUser($"Renamed EOS: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
|
@ -145,7 +147,7 @@ internal static class ScreamAPI
|
|||
}
|
||||
if (File.Exists(api64) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api64, api64_o);
|
||||
File.Move(api64, api64_o!);
|
||||
installForm?.UpdateUser($"Renamed EOS: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
|
|
@ -27,17 +27,19 @@ internal static class SmokeAPI
|
|||
{
|
||||
directory.GetSmokeApiComponents(out _, out _, out _, out _, out string old_config, out _, out _);
|
||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> overrideDlc = selection.AllDlc.Except(selection.SelectedDlc);
|
||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
foreach ((string _, string _, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
overrideDlc = overrideDlc.Except(extraDlc);
|
||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> injectDlc
|
||||
= new List<KeyValuePair<string, (DlcType type, string name, string icon)>>();
|
||||
if (selection.AllDlc.Count > 64 || selection.ExtraDlc.Any(e => e.dlc.Count > 64))
|
||||
{
|
||||
injectDlc = injectDlc.Concat(selection.SelectedDlc.Where(pair => pair.Value.type is DlcType.SteamHidden));
|
||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
foreach ((string id, string _, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
if (selection.ExtraDlc.Single(e => e.id == id).dlc.Count > 64)
|
||||
injectDlc = injectDlc.Concat(extraDlc.Where(pair => pair.Value.type is DlcType.SteamHidden));
|
||||
}
|
||||
overrideDlc = overrideDlc.ToList();
|
||||
injectDlc = injectDlc.ToList();
|
||||
if (overrideDlc.Any() || injectDlc.Any())
|
||||
{
|
||||
/*if (installForm is not null)
|
||||
|
@ -117,7 +119,7 @@ internal static class SmokeAPI
|
|||
File.Delete(api32);
|
||||
installForm?.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api32_o, api32);
|
||||
File.Move(api32_o, api32!);
|
||||
installForm?.UpdateUser($"Restored Steamworks: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
@ -127,7 +129,7 @@ internal static class SmokeAPI
|
|||
File.Delete(api64);
|
||||
installForm?.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api64_o, api64);
|
||||
File.Move(api64_o, api64!);
|
||||
installForm?.UpdateUser($"Restored Steamworks: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(old_config))
|
||||
|
@ -159,7 +161,7 @@ internal static class SmokeAPI
|
|||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _, out _);
|
||||
if (File.Exists(api32) && !File.Exists(api32_o))
|
||||
{
|
||||
File.Move(api32, api32_o);
|
||||
File.Move(api32, api32_o!);
|
||||
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
|
@ -169,7 +171,7 @@ internal static class SmokeAPI
|
|||
}
|
||||
if (File.Exists(api64) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api64, api64_o);
|
||||
File.Move(api64, api64_o!);
|
||||
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
|
|
@ -25,8 +25,9 @@ internal static class UplayR1
|
|||
{
|
||||
directory.GetUplayR1Components(out _, out _, out _, out _, out string config);
|
||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> blacklistDlc = selection.AllDlc.Except(selection.SelectedDlc);
|
||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
foreach ((string _, string _, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
blacklistDlc = blacklistDlc.Except(extraDlc);
|
||||
blacklistDlc = blacklistDlc.ToList();
|
||||
if (blacklistDlc.Any())
|
||||
{
|
||||
/*if (installForm is not null)
|
||||
|
@ -80,7 +81,7 @@ internal static class UplayR1
|
|||
File.Delete(api32);
|
||||
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api32_o, api32);
|
||||
File.Move(api32_o, api32!);
|
||||
installForm?.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
@ -90,7 +91,7 @@ internal static class UplayR1
|
|||
File.Delete(api64);
|
||||
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api64_o, api64);
|
||||
File.Move(api64_o, api64!);
|
||||
installForm?.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
|
@ -103,10 +104,10 @@ internal static class UplayR1
|
|||
internal static async Task Install(string directory, ProgramSelection selection, InstallForm installForm = null, bool generateConfig = true)
|
||||
=> await Task.Run(() =>
|
||||
{
|
||||
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config);
|
||||
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string _);
|
||||
if (File.Exists(api32) && !File.Exists(api32_o))
|
||||
{
|
||||
File.Move(api32, api32_o);
|
||||
File.Move(api32, api32_o!);
|
||||
installForm?.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
|
@ -116,7 +117,7 @@ internal static class UplayR1
|
|||
}
|
||||
if (File.Exists(api64) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api64, api64_o);
|
||||
File.Move(api64, api64_o!);
|
||||
installForm?.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
|
|
@ -27,8 +27,9 @@ internal static class UplayR2
|
|||
{
|
||||
directory.GetUplayR2Components(out _, out _, out _, out _, out _, out _, out string config);
|
||||
IEnumerable<KeyValuePair<string, (DlcType type, string name, string icon)>> blacklistDlc = selection.AllDlc.Except(selection.SelectedDlc);
|
||||
foreach ((string id, string name, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
foreach ((string _, string _, SortedList<string, (DlcType type, string name, string icon)> extraDlc) in selection.ExtraSelectedDlc)
|
||||
blacklistDlc = blacklistDlc.Except(extraDlc);
|
||||
blacklistDlc = blacklistDlc.ToList();
|
||||
if (blacklistDlc.Any())
|
||||
{
|
||||
/*if (installForm is not null)
|
||||
|
@ -86,7 +87,7 @@ internal static class UplayR2
|
|||
File.Delete(api);
|
||||
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api32_o, api);
|
||||
File.Move(api32_o, api!);
|
||||
installForm?.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
@ -97,7 +98,7 @@ internal static class UplayR2
|
|||
File.Delete(api);
|
||||
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||
}
|
||||
File.Move(api64_o, api);
|
||||
File.Move(api64_o, api!);
|
||||
installForm?.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (deleteConfig && File.Exists(config))
|
||||
|
@ -111,11 +112,11 @@ internal static class UplayR2
|
|||
=> await Task.Run(() =>
|
||||
{
|
||||
directory.GetUplayR2Components(out string old_api32, out string old_api64, out string api32, out string api32_o, out string api64,
|
||||
out string api64_o, out string config);
|
||||
out string api64_o, out string _);
|
||||
string api = File.Exists(old_api32) ? old_api32 : api32;
|
||||
if (File.Exists(api) && !File.Exists(api32_o))
|
||||
{
|
||||
File.Move(api, api32_o);
|
||||
File.Move(api, api32_o!);
|
||||
installForm?.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api32_o))
|
||||
|
@ -126,7 +127,7 @@ internal static class UplayR2
|
|||
api = File.Exists(old_api64) ? old_api64 : api64;
|
||||
if (File.Exists(api) && !File.Exists(api64_o))
|
||||
{
|
||||
File.Move(api, api64_o);
|
||||
File.Move(api, api64_o!);
|
||||
installForm?.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||
}
|
||||
if (File.Exists(api64_o))
|
||||
|
|
Loading…
Reference in a new issue