v4.7.1.3
- More fixes related to locked DLLs - Converted from DLLImport to LibraryImport
This commit is contained in:
parent
cd386ea951
commit
52e82e2397
15 changed files with 278 additions and 278 deletions
|
@ -206,7 +206,7 @@ internal sealed class CustomTreeView : TreeView
|
||||||
foreach ((string directory, BinaryType _) in pair.Key.ExecutableDirectories)
|
foreach ((string directory, BinaryType _) in pair.Key.ExecutableDirectories)
|
||||||
{
|
{
|
||||||
string path = directory + @"\" + proxy + ".dll";
|
string path = directory + @"\" + proxy + ".dll";
|
||||||
if (!path.FileExists(form: form) || path.IsResourceFile(ResourceIdentifier.Koaloader))
|
if (!path.FileExists() || path.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||||
continue;
|
continue;
|
||||||
canUse = false;
|
canUse = false;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>net7.0-windows</TargetFramework>
|
<TargetFramework>net7.0-windows</TargetFramework>
|
||||||
<UseWindowsForms>True</UseWindowsForms>
|
<UseWindowsForms>True</UseWindowsForms>
|
||||||
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
|
||||||
<Version>4.7.1.2</Version>
|
<Version>4.7.1.3</Version>
|
||||||
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
|
||||||
<Company>CreamInstaller</Company>
|
<Company>CreamInstaller</Company>
|
||||||
<Product>Automatic DLC Unlocker Installer & Configuration Generator</Product>
|
<Product>Automatic DLC Unlocker Installer & Configuration Generator</Product>
|
||||||
|
@ -21,6 +21,7 @@
|
||||||
<DefineConstants>$(DefineConstants)</DefineConstants>
|
<DefineConstants>$(DefineConstants)</DefineConstants>
|
||||||
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||||
<AssemblyName>$(Company)</AssemblyName>
|
<AssemblyName>$(Company)</AssemblyName>
|
||||||
|
|
|
@ -80,9 +80,9 @@ internal sealed partial class InstallForm : CustomForm
|
||||||
if (Program.Canceled)
|
if (Program.Canceled)
|
||||||
throw new CustomMessageException("The operation was canceled.");
|
throw new CustomMessageException("The operation was canceled.");
|
||||||
directory.GetKoaloaderComponents(out string old_config, out string config);
|
directory.GetKoaloaderComponents(out string old_config, out string config);
|
||||||
if (directory.GetKoaloaderProxies().Any(proxy => proxy.FileExists(form: this) && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
if (directory.GetKoaloaderProxies().Any(proxy => proxy.FileExists() && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||||
|| directory != selection.RootDirectory && Koaloader.AutoLoadDLLs.Any(pair => (directory + @"\" + pair.dll).FileExists(form: this))
|
|| directory != selection.RootDirectory && Koaloader.AutoLoadDLLs.Any(pair => (directory + @"\" + pair.dll).FileExists())
|
||||||
|| old_config.FileExists(form: this) || config.FileExists(form: this))
|
|| old_config.FileExists() || config.FileExists())
|
||||||
{
|
{
|
||||||
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in incorrect directory \"{directory}\" . . . ", LogTextBox.Operation);
|
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in incorrect directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||||
await Koaloader.Uninstall(directory, selection.RootDirectory, this);
|
await Koaloader.Uninstall(directory, selection.RootDirectory, this);
|
||||||
|
@ -95,9 +95,8 @@ internal sealed partial class InstallForm : CustomForm
|
||||||
if (Program.Canceled)
|
if (Program.Canceled)
|
||||||
throw new CustomMessageException("The operation was canceled.");
|
throw new CustomMessageException("The operation was canceled.");
|
||||||
directory.GetKoaloaderComponents(out string old_config, out string config);
|
directory.GetKoaloaderComponents(out string old_config, out string config);
|
||||||
if (directory.GetKoaloaderProxies().Any(proxy => proxy.FileExists(form: this) && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
if (directory.GetKoaloaderProxies().Any(proxy => proxy.FileExists() && proxy.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||||
|| Koaloader.AutoLoadDLLs.Any(pair => (directory + @"\" + pair.dll).FileExists(form: this)) || old_config.FileExists(form: this)
|
|| Koaloader.AutoLoadDLLs.Any(pair => (directory + @"\" + pair.dll).FileExists()) || old_config.FileExists() || config.FileExists())
|
||||||
|| config.FileExists(form: this))
|
|
||||||
{
|
{
|
||||||
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
UpdateUser("Uninstalling Koaloader from " + selection.Name + $" in directory \"{directory}\" . . . ", LogTextBox.Operation);
|
||||||
await Koaloader.Uninstall(directory, selection.RootDirectory, this);
|
await Koaloader.Uninstall(directory, selection.RootDirectory, this);
|
||||||
|
@ -115,9 +114,9 @@ internal sealed partial class InstallForm : CustomForm
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
||||||
out string config, out string old_log, out string log, out string cache);
|
out string config, out string old_log, out string log, out string cache);
|
||||||
if (uninstallProxy
|
if (uninstallProxy
|
||||||
? api32_o.FileExists(form: this) || api64_o.FileExists(form: this) || old_config.FileExists(form: this) || config.FileExists(form: this)
|
? api32_o.FileExists() || api64_o.FileExists() || old_config.FileExists() || config.FileExists() || old_log.FileExists()
|
||||||
|| old_log.FileExists(form: this) || log.FileExists(form: this) || cache.FileExists(form: this)
|
|| log.FileExists() || cache.FileExists()
|
||||||
: api32.FileExists(form: this) || api64.FileExists(form: this))
|
: api32.FileExists() || api64.FileExists())
|
||||||
{
|
{
|
||||||
UpdateUser(
|
UpdateUser(
|
||||||
$"{(uninstallProxy ? "Uninstalling" : "Installing")} SmokeAPI" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
$"{(uninstallProxy ? "Uninstalling" : "Installing")} SmokeAPI" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
||||||
|
@ -132,8 +131,8 @@ internal sealed partial class InstallForm : CustomForm
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
||||||
if (uninstallProxy
|
if (uninstallProxy
|
||||||
? api32_o.FileExists(form: this) || api64_o.FileExists(form: this) || config.FileExists(form: this) || log.FileExists(form: this)
|
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists()
|
||||||
: api32.FileExists(form: this) || api64.FileExists(form: this))
|
: api32.FileExists() || api64.FileExists())
|
||||||
{
|
{
|
||||||
UpdateUser(
|
UpdateUser(
|
||||||
$"{(uninstallProxy ? "Uninstalling" : "Installing")} ScreamAPI" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
$"{(uninstallProxy ? "Uninstalling" : "Installing")} ScreamAPI" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
||||||
|
@ -148,8 +147,8 @@ internal sealed partial class InstallForm : CustomForm
|
||||||
{
|
{
|
||||||
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
||||||
if (uninstallProxy
|
if (uninstallProxy
|
||||||
? api32_o.FileExists(form: this) || api64_o.FileExists(form: this) || config.FileExists(form: this) || log.FileExists(form: this)
|
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists()
|
||||||
: api32.FileExists(form: this) || api64.FileExists(form: this))
|
: api32.FileExists() || api64.FileExists())
|
||||||
{
|
{
|
||||||
UpdateUser(
|
UpdateUser(
|
||||||
$"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
$"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R1 Unlocker" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
||||||
|
@ -161,8 +160,8 @@ internal sealed partial class InstallForm : CustomForm
|
||||||
}
|
}
|
||||||
directory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config, out log);
|
directory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config, out log);
|
||||||
if (uninstallProxy
|
if (uninstallProxy
|
||||||
? api32_o.FileExists(form: this) || api64_o.FileExists(form: this) || config.FileExists(form: this) || log.FileExists(form: this)
|
? api32_o.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists()
|
||||||
: old_api32.FileExists(form: this) || old_api64.FileExists(form: this) || api32.FileExists(form: this) || api64.FileExists(form: this))
|
: old_api32.FileExists() || old_api64.FileExists() || api32.FileExists() || api64.FileExists())
|
||||||
{
|
{
|
||||||
UpdateUser(
|
UpdateUser(
|
||||||
$"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
$"{(uninstallProxy ? "Uninstalling" : "Installing")} Uplay R2 Unlocker" + $" {(uninstallProxy ? "from" : "for")} " + selection.Name
|
||||||
|
|
|
@ -126,7 +126,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
if (uninstallAll || programsToScan.Any(c => c.platform is Platform.Paradox))
|
if (uninstallAll || programsToScan.Any(c => c.platform is Platform.Paradox))
|
||||||
{
|
{
|
||||||
AddToRemainingGames("Paradox Launcher");
|
AddToRemainingGames("Paradox Launcher");
|
||||||
List<string> dllDirectories = await ParadoxLauncher.InstallPath.GetDllDirectoriesFromGameDirectory(Platform.Paradox, this);
|
List<string> dllDirectories = await ParadoxLauncher.InstallPath.GetDllDirectoriesFromGameDirectory(Platform.Paradox);
|
||||||
if (dllDirectories is not null)
|
if (dllDirectories is not null)
|
||||||
{
|
{
|
||||||
if (uninstallAll)
|
if (uninstallAll)
|
||||||
|
@ -183,7 +183,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
if (Program.Canceled)
|
if (Program.Canceled)
|
||||||
return;
|
return;
|
||||||
List<string> dllDirectories = await gameDirectory.GetDllDirectoriesFromGameDirectory(Platform.Steam, this);
|
List<string> dllDirectories = await gameDirectory.GetDllDirectoriesFromGameDirectory(Platform.Steam);
|
||||||
if (dllDirectories is null)
|
if (dllDirectories is null)
|
||||||
{
|
{
|
||||||
Interlocked.Decrement(ref steamGamesToCheck);
|
Interlocked.Decrement(ref steamGamesToCheck);
|
||||||
|
@ -386,7 +386,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
if (Program.Canceled)
|
if (Program.Canceled)
|
||||||
return;
|
return;
|
||||||
List<string> dllDirectories = await directory.GetDllDirectoriesFromGameDirectory(Platform.Epic, this);
|
List<string> dllDirectories = await directory.GetDllDirectoriesFromGameDirectory(Platform.Epic);
|
||||||
if (dllDirectories is null)
|
if (dllDirectories is null)
|
||||||
{
|
{
|
||||||
RemoveFromRemainingGames(name);
|
RemoveFromRemainingGames(name);
|
||||||
|
@ -520,7 +520,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
if (Program.Canceled)
|
if (Program.Canceled)
|
||||||
return;
|
return;
|
||||||
List<string> dllDirectories = await gameDirectory.GetDllDirectoriesFromGameDirectory(Platform.Ubisoft, this);
|
List<string> dllDirectories = await gameDirectory.GetDllDirectoriesFromGameDirectory(Platform.Ubisoft);
|
||||||
if (dllDirectories is null)
|
if (dllDirectories is null)
|
||||||
{
|
{
|
||||||
RemoveFromRemainingGames(name);
|
RemoveFromRemainingGames(name);
|
||||||
|
@ -858,10 +858,10 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
string appInfoVDF = $@"{SteamCMD.AppInfoPath}\{id}.vdf";
|
string appInfoVDF = $@"{SteamCMD.AppInfoPath}\{id}.vdf";
|
||||||
string appInfoJSON = $@"{SteamCMD.AppInfoPath}\{id}.json";
|
string appInfoJSON = $@"{SteamCMD.AppInfoPath}\{id}.json";
|
||||||
string cooldown = $@"{ProgramData.CooldownPath}\{id}.txt";
|
string cooldown = $@"{ProgramData.CooldownPath}\{id}.txt";
|
||||||
if (appInfoVDF.FileExists(form: this) || appInfoJSON.FileExists(form: this))
|
if (appInfoVDF.FileExists() || appInfoJSON.FileExists())
|
||||||
{
|
{
|
||||||
List<ContextMenuItem> queries = new();
|
List<ContextMenuItem> queries = new();
|
||||||
if (appInfoJSON.FileExists(form: this))
|
if (appInfoJSON.FileExists())
|
||||||
{
|
{
|
||||||
string platformString = selection is null || selection.Platform is Platform.Steam
|
string platformString = selection is null || selection.Platform is Platform.Steam
|
||||||
? "Steam Store "
|
? "Steam Store "
|
||||||
|
@ -870,7 +870,7 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
: "";
|
: "";
|
||||||
queries.Add(new($"Open {platformString}Query", "Notepad", (_, _) => Diagnostics.OpenFileInNotepad(appInfoJSON)));
|
queries.Add(new($"Open {platformString}Query", "Notepad", (_, _) => Diagnostics.OpenFileInNotepad(appInfoJSON)));
|
||||||
}
|
}
|
||||||
if (appInfoVDF.FileExists(form: this))
|
if (appInfoVDF.FileExists())
|
||||||
queries.Add(new("Open SteamCMD Query", "Notepad", (_, _) => Diagnostics.OpenFileInNotepad(appInfoVDF)));
|
queries.Add(new("Open SteamCMD Query", "Notepad", (_, _) => Diagnostics.OpenFileInNotepad(appInfoVDF)));
|
||||||
if (queries.Any())
|
if (queries.Any())
|
||||||
{
|
{
|
||||||
|
@ -908,9 +908,8 @@ internal sealed partial class SelectForm : CustomForm
|
||||||
{
|
{
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
||||||
out string config, out string old_log, out string log, out string cache);
|
out string config, out string old_log, out string log, out string cache);
|
||||||
if (api32.FileExists(form: this) || api32_o.FileExists(form: this) || api64.FileExists(form: this) || api64_o.FileExists(form: this)
|
if (api32.FileExists() || api32_o.FileExists() || api64.FileExists() || api64_o.FileExists() || old_config.FileExists()
|
||||||
|| old_config.FileExists(form: this) || config.FileExists(form: this) || old_log.FileExists(form: this) || log.FileExists(form: this)
|
|| config.FileExists() || old_log.FileExists() || log.FileExists() || cache.FileExists())
|
||||||
|| cache.FileExists(form: this))
|
|
||||||
items.Add(new ContextMenuItem($"Open Steamworks Directory #{++steam}", "File Explorer",
|
items.Add(new ContextMenuItem($"Open Steamworks Directory #{++steam}", "File Explorer",
|
||||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||||
}
|
}
|
||||||
|
@ -919,8 +918,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,
|
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config,
|
||||||
out string log);
|
out string log);
|
||||||
if (api32.FileExists(form: this) || api32_o.FileExists(form: this) || api64.FileExists(form: this) || api64_o.FileExists(form: this)
|
if (api32.FileExists() || api32_o.FileExists() || api64.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists())
|
||||||
|| config.FileExists(form: this) || log.FileExists(form: this))
|
|
||||||
items.Add(new ContextMenuItem($"Open EOS Directory #{++epic}", "File Explorer",
|
items.Add(new ContextMenuItem($"Open EOS Directory #{++epic}", "File Explorer",
|
||||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||||
}
|
}
|
||||||
|
@ -929,15 +927,13 @@ 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,
|
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config,
|
||||||
out string log);
|
out string log);
|
||||||
if (api32.FileExists(form: this) || api32_o.FileExists(form: this) || api64.FileExists(form: this) || api64_o.FileExists(form: this)
|
if (api32.FileExists() || api32_o.FileExists() || api64.FileExists() || api64_o.FileExists() || config.FileExists() || log.FileExists())
|
||||||
|| config.FileExists(form: this) || log.FileExists(form: this))
|
|
||||||
items.Add(new ContextMenuItem($"Open Uplay R1 Directory #{++r1}", "File Explorer",
|
items.Add(new ContextMenuItem($"Open Uplay R1 Directory #{++r1}", "File Explorer",
|
||||||
(_, _) => 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,
|
directory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config,
|
||||||
out log);
|
out log);
|
||||||
if (old_api32.FileExists(form: this) || old_api64.FileExists(form: this) || api32.FileExists(form: this)
|
if (old_api32.FileExists() || old_api64.FileExists() || api32.FileExists() || api32_o.FileExists() || api64.FileExists()
|
||||||
|| api32_o.FileExists(form: this) || api64.FileExists(form: this) || api64_o.FileExists(form: this) || config.FileExists(form: this)
|
|| api64_o.FileExists() || config.FileExists() || log.FileExists())
|
||||||
|| log.FileExists(form: this))
|
|
||||||
items.Add(new ContextMenuItem($"Open Uplay R2 Directory #{++r2}", "File Explorer",
|
items.Add(new ContextMenuItem($"Open Uplay R2 Directory #{++r2}", "File Explorer",
|
||||||
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
(_, _) => Diagnostics.OpenDirectoryInFileExplorer(directory)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,9 @@ internal static class ParadoxLauncher
|
||||||
{
|
{
|
||||||
InstallForm installForm = form as InstallForm;
|
InstallForm installForm = form as InstallForm;
|
||||||
if (!Program.AreDllsLockedDialog(form, selection))
|
if (!Program.AreDllsLockedDialog(form, selection))
|
||||||
return form is InstallForm ? throw new CustomMessageException("Repair failed! One or more DLLs crucial to unlocker installation are locked!") : RepairResult.ProgramRunning;
|
return form is InstallForm
|
||||||
|
? throw new CustomMessageException("Repair failed! One or more DLLs crucial to unlocker installation are locked!")
|
||||||
|
: RepairResult.ProgramRunning;
|
||||||
bool smokeInstalled = false;
|
bool smokeInstalled = false;
|
||||||
byte[] steamOriginalSdk32 = null;
|
byte[] steamOriginalSdk32 = null;
|
||||||
byte[] steamOriginalSdk64 = null;
|
byte[] steamOriginalSdk64 = null;
|
||||||
|
@ -90,27 +92,27 @@ internal static class ParadoxLauncher
|
||||||
foreach (string directory in selection.DllDirectories)
|
foreach (string directory in selection.DllDirectories)
|
||||||
{
|
{
|
||||||
bool koaloaderInstalled = Koaloader.AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
bool koaloaderInstalled = Koaloader.AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
||||||
.Any(pair => pair.path.FileExists(form: form) && pair.path.IsResourceFile());
|
.Any(pair => pair.path.FileExists() && pair.path.IsResourceFile());
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
||||||
out string config, out _, out _, out _);
|
out string config, out _, out _, out _);
|
||||||
smokeInstalled = smokeInstalled || api32_o.FileExists(form: form) || api64_o.FileExists(form: form)
|
smokeInstalled = smokeInstalled || api32_o.FileExists() || api64_o.FileExists()
|
||||||
|| (old_config.FileExists(form: form) || config.FileExists(form: form)) && !koaloaderInstalled
|
|| (old_config.FileExists() || config.FileExists()) && !koaloaderInstalled
|
||||||
|| api32.FileExists(form: form) && api32.IsResourceFile(ResourceIdentifier.Steamworks32)
|
|| api32.FileExists() && api32.IsResourceFile(ResourceIdentifier.Steamworks32)
|
||||||
|| api64.FileExists(form: form) && api64.IsResourceFile(ResourceIdentifier.Steamworks64);
|
|| api64.FileExists() && api64.IsResourceFile(ResourceIdentifier.Steamworks64);
|
||||||
await SmokeAPI.Uninstall(directory, deleteOthers: false);
|
await SmokeAPI.Uninstall(directory, deleteOthers: false);
|
||||||
if (steamOriginalSdk32 is null && api32.FileExists(form: form) && !api32.IsResourceFile(ResourceIdentifier.Steamworks32))
|
if (steamOriginalSdk32 is null && api32.FileExists() && !api32.IsResourceFile(ResourceIdentifier.Steamworks32))
|
||||||
steamOriginalSdk32 = api32.ReadFileBytes(true);
|
steamOriginalSdk32 = api32.ReadFileBytes(true);
|
||||||
if (steamOriginalSdk64 is null && api64.FileExists(form: form) && !api64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
if (steamOriginalSdk64 is null && api64.FileExists() && !api64.IsResourceFile(ResourceIdentifier.Steamworks64))
|
||||||
steamOriginalSdk64 = api64.ReadFileBytes(true);
|
steamOriginalSdk64 = api64.ReadFileBytes(true);
|
||||||
directory.GetScreamApiComponents(out api32, out api32_o, out api64, out api64_o, out config, out string log);
|
directory.GetScreamApiComponents(out api32, out api32_o, out api64, out api64_o, out config, out string log);
|
||||||
screamInstalled = screamInstalled || api32_o.FileExists(form: form) || api64_o.FileExists(form: form)
|
screamInstalled = screamInstalled || api32_o.FileExists() || api64_o.FileExists()
|
||||||
|| (config.FileExists(form: form) || log.FileExists(form: form)) && !koaloaderInstalled
|
|| (config.FileExists() || log.FileExists()) && !koaloaderInstalled
|
||||||
|| api32.FileExists(form: form) && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32)
|
|| api32.FileExists() && api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32)
|
||||||
|| api64.FileExists(form: form) && api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64);
|
|| api64.FileExists() && api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64);
|
||||||
await ScreamAPI.Uninstall(directory, deleteOthers: false);
|
await ScreamAPI.Uninstall(directory, deleteOthers: false);
|
||||||
if (epicOriginalSdk32 is null && api32.FileExists(form: form) && !api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
if (epicOriginalSdk32 is null && api32.FileExists() && !api32.IsResourceFile(ResourceIdentifier.EpicOnlineServices32))
|
||||||
epicOriginalSdk32 = api32.ReadFileBytes(true);
|
epicOriginalSdk32 = api32.ReadFileBytes(true);
|
||||||
if (epicOriginalSdk64 is null && api64.FileExists(form: form) && !api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64))
|
if (epicOriginalSdk64 is null && api64.FileExists() && !api64.IsResourceFile(ResourceIdentifier.EpicOnlineServices64))
|
||||||
epicOriginalSdk64 = api64.ReadFileBytes(true);
|
epicOriginalSdk64 = api64.ReadFileBytes(true);
|
||||||
}
|
}
|
||||||
using DialogForm dialogForm = new(form);
|
using DialogForm dialogForm = new(form);
|
||||||
|
|
|
@ -60,9 +60,9 @@ internal static class Koaloader
|
||||||
private static void CheckConfig(string directory, InstallForm installForm = null)
|
private static void CheckConfig(string directory, InstallForm installForm = null)
|
||||||
{
|
{
|
||||||
directory.GetKoaloaderComponents(out string old_config, out string config);
|
directory.GetKoaloaderComponents(out string old_config, out string config);
|
||||||
if (old_config.FileExists(form: installForm))
|
if (old_config.FileExists())
|
||||||
{
|
{
|
||||||
if (!config.FileExists(form: installForm))
|
if (!config.FileExists())
|
||||||
{
|
{
|
||||||
old_config.MoveFile(config!);
|
old_config.MoveFile(config!);
|
||||||
installForm?.UpdateUser($"Converted old configuration: {Path.GetFileName(old_config)} -> {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Converted old configuration: {Path.GetFileName(old_config)} -> {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -85,7 +85,7 @@ internal static class Koaloader
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
else if (config.FileExists(form: installForm))
|
else if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -137,23 +137,23 @@ internal static class Koaloader
|
||||||
{
|
{
|
||||||
directory.GetKoaloaderComponents(out string old_config, out string config);
|
directory.GetKoaloaderComponents(out string old_config, out string config);
|
||||||
foreach (string proxyPath in directory.GetKoaloaderProxies().Where(proxyPath
|
foreach (string proxyPath in directory.GetKoaloaderProxies().Where(proxyPath
|
||||||
=> proxyPath.FileExists(form: installForm) && proxyPath.IsResourceFile(ResourceIdentifier.Koaloader)))
|
=> proxyPath.FileExists() && proxyPath.IsResourceFile(ResourceIdentifier.Koaloader)))
|
||||||
{
|
{
|
||||||
proxyPath.DeleteFile();
|
proxyPath.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Koaloader: {Path.GetFileName(proxyPath)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted Koaloader: {Path.GetFileName(proxyPath)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
foreach ((string unlocker, string path) in AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
foreach ((string unlocker, string path) in AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
||||||
.Where(pair => pair.path.FileExists(form: installForm) && pair.path.IsResourceFile()))
|
.Where(pair => pair.path.FileExists() && pair.path.IsResourceFile()))
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted {unlocker}: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted {unlocker}: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (deleteConfig && old_config.FileExists(form: installForm))
|
if (deleteConfig && old_config.FileExists())
|
||||||
{
|
{
|
||||||
old_config.DeleteFile();
|
old_config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(old_config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(old_config)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (deleteConfig && config.FileExists(form: installForm))
|
if (deleteConfig && config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -172,13 +172,12 @@ internal static class Koaloader
|
||||||
{
|
{
|
||||||
string proxy = selection.KoaloaderProxy ?? ProgramSelection.DefaultKoaloaderProxy;
|
string proxy = selection.KoaloaderProxy ?? ProgramSelection.DefaultKoaloaderProxy;
|
||||||
string path = directory + @"\" + proxy + ".dll";
|
string path = directory + @"\" + proxy + ".dll";
|
||||||
foreach (string _path in directory.GetKoaloaderProxies()
|
foreach (string _path in directory.GetKoaloaderProxies().Where(p => p != path && p.FileExists() && p.IsResourceFile(ResourceIdentifier.Koaloader)))
|
||||||
.Where(p => p != path && p.FileExists(form: installForm) && p.IsResourceFile(ResourceIdentifier.Koaloader)))
|
|
||||||
{
|
{
|
||||||
_path.DeleteFile();
|
_path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted Koaloader: {Path.GetFileName(_path)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (path.FileExists(form: installForm) && !path.IsResourceFile(ResourceIdentifier.Koaloader))
|
if (path.FileExists() && !path.IsResourceFile(ResourceIdentifier.Koaloader))
|
||||||
throw new CustomMessageException("A non-Koaloader DLL named " + proxy + ".dll already exists in this directory!");
|
throw new CustomMessageException("A non-Koaloader DLL named " + proxy + ".dll already exists in this directory!");
|
||||||
path.WriteProxy(proxy, binaryType);
|
path.WriteProxy(proxy, binaryType);
|
||||||
installForm?.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", LogTextBox.Action,
|
installForm?.UpdateUser($"Wrote {(binaryType == BinaryType.BIT32 ? "32-bit" : "64-bit")} Koaloader: {Path.GetFileName(path)}", LogTextBox.Action,
|
||||||
|
@ -206,7 +205,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\SmokeAPI32.dll";
|
path = directory + @"\SmokeAPI32.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted SmokeAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted SmokeAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
||||||
|
@ -223,7 +222,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\SmokeAPI64.dll";
|
path = directory + @"\SmokeAPI64.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted SmokeAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted SmokeAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
||||||
|
@ -246,7 +245,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\ScreamAPI32.dll";
|
path = directory + @"\ScreamAPI32.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted ScreamAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted ScreamAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
||||||
|
@ -263,7 +262,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\ScreamAPI64.dll";
|
path = directory + @"\ScreamAPI64.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted ScreamAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted ScreamAPI from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action, false);
|
||||||
|
@ -285,7 +284,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\UplayR1Unlocker32.dll";
|
path = directory + @"\UplayR1Unlocker32.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
||||||
|
@ -303,7 +302,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\UplayR1Unlocker64.dll";
|
path = directory + @"\UplayR1Unlocker64.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
||||||
|
@ -322,7 +321,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\UplayR2Unlocker32.dll";
|
path = directory + @"\UplayR2Unlocker32.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
||||||
|
@ -340,7 +339,7 @@ internal static class Koaloader
|
||||||
path = directory + @"\UplayR2Unlocker64.dll";
|
path = directory + @"\UplayR2Unlocker64.dll";
|
||||||
if (rootDirectory is not null && directory != rootDirectory)
|
if (rootDirectory is not null && directory != rootDirectory)
|
||||||
{
|
{
|
||||||
if (path.FileExists(form: installForm))
|
if (path.FileExists())
|
||||||
{
|
{
|
||||||
path.DeleteFile();
|
path.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker from non-root directory: {Path.GetFileName(path)}", LogTextBox.Action,
|
||||||
|
|
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -480,10 +479,7 @@ internal static class Resources
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode), DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
internal static bool TryGetFileBinaryType(this string path, out BinaryType binaryType) => NativeImports.GetBinaryType(path, out binaryType);
|
||||||
private static extern bool GetBinaryType(string lpApplicationName, out BinaryType lpBinaryType);
|
|
||||||
|
|
||||||
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,
|
internal static async Task<List<(string directory, BinaryType binaryType)>> GetExecutableDirectories(this string rootDirectory, bool filterCommon = false,
|
||||||
Func<string, bool> validFunc = null)
|
Func<string, bool> validFunc = null)
|
||||||
|
@ -535,7 +531,7 @@ internal static class Resources
|
||||||
|| subPath.Contains("ANTICHEAT");
|
|| subPath.Contains("ANTICHEAT");
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async Task<List<string>> GetDllDirectoriesFromGameDirectory(this string gameDirectory, Platform platform, Form form = null)
|
internal static async Task<List<string>> GetDllDirectoriesFromGameDirectory(this string gameDirectory, Platform platform)
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
List<string> dllDirectories = new();
|
List<string> dllDirectories = new();
|
||||||
|
@ -549,36 +545,35 @@ internal static class Resources
|
||||||
if (dllDirectories.Contains(subDirectory))
|
if (dllDirectories.Contains(subDirectory))
|
||||||
continue;
|
continue;
|
||||||
bool koaloaderInstalled = Koaloader.AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
bool koaloaderInstalled = Koaloader.AutoLoadDLLs.Select(pair => (pair.unlocker, path: directory + @"\" + pair.dll))
|
||||||
.Any(pair => pair.path.FileExists(form: form) && pair.path.IsResourceFile());
|
.Any(pair => pair.path.FileExists() && pair.path.IsResourceFile());
|
||||||
if (platform is Platform.Steam or Platform.Paradox)
|
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 old_config,
|
subDirectory.GetSmokeApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string old_config,
|
||||||
out string config, out string old_log, out string log, out string cache);
|
out string config, out string old_log, out string log, out string cache);
|
||||||
if (api.FileExists(form: form) || api_o.FileExists(form: form) || api64.FileExists(form: form) || api64_o.FileExists(form: form)
|
if (api.FileExists() || api_o.FileExists() || api64.FileExists() || api64_o.FileExists()
|
||||||
|| (old_config.FileExists(form: form) || config.FileExists(form: form) || old_log.FileExists(form: form) || log.FileExists(form: form)
|
|| (old_config.FileExists() || config.FileExists() || old_log.FileExists() || log.FileExists() || cache.FileExists())
|
||||||
|| cache.FileExists(form: form)) && !koaloaderInstalled)
|
&& !koaloaderInstalled)
|
||||||
dllDirectories.Add(subDirectory);
|
dllDirectories.Add(subDirectory);
|
||||||
}
|
}
|
||||||
if (platform is Platform.Epic or Platform.Paradox)
|
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,
|
subDirectory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config,
|
||||||
out string log);
|
out string log);
|
||||||
if (api32.FileExists(form: form) || api32_o.FileExists(form: form) || api64.FileExists(form: form) || api64_o.FileExists(form: form)
|
if (api32.FileExists() || api32_o.FileExists() || api64.FileExists() || api64_o.FileExists()
|
||||||
|| (config.FileExists(form: form) || log.FileExists(form: form)) && !koaloaderInstalled)
|
|| (config.FileExists() || log.FileExists()) && !koaloaderInstalled)
|
||||||
dllDirectories.Add(subDirectory);
|
dllDirectories.Add(subDirectory);
|
||||||
}
|
}
|
||||||
if (platform is Platform.Ubisoft)
|
if (platform is Platform.Ubisoft)
|
||||||
{
|
{
|
||||||
subDirectory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config,
|
subDirectory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config,
|
||||||
out string log);
|
out string log);
|
||||||
if (api32.FileExists(form: form) || api32_o.FileExists(form: form) || api64.FileExists(form: form) || api64_o.FileExists(form: form)
|
if (api32.FileExists() || api32_o.FileExists() || api64.FileExists() || api64_o.FileExists()
|
||||||
|| (config.FileExists(form: form) || log.FileExists(form: form)) && !koaloaderInstalled)
|
|| (config.FileExists() || log.FileExists()) && !koaloaderInstalled)
|
||||||
dllDirectories.Add(subDirectory);
|
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,
|
subDirectory.GetUplayR2Components(out string old_api32, out string old_api64, out api32, out api32_o, out api64, out api64_o, out config,
|
||||||
out log);
|
out log);
|
||||||
if (old_api32.FileExists(form: form) || old_api64.FileExists(form: form) || api32.FileExists(form: form) || api32_o.FileExists(form: form)
|
if (old_api32.FileExists() || old_api64.FileExists() || api32.FileExists() || api32_o.FileExists() || api64.FileExists()
|
||||||
|| api64.FileExists(form: form) || api64_o.FileExists(form: form)
|
|| api64_o.FileExists() || (config.FileExists() || log.FileExists()) && !koaloaderInstalled)
|
||||||
|| (config.FileExists(form: form) || log.FileExists(form: form)) && !koaloaderInstalled)
|
|
||||||
dllDirectories.Add(subDirectory);
|
dllDirectories.Add(subDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -597,7 +592,7 @@ internal static class Resources
|
||||||
|
|
||||||
#pragma warning disable CA5351
|
#pragma warning disable CA5351
|
||||||
private static string ComputeMD5(this string filePath)
|
private static string ComputeMD5(this string filePath)
|
||||||
=> filePath.FileExists() && filePath.ReadFileBytes() is { } bytes
|
=> filePath.FileExists() && filePath.ReadFileBytes(true) is { } bytes
|
||||||
? BitConverter.ToString(MD5.HashData(bytes)).Replace("-", "").ToUpperInvariant()
|
? BitConverter.ToString(MD5.HashData(bytes)).Replace("-", "").ToUpperInvariant()
|
||||||
: null;
|
: null;
|
||||||
#pragma warning restore CA5351
|
#pragma warning restore CA5351
|
||||||
|
|
|
@ -46,7 +46,7 @@ internal static class ScreamAPI
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
else if (config.FileExists(form: installForm))
|
else if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -105,9 +105,9 @@ internal static class ScreamAPI
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
if (api32.FileExists(form: installForm))
|
if (api32.FileExists())
|
||||||
{
|
{
|
||||||
api32.DeleteFile();
|
api32.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
|
@ -115,9 +115,9 @@ internal static class ScreamAPI
|
||||||
api32_o.MoveFile(api32!);
|
api32_o.MoveFile(api32!);
|
||||||
installForm?.UpdateUser($"Restored EOS: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Restored EOS: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
if (api64.FileExists(form: installForm))
|
if (api64.FileExists())
|
||||||
{
|
{
|
||||||
api64.DeleteFile();
|
api64.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||||
|
@ -127,12 +127,12 @@ internal static class ScreamAPI
|
||||||
}
|
}
|
||||||
if (!deleteOthers)
|
if (!deleteOthers)
|
||||||
return;
|
return;
|
||||||
if (config.FileExists(form: installForm))
|
if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (log.FileExists(form: installForm))
|
if (log.FileExists())
|
||||||
{
|
{
|
||||||
log.DeleteFile();
|
log.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
||||||
|
@ -143,22 +143,22 @@ internal static class ScreamAPI
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _);
|
directory.GetScreamApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _);
|
||||||
if (api32.FileExists(form: installForm) && !api32_o.FileExists(form: installForm))
|
if (api32.FileExists() && !api32_o.FileExists())
|
||||||
{
|
{
|
||||||
api32.MoveFile(api32_o!);
|
api32.MoveFile(api32_o!);
|
||||||
installForm?.UpdateUser($"Renamed EOS: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed EOS: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
"ScreamAPI.EOSSDK-Win32-Shipping.dll".WriteManifestResource(api32);
|
"ScreamAPI.EOSSDK-Win32-Shipping.dll".WriteManifestResource(api32);
|
||||||
installForm?.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64.FileExists(form: installForm) && !api64_o.FileExists(form: installForm))
|
if (api64.FileExists() && !api64_o.FileExists())
|
||||||
{
|
{
|
||||||
api64.MoveFile(api64_o!);
|
api64.MoveFile(api64_o!);
|
||||||
installForm?.UpdateUser($"Renamed EOS: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed EOS: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
"ScreamAPI.EOSSDK-Win64-Shipping.dll".WriteManifestResource(api64);
|
"ScreamAPI.EOSSDK-Win64-Shipping.dll".WriteManifestResource(api64);
|
||||||
installForm?.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote ScreamAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||||
|
|
|
@ -51,7 +51,7 @@ internal static class SmokeAPI
|
||||||
extraApps.Add(newExtraPair);
|
extraApps.Add(newExtraPair);
|
||||||
}
|
}
|
||||||
injectDlc = injectDlc.ToList();
|
injectDlc = injectDlc.ToList();
|
||||||
if (old_config.FileExists(form: installForm))
|
if (old_config.FileExists())
|
||||||
{
|
{
|
||||||
old_config.DeleteFile();
|
old_config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted old configuration: {Path.GetFileName(old_config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted old configuration: {Path.GetFileName(old_config)}", LogTextBox.Action, false);
|
||||||
|
@ -68,7 +68,7 @@ internal static class SmokeAPI
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
else if (config.FileExists(form: installForm))
|
else if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -155,16 +155,16 @@ internal static class SmokeAPI
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
|
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
|
||||||
if (oldConfig.FileExists(form: installForm))
|
if (oldConfig.FileExists())
|
||||||
{
|
{
|
||||||
oldConfig.DeleteFile();
|
oldConfig.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out string old_config,
|
||||||
out string config, out string old_log, out string log, out string cache);
|
out string config, out string old_log, out string log, out string cache);
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
if (api32.FileExists(form: installForm))
|
if (api32.FileExists())
|
||||||
{
|
{
|
||||||
api32.DeleteFile();
|
api32.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
|
@ -172,9 +172,9 @@ internal static class SmokeAPI
|
||||||
api32_o.MoveFile(api32!);
|
api32_o.MoveFile(api32!);
|
||||||
installForm?.UpdateUser($"Restored Steamworks: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Restored Steamworks: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
if (api64.FileExists(form: installForm))
|
if (api64.FileExists())
|
||||||
{
|
{
|
||||||
api64.DeleteFile();
|
api64.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||||
|
@ -184,27 +184,27 @@ internal static class SmokeAPI
|
||||||
}
|
}
|
||||||
if (!deleteOthers)
|
if (!deleteOthers)
|
||||||
return;
|
return;
|
||||||
if (old_config.FileExists(form: installForm))
|
if (old_config.FileExists())
|
||||||
{
|
{
|
||||||
old_config.DeleteFile();
|
old_config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(old_config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(old_config)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (config.FileExists(form: installForm))
|
if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (cache.FileExists(form: installForm))
|
if (cache.FileExists())
|
||||||
{
|
{
|
||||||
cache.DeleteFile();
|
cache.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted cache: {Path.GetFileName(cache)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted cache: {Path.GetFileName(cache)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (old_log.FileExists(form: installForm))
|
if (old_log.FileExists())
|
||||||
{
|
{
|
||||||
old_log.DeleteFile();
|
old_log.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(old_log)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(old_log)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (log.FileExists(form: installForm))
|
if (log.FileExists())
|
||||||
{
|
{
|
||||||
log.DeleteFile();
|
log.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
||||||
|
@ -215,28 +215,28 @@ internal static class SmokeAPI
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
|
directory.GetCreamApiComponents(out _, out _, out _, out _, out string oldConfig);
|
||||||
if (oldConfig.FileExists(form: installForm))
|
if (oldConfig.FileExists())
|
||||||
{
|
{
|
||||||
oldConfig.DeleteFile();
|
oldConfig.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted old CreamAPI configuration: {Path.GetFileName(oldConfig)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _, out _, out _, out _);
|
directory.GetSmokeApiComponents(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _, out _, out _, out _);
|
||||||
if (api32.FileExists(form: installForm) && !api32_o.FileExists(form: installForm))
|
if (api32.FileExists() && !api32_o.FileExists())
|
||||||
{
|
{
|
||||||
api32.MoveFile(api32_o!);
|
api32.MoveFile(api32_o!);
|
||||||
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
"SmokeAPI.steam_api.dll".WriteManifestResource(api32);
|
"SmokeAPI.steam_api.dll".WriteManifestResource(api32);
|
||||||
installForm?.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64.FileExists(form: installForm) && !api64_o.FileExists(form: installForm))
|
if (api64.FileExists() && !api64_o.FileExists())
|
||||||
{
|
{
|
||||||
api64.MoveFile(api64_o!);
|
api64.MoveFile(api64_o!);
|
||||||
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed Steamworks: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
"SmokeAPI.steam_api64.dll".WriteManifestResource(api64);
|
"SmokeAPI.steam_api64.dll".WriteManifestResource(api64);
|
||||||
installForm?.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote SmokeAPI: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||||
|
|
|
@ -39,7 +39,7 @@ internal static class UplayR1
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
else if (config.FileExists(form: installForm))
|
else if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -75,9 +75,9 @@ internal static class UplayR1
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out string config, out string log);
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
if (api32.FileExists(form: installForm))
|
if (api32.FileExists())
|
||||||
{
|
{
|
||||||
api32.DeleteFile();
|
api32.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
|
@ -85,9 +85,9 @@ internal static class UplayR1
|
||||||
api32_o.MoveFile(api32!);
|
api32_o.MoveFile(api32!);
|
||||||
installForm?.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Restored Uplay R1: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
if (api64.FileExists(form: installForm))
|
if (api64.FileExists())
|
||||||
{
|
{
|
||||||
api64.DeleteFile();
|
api64.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||||
|
@ -97,12 +97,12 @@ internal static class UplayR1
|
||||||
}
|
}
|
||||||
if (!deleteOthers)
|
if (!deleteOthers)
|
||||||
return;
|
return;
|
||||||
if (config.FileExists(form: installForm))
|
if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (log.FileExists(form: installForm))
|
if (log.FileExists())
|
||||||
{
|
{
|
||||||
log.DeleteFile();
|
log.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
||||||
|
@ -113,22 +113,22 @@ internal static class UplayR1
|
||||||
=> await Task.Run(() =>
|
=> await Task.Run(() =>
|
||||||
{
|
{
|
||||||
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _);
|
directory.GetUplayR1Components(out string api32, out string api32_o, out string api64, out string api64_o, out _, out _);
|
||||||
if (api32.FileExists(form: installForm) && !api32_o.FileExists(form: installForm))
|
if (api32.FileExists() && !api32_o.FileExists())
|
||||||
{
|
{
|
||||||
api32.MoveFile(api32_o!);
|
api32.MoveFile(api32_o!);
|
||||||
installForm?.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api32)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
"UplayR1.uplay_r1_loader.dll".WriteManifestResource(api32);
|
"UplayR1.uplay_r1_loader.dll".WriteManifestResource(api32);
|
||||||
installForm?.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api32)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64.FileExists(form: installForm) && !api64_o.FileExists(form: installForm))
|
if (api64.FileExists() && !api64_o.FileExists())
|
||||||
{
|
{
|
||||||
api64.MoveFile(api64_o!);
|
api64.MoveFile(api64_o!);
|
||||||
installForm?.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed Uplay R1: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
"UplayR1.uplay_r1_loader64.dll".WriteManifestResource(api64);
|
"UplayR1.uplay_r1_loader64.dll".WriteManifestResource(api64);
|
||||||
installForm?.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote Uplay R1 Unlocker: {Path.GetFileName(api64)}", LogTextBox.Action, false);
|
||||||
|
|
|
@ -41,7 +41,7 @@ internal static class UplayR2
|
||||||
writer.Flush();
|
writer.Flush();
|
||||||
writer.Close();
|
writer.Close();
|
||||||
}
|
}
|
||||||
else if (config.FileExists(form: installForm))
|
else if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted unnecessary configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
|
@ -80,10 +80,10 @@ internal static class UplayR2
|
||||||
{
|
{
|
||||||
directory.GetUplayR2Components(out string old_api32, out string old_api64, out string api32, out string api32_o, out string api64,
|
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 log);
|
out string api64_o, out string config, out string log);
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
string api = old_api32.FileExists(form: installForm) ? old_api32 : api32;
|
string api = old_api32.FileExists() ? old_api32 : api32;
|
||||||
if (api.FileExists(form: installForm))
|
if (api.FileExists())
|
||||||
{
|
{
|
||||||
api.DeleteFile();
|
api.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||||
|
@ -91,10 +91,10 @@ internal static class UplayR2
|
||||||
api32_o.MoveFile(api!);
|
api32_o.MoveFile(api!);
|
||||||
installForm?.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Restored Uplay R2: {Path.GetFileName(api32_o)} -> {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
string api = old_api64.FileExists(form: installForm) ? old_api64 : api64;
|
string api = old_api64.FileExists() ? old_api64 : api64;
|
||||||
if (api.FileExists(form: installForm))
|
if (api.FileExists())
|
||||||
{
|
{
|
||||||
api.DeleteFile();
|
api.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||||
|
@ -104,12 +104,12 @@ internal static class UplayR2
|
||||||
}
|
}
|
||||||
if (!deleteOthers)
|
if (!deleteOthers)
|
||||||
return;
|
return;
|
||||||
if (config.FileExists(form: installForm))
|
if (config.FileExists())
|
||||||
{
|
{
|
||||||
config.DeleteFile();
|
config.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted configuration: {Path.GetFileName(config)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (log.FileExists(form: installForm))
|
if (log.FileExists())
|
||||||
{
|
{
|
||||||
log.DeleteFile();
|
log.DeleteFile();
|
||||||
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Deleted log: {Path.GetFileName(log)}", LogTextBox.Action, false);
|
||||||
|
@ -121,24 +121,24 @@ internal static class UplayR2
|
||||||
{
|
{
|
||||||
directory.GetUplayR2Components(out string old_api32, out string old_api64, out string api32, out string api32_o, out string api64,
|
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 _, out _);
|
out string api64_o, out _, out _);
|
||||||
string api = old_api32.FileExists(form: installForm) ? old_api32 : api32;
|
string api = old_api32.FileExists() ? old_api32 : api32;
|
||||||
if (api.FileExists(form: installForm) && !api32_o.FileExists(form: installForm))
|
if (api.FileExists() && !api32_o.FileExists())
|
||||||
{
|
{
|
||||||
api.MoveFile(api32_o!);
|
api.MoveFile(api32_o!);
|
||||||
installForm?.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api32_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api32_o.FileExists(form: installForm))
|
if (api32_o.FileExists())
|
||||||
{
|
{
|
||||||
"UplayR2.upc_r2_loader.dll".WriteManifestResource(api);
|
"UplayR2.upc_r2_loader.dll".WriteManifestResource(api);
|
||||||
installForm?.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
api = old_api64.FileExists(form: installForm) ? old_api64 : api64;
|
api = old_api64.FileExists() ? old_api64 : api64;
|
||||||
if (api.FileExists(form: installForm) && !api64_o.FileExists(form: installForm))
|
if (api.FileExists() && !api64_o.FileExists())
|
||||||
{
|
{
|
||||||
api.MoveFile(api64_o!);
|
api.MoveFile(api64_o!);
|
||||||
installForm?.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Renamed Uplay R2: {Path.GetFileName(api)} -> {Path.GetFileName(api64_o)}", LogTextBox.Action, false);
|
||||||
}
|
}
|
||||||
if (api64_o.FileExists(form: installForm))
|
if (api64_o.FileExists())
|
||||||
{
|
{
|
||||||
"UplayR2.upc_r2_loader64.dll".WriteManifestResource(api);
|
"UplayR2.upc_r2_loader64.dll".WriteManifestResource(api);
|
||||||
installForm?.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
installForm?.UpdateUser($"Wrote Uplay R2 Unlocker: {Path.GetFileName(api)}", LogTextBox.Action, false);
|
||||||
|
|
11
CreamInstaller/Utility/NativeImports.cs
Normal file
11
CreamInstaller/Utility/NativeImports.cs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using static CreamInstaller.Resources.Resources;
|
||||||
|
|
||||||
|
namespace CreamInstaller.Utility;
|
||||||
|
|
||||||
|
internal static partial class NativeImports
|
||||||
|
{
|
||||||
|
[LibraryImport("kernel32.dll", SetLastError = true), DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||||
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
|
internal static partial bool GetBinaryType([MarshalAs(UnmanagedType.LPStr)] string lpApplicationName, out BinaryType lpBinaryType);
|
||||||
|
}
|
|
@ -35,15 +35,14 @@ internal static class ProgramData
|
||||||
DirectoryPathOld.MoveDirectory(DirectoryPath, true, form);
|
DirectoryPathOld.MoveDirectory(DirectoryPath, true, form);
|
||||||
}
|
}
|
||||||
DirectoryPath.CreateDirectory();
|
DirectoryPath.CreateDirectory();
|
||||||
if (!AppInfoVersionPath.FileExists(form: form) || !Version.TryParse(AppInfoVersionPath.ReadFile(), out Version version)
|
if (!AppInfoVersionPath.FileExists() || !Version.TryParse(AppInfoVersionPath.ReadFile(), out Version version) || version < MinimumAppInfoVersion)
|
||||||
|| version < MinimumAppInfoVersion)
|
|
||||||
{
|
{
|
||||||
AppInfoPath.DeleteDirectory();
|
AppInfoPath.DeleteDirectory();
|
||||||
AppInfoPath.CreateDirectory();
|
AppInfoPath.CreateDirectory();
|
||||||
AppInfoVersionPath.WriteFile(Program.Version);
|
AppInfoVersionPath.WriteFile(Program.Version);
|
||||||
}
|
}
|
||||||
CooldownPath.CreateDirectory();
|
CooldownPath.CreateDirectory();
|
||||||
if (OldProgramChoicesPath.FileExists(form: form))
|
if (OldProgramChoicesPath.FileExists())
|
||||||
OldProgramChoicesPath.DeleteFile();
|
OldProgramChoicesPath.DeleteFile();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -26,16 +26,7 @@ internal static class SafeIO
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool DirectoryExists(this string directoryPath, bool crucial = false, Form form = null)
|
internal static bool DirectoryExists(this string directoryPath) => Directory.Exists(directoryPath);
|
||||||
{
|
|
||||||
while (!Program.Canceled)
|
|
||||||
{
|
|
||||||
bool exists = Directory.Exists(directoryPath);
|
|
||||||
if (exists || !crucial || directoryPath.IOWarn("Failed to find a crucial directory", form) is not DialogResult.OK)
|
|
||||||
return exists;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void CreateDirectory(this string directoryPath, bool crucial = false, Form form = null)
|
internal static void CreateDirectory(this string directoryPath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
@ -49,13 +40,15 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || directoryPath.IOWarn("Failed to create a crucial directory", form) is not DialogResult.OK)
|
if (!crucial || directoryPath.DirectoryExists() || directoryPath.IOWarn("Failed to create a crucial directory", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void MoveDirectory(this string directoryPath, string newDirectoryPath, bool crucial = false, Form form = null)
|
internal static void MoveDirectory(this string directoryPath, string newDirectoryPath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!directoryPath.DirectoryExists())
|
||||||
|
return;
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -64,7 +57,7 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || directoryPath.IOWarn("Failed to move a crucial directory", form) is not DialogResult.OK)
|
if (!crucial || !directoryPath.DirectoryExists() || directoryPath.IOWarn("Failed to move a crucial directory", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +74,7 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || directoryPath.IOWarn("Failed to delete a crucial directory", form) is not DialogResult.OK)
|
if (!crucial || !directoryPath.DirectoryExists() || directoryPath.IOWarn("Failed to delete a crucial directory", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,6 +82,8 @@ internal static class SafeIO
|
||||||
internal static IEnumerable<string> EnumerateDirectory(this string directoryPath, string filePattern, bool subdirectories = false, bool crucial = false,
|
internal static IEnumerable<string> EnumerateDirectory(this string directoryPath, string filePattern, bool subdirectories = false, bool crucial = false,
|
||||||
Form form = null)
|
Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!directoryPath.DirectoryExists())
|
||||||
|
return Enumerable.Empty<string>();
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -98,7 +93,8 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || directoryPath.IOWarn("Failed to enumerate a crucial directory's files", form) is not DialogResult.OK)
|
if (!crucial || !directoryPath.DirectoryExists()
|
||||||
|
|| directoryPath.IOWarn("Failed to enumerate a crucial directory's files", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return Enumerable.Empty<string>();
|
return Enumerable.Empty<string>();
|
||||||
|
@ -107,6 +103,8 @@ internal static class SafeIO
|
||||||
internal static IEnumerable<string> EnumerateSubdirectories(this string directoryPath, string directoryPattern, bool subdirectories = false,
|
internal static IEnumerable<string> EnumerateSubdirectories(this string directoryPath, string directoryPattern, bool subdirectories = false,
|
||||||
bool crucial = false, Form form = null)
|
bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!directoryPath.DirectoryExists())
|
||||||
|
return Enumerable.Empty<string>();
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -116,22 +114,14 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || directoryPath.IOWarn("Failed to enumerate a crucial directory's subdirectories", form) is not DialogResult.OK)
|
if (!crucial || !directoryPath.DirectoryExists()
|
||||||
|
|| directoryPath.IOWarn("Failed to enumerate a crucial directory's subdirectories", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return Enumerable.Empty<string>();
|
return Enumerable.Empty<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool FileExists(this string filePath, bool crucial = false, Form form = null)
|
internal static bool FileExists(this string filePath) => File.Exists(filePath);
|
||||||
{
|
|
||||||
while (!Program.Canceled)
|
|
||||||
{
|
|
||||||
bool exists = File.Exists(filePath);
|
|
||||||
if (exists || !crucial || filePath.IOWarn("Failed to find a crucial file", form) is not DialogResult.OK)
|
|
||||||
return exists;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal static void CreateFile(this string filePath, bool crucial = false, Form form = null)
|
internal static void CreateFile(this string filePath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
@ -150,6 +140,8 @@ internal static class SafeIO
|
||||||
|
|
||||||
internal static void MoveFile(this string filePath, string newFilePath, bool crucial = false, Form form = null)
|
internal static void MoveFile(this string filePath, string newFilePath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!filePath.FileExists())
|
||||||
|
return;
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -158,14 +150,14 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || !filePath.FileExists(true) || filePath.IOWarn("Failed to move a crucial file", form) is not DialogResult.OK)
|
if (!crucial || !filePath.FileExists() || filePath.IOWarn("Failed to move a crucial file", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void DeleteFile(this string filePath, bool crucial = false, Form form = null)
|
internal static void DeleteFile(this string filePath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
if (!filePath.FileExists(form: form))
|
if (!filePath.FileExists())
|
||||||
return;
|
return;
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
|
@ -175,13 +167,15 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || filePath.IOWarn("Failed to delete a crucial file", form) is not DialogResult.OK)
|
if (!crucial || !filePath.FileExists() || filePath.IOWarn("Failed to delete a crucial file", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static string ReadFile(this string filePath, bool crucial = false, Form form = null)
|
internal static string ReadFile(this string filePath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!filePath.FileExists())
|
||||||
|
return null;
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -189,7 +183,7 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || !filePath.FileExists(true) || filePath.IOWarn("Failed to read a crucial file", form) is not DialogResult.OK)
|
if (!crucial || !filePath.FileExists() || filePath.IOWarn("Failed to read a crucial file", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -197,6 +191,8 @@ internal static class SafeIO
|
||||||
|
|
||||||
internal static byte[] ReadFileBytes(this string filePath, bool crucial = false, Form form = null)
|
internal static byte[] ReadFileBytes(this string filePath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!filePath.FileExists())
|
||||||
|
return null;
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -204,7 +200,7 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || !filePath.FileExists(true) || filePath.IOWarn("Failed to read a crucial file", form) is not DialogResult.OK)
|
if (!crucial || !filePath.FileExists() || filePath.IOWarn("Failed to read a crucial file", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -227,6 +223,8 @@ internal static class SafeIO
|
||||||
|
|
||||||
internal static void ExtractZip(this string archivePath, string destinationPath, bool crucial = false, Form form = null)
|
internal static void ExtractZip(this string archivePath, string destinationPath, bool crucial = false, Form form = null)
|
||||||
{
|
{
|
||||||
|
if (!archivePath.FileExists())
|
||||||
|
return;
|
||||||
while (!Program.Canceled)
|
while (!Program.Canceled)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -235,7 +233,7 @@ internal static class SafeIO
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
if (!crucial || archivePath.IOWarn("Failed to extract a crucial zip file", form) is not DialogResult.OK)
|
if (!crucial || !archivePath.FileExists() || archivePath.IOWarn("Failed to extract a crucial zip file", form) is not DialogResult.OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
preview.png
BIN
preview.png
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 43 KiB |
Loading…
Reference in a new issue