diff --git a/CreamInstaller/CreamInstaller.csproj b/CreamInstaller/CreamInstaller.csproj index 00a4727..6724148 100644 --- a/CreamInstaller/CreamInstaller.csproj +++ b/CreamInstaller/CreamInstaller.csproj @@ -5,7 +5,7 @@ True Resources\ini.ico true - 3.2.0.4 + 3.2.0.5 Resources\ini.ico @@ -31,16 +31,6 @@ true TRACE - - - - - - - - - - diff --git a/CreamInstaller/Epic/EpicLibrary.cs b/CreamInstaller/Epic/EpicLibrary.cs index 9b04164..7b2e53c 100644 --- a/CreamInstaller/Epic/EpicLibrary.cs +++ b/CreamInstaller/Epic/EpicLibrary.cs @@ -50,12 +50,12 @@ internal static class EpicLibrary { List dllDirectories = new(); if (Program.Canceled || !Directory.Exists(gameDirectory)) return null; - gameDirectory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); - if (File.Exists(sdk) - || File.Exists(sdk_o) + gameDirectory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config); + if (File.Exists(sdk32) + || File.Exists(sdk32_o) || File.Exists(sdk64) || File.Exists(sdk64_o) - || File.Exists(sApi)) + || File.Exists(config)) dllDirectories.Add(gameDirectory); string[] directories = Directory.GetDirectories(gameDirectory); foreach (string _directory in directories) diff --git a/CreamInstaller/InstallForm.cs b/CreamInstaller/InstallForm.cs index cf00e42..f99e13f 100644 --- a/CreamInstaller/InstallForm.cs +++ b/CreamInstaller/InstallForm.cs @@ -74,70 +74,70 @@ internal partial class InstallForm : CustomForm internal static async Task UninstallCreamAPI(string directory, InstallForm installForm = null) => await Task.Run(() => { - directory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi); - if (File.Exists(api_o)) + directory.GetCreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config); + if (File.Exists(sdk32_o)) { - if (File.Exists(api)) + if (File.Exists(sdk32)) { - File.Delete(api); + File.Delete(sdk32); if (installForm is not null) - installForm.UpdateUser($"Deleted file: {Path.GetFileName(api)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Deleted file: {Path.GetFileName(sdk32)}", InstallationLog.Resource, info: false); } - File.Move(api_o, api); + File.Move(sdk32_o, sdk32); if (installForm is not null) - installForm.UpdateUser($"Renamed file: {Path.GetFileName(api_o)} -> {Path.GetFileName(api)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk32_o)} -> {Path.GetFileName(sdk32)}", InstallationLog.Resource, info: false); } - if (File.Exists(api64_o)) + if (File.Exists(sdk64_o)) { - if (File.Exists(api64)) + if (File.Exists(sdk64)) { - File.Delete(api64); + File.Delete(sdk64); if (installForm is not null) - installForm.UpdateUser($"Deleted file: {Path.GetFileName(api64)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Deleted file: {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); } - File.Move(api64_o, api64); + File.Move(sdk64_o, sdk64); if (installForm is not null) - installForm.UpdateUser($"Renamed file: {Path.GetFileName(api64_o)} -> {Path.GetFileName(api64)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk64_o)} -> {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); } - if (File.Exists(cApi)) + if (File.Exists(config)) { - File.Delete(cApi); + File.Delete(config); if (installForm is not null) - installForm.UpdateUser($"Deleted file: {Path.GetFileName(cApi)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Deleted file: {Path.GetFileName(config)}", InstallationLog.Resource, info: false); } }); internal static async Task InstallCreamAPI(string directory, ProgramSelection selection, InstallForm installForm = null) => await Task.Run(() => { - directory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi); - if (File.Exists(api) && !File.Exists(api_o)) + directory.GetCreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config); + if (File.Exists(sdk32) && !File.Exists(sdk32_o)) { - File.Move(api, api_o); + File.Move(sdk32, sdk32_o); if (installForm is not null) - installForm.UpdateUser($"Renamed file: {Path.GetFileName(api)} -> {Path.GetFileName(api_o)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk32)} -> {Path.GetFileName(sdk32_o)}", InstallationLog.Resource, info: false); } - if (File.Exists(api_o)) + if (File.Exists(sdk32_o)) { - Properties.Resources.API.Write(api); + Properties.Resources.Steamworks32.Write(sdk32); if (installForm is not null) - installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(api)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk32)}", InstallationLog.Resource, info: false); } - if (File.Exists(api64) && !File.Exists(api64_o)) + if (File.Exists(sdk64) && !File.Exists(sdk64_o)) { - File.Move(api64, api64_o); + File.Move(sdk64, sdk64_o); if (installForm is not null) - installForm.UpdateUser($"Renamed file: {Path.GetFileName(api64)} -> {Path.GetFileName(api64_o)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk64)} -> {Path.GetFileName(sdk64_o)}", InstallationLog.Resource, info: false); } - if (File.Exists(api64_o)) + if (File.Exists(sdk64_o)) { - Properties.Resources.API64.Write(api64); + Properties.Resources.Steamworks64.Write(sdk64); if (installForm is not null) - installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(api64)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); } if (installForm is not null) installForm.UpdateUser("Generating CreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation); - File.Create(cApi).Close(); - StreamWriter writer = new(cApi, true, Encoding.UTF8); + File.Create(config).Close(); + StreamWriter writer = new(config, true, Encoding.UTF8); if (selection.Id != "ParadoxLauncher") WriteCreamConfiguration(writer, selection.Id, selection.Name, selection.SelectedDlc, installForm); foreach (Tuple> extraAppDlc in selection.ExtraDlc) @@ -206,18 +206,18 @@ internal partial class InstallForm : CustomForm internal static async Task UninstallScreamAPI(string directory, InstallForm installForm = null) => await Task.Run(() => { - directory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); - if (File.Exists(sdk_o)) + directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config); + if (File.Exists(sdk32_o)) { - if (File.Exists(sdk)) + if (File.Exists(sdk32)) { - File.Delete(sdk); + File.Delete(sdk32); if (installForm is not null) - installForm.UpdateUser($"Deleted file: {Path.GetFileName(sdk)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Deleted file: {Path.GetFileName(sdk32)}", InstallationLog.Resource, info: false); } - File.Move(sdk_o, sdk); + File.Move(sdk32_o, sdk32); if (installForm is not null) - installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk_o)} -> {Path.GetFileName(sdk)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk32_o)} -> {Path.GetFileName(sdk32)}", InstallationLog.Resource, info: false); } if (File.Exists(sdk64_o)) { @@ -231,28 +231,28 @@ internal partial class InstallForm : CustomForm if (installForm is not null) installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk64_o)} -> {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); } - if (File.Exists(sApi)) + if (File.Exists(config)) { - File.Delete(sApi); + File.Delete(config); if (installForm is not null) - installForm.UpdateUser($"Deleted file: {Path.GetFileName(sApi)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Deleted file: {Path.GetFileName(config)}", InstallationLog.Resource, info: false); } }); internal static async Task InstallScreamAPI(string directory, ProgramSelection selection, InstallForm installForm = null) => await Task.Run(() => { - directory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); - if (File.Exists(sdk) && !File.Exists(sdk_o)) + directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config); + if (File.Exists(sdk32) && !File.Exists(sdk32_o)) { - File.Move(sdk, sdk_o); + File.Move(sdk32, sdk32_o); if (installForm is not null) - installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk)} -> {Path.GetFileName(sdk_o)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk32)} -> {Path.GetFileName(sdk32_o)}", InstallationLog.Resource, info: false); } - if (File.Exists(sdk_o)) + if (File.Exists(sdk32_o)) { - Properties.Resources.SDK.Write(sdk); + Properties.Resources.EpicOnlineServices32.Write(sdk32); if (installForm is not null) - installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk)}", InstallationLog.Resource, info: false); + installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk32)}", InstallationLog.Resource, info: false); } if (File.Exists(sdk64) && !File.Exists(sdk64_o)) { @@ -262,14 +262,14 @@ internal partial class InstallForm : CustomForm } if (File.Exists(sdk64_o)) { - Properties.Resources.SDK64.Write(sdk64); + Properties.Resources.EpicOnlineServices64.Write(sdk64); if (installForm is not null) installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); } if (installForm is not null) installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation); - File.Create(sApi).Close(); - StreamWriter writer = new(sApi, true, Encoding.UTF8); + File.Create(config).Close(); + StreamWriter writer = new(config, true, Encoding.UTF8); if (selection.Id != "ParadoxLauncher") WriteScreamConfiguration(writer, selection.SelectedDlc, installForm); foreach (Tuple> extraAppDlc in selection.ExtraDlc) diff --git a/CreamInstaller/MainForm.cs b/CreamInstaller/MainForm.cs index 85c7c65..7e6717c 100644 --- a/CreamInstaller/MainForm.cs +++ b/CreamInstaller/MainForm.cs @@ -60,7 +60,6 @@ internal partial class MainForm : CustomForm GithubPackageResolver resolver = new("pointfeev", "CreamInstaller", "CreamInstaller.zip"); ZipPackageExtractor extractor = new(); updateManager = new(AssemblyMetadata.FromAssembly(Program.EntryAssembly, Program.CurrentProcessFilePath), resolver, extractor); - if (latestVersion is null) { CheckForUpdatesResult checkForUpdatesResult = null; @@ -78,13 +77,7 @@ internal partial class MainForm : CustomForm } catch { } } - - if (latestVersion is null) - { - updateManager.Dispose(); - StartProgram(); - } - else + if (latestVersion is not null) { Size = new(420, 300); label1.Text = $"An update is available: v{latestVersion}"; @@ -117,7 +110,12 @@ internal partial class MainForm : CustomForm } }); } + versions = null; } + updateManager.Dispose(); + updateManager = null; + + StartProgram(); } private void OnLoad(object sender, EventArgs _) diff --git a/CreamInstaller/Program.cs b/CreamInstaller/Program.cs index 17a9648..c8efbf3 100644 --- a/CreamInstaller/Program.cs +++ b/CreamInstaller/Program.cs @@ -58,22 +58,22 @@ internal static class Program return false; } - internal static void GetCreamApiComponents(this string directory, out string api, out string api_o, out string api64, out string api64_o, out string cApi) + internal static void GetCreamApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config) { - api = directory + @"\steam_api.dll"; - api_o = directory + @"\steam_api_o.dll"; - api64 = directory + @"\steam_api64.dll"; - api64_o = directory + @"\steam_api64_o.dll"; - cApi = directory + @"\cream_api.ini"; + sdk32 = directory + @"\steam_api.dll"; + sdk32_o = directory + @"\steam_api_o.dll"; + sdk64 = directory + @"\steam_api64.dll"; + sdk64_o = directory + @"\steam_api64_o.dll"; + config = directory + @"\cream_api.ini"; } - internal static void GetScreamApiComponents(this string directory, out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi) + internal static void GetScreamApiComponents(this string directory, out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config) { - sdk = directory + @"\EOSSDK-Win32-Shipping.dll"; - sdk_o = directory + @"\EOSSDK-Win32-Shipping_o.dll"; + sdk32 = directory + @"\EOSSDK-Win32-Shipping.dll"; + sdk32_o = directory + @"\EOSSDK-Win32-Shipping_o.dll"; sdk64 = directory + @"\EOSSDK-Win64-Shipping.dll"; sdk64_o = directory + @"\EOSSDK-Win64-Shipping_o.dll"; - sApi = directory + @"\ScreamAPI.json"; + config = directory + @"\ScreamAPI.json"; } [STAThread] diff --git a/CreamInstaller/ProgramSelection.cs b/CreamInstaller/ProgramSelection.cs index c39f0f0..ed895a0 100644 --- a/CreamInstaller/ProgramSelection.cs +++ b/CreamInstaller/ProgramSelection.cs @@ -43,19 +43,19 @@ internal class ProgramSelection { foreach (string directory in DllDirectories) { - directory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi); - if (api.IsFilePathLocked() - || api_o.IsFilePathLocked() - || api64.IsFilePathLocked() - || api64_o.IsFilePathLocked() - || cApi.IsFilePathLocked()) - return true; - directory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); - if (sdk.IsFilePathLocked() - || sdk_o.IsFilePathLocked() + directory.GetCreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config); + if (sdk32.IsFilePathLocked() + || sdk32_o.IsFilePathLocked() || sdk64.IsFilePathLocked() || sdk64_o.IsFilePathLocked() - || sApi.IsFilePathLocked()) + || config.IsFilePathLocked()) + return true; + directory.GetScreamApiComponents(out sdk32, out sdk32_o, out sdk64, out sdk64_o, out config); + if (sdk32.IsFilePathLocked() + || sdk32_o.IsFilePathLocked() + || sdk64.IsFilePathLocked() + || sdk64_o.IsFilePathLocked() + || config.IsFilePathLocked()) return true; } return false; diff --git a/CreamInstaller/Properties/Resources.Designer.cs b/CreamInstaller/Properties/Resources.Designer.cs index fc09aec..4689a77 100644 --- a/CreamInstaller/Properties/Resources.Designer.cs +++ b/CreamInstaller/Properties/Resources.Designer.cs @@ -63,9 +63,9 @@ namespace CreamInstaller.Properties { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] API { + internal static byte[] EpicOnlineServices32 { get { - object obj = ResourceManager.GetObject("API", resourceCulture); + object obj = ResourceManager.GetObject("EpicOnlineServices32", resourceCulture); return ((byte[])(obj)); } } @@ -73,9 +73,9 @@ namespace CreamInstaller.Properties { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] API64 { + internal static byte[] EpicOnlineServices64 { get { - object obj = ResourceManager.GetObject("API64", resourceCulture); + object obj = ResourceManager.GetObject("EpicOnlineServices64", resourceCulture); return ((byte[])(obj)); } } @@ -93,9 +93,9 @@ namespace CreamInstaller.Properties { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] SDK { + internal static byte[] Steamworks32 { get { - object obj = ResourceManager.GetObject("SDK", resourceCulture); + object obj = ResourceManager.GetObject("Steamworks32", resourceCulture); return ((byte[])(obj)); } } @@ -103,9 +103,9 @@ namespace CreamInstaller.Properties { /// /// Looks up a localized resource of type System.Byte[]. /// - internal static byte[] SDK64 { + internal static byte[] Steamworks64 { get { - object obj = ResourceManager.GetObject("SDK64", resourceCulture); + object obj = ResourceManager.GetObject("Steamworks64", resourceCulture); return ((byte[])(obj)); } } diff --git a/CreamInstaller/Properties/Resources.resx b/CreamInstaller/Properties/Resources.resx index 76a8f78..4b5dcaf 100644 --- a/CreamInstaller/Properties/Resources.resx +++ b/CreamInstaller/Properties/Resources.resx @@ -118,19 +118,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\resources\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - ..\resources\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - ..\resources\ini.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\EOSSDK-Win32-Shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\resources\creamapi\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\EOSSDK-Win64-Shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\resources\creamapi\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\resources\screamapi\eossdk-win32-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\resources\screamapi\eossdk-win64-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file diff --git a/CreamInstaller/Resources/steam_api.dll b/CreamInstaller/Resources/CreamAPI/steam_api.dll similarity index 100% rename from CreamInstaller/Resources/steam_api.dll rename to CreamInstaller/Resources/CreamAPI/steam_api.dll diff --git a/CreamInstaller/Resources/steam_api64.dll b/CreamInstaller/Resources/CreamAPI/steam_api64.dll similarity index 100% rename from CreamInstaller/Resources/steam_api64.dll rename to CreamInstaller/Resources/CreamAPI/steam_api64.dll diff --git a/CreamInstaller/Resources/EOSSDK-Win32-Shipping.dll b/CreamInstaller/Resources/ScreamAPI/EOSSDK-Win32-Shipping.dll similarity index 100% rename from CreamInstaller/Resources/EOSSDK-Win32-Shipping.dll rename to CreamInstaller/Resources/ScreamAPI/EOSSDK-Win32-Shipping.dll diff --git a/CreamInstaller/Resources/EOSSDK-Win64-Shipping.dll b/CreamInstaller/Resources/ScreamAPI/EOSSDK-Win64-Shipping.dll similarity index 100% rename from CreamInstaller/Resources/EOSSDK-Win64-Shipping.dll rename to CreamInstaller/Resources/ScreamAPI/EOSSDK-Win64-Shipping.dll diff --git a/CreamInstaller/SelectForm.cs b/CreamInstaller/SelectForm.cs index eedb442..fedc020 100644 --- a/CreamInstaller/SelectForm.cs +++ b/CreamInstaller/SelectForm.cs @@ -635,72 +635,68 @@ internal partial class SelectForm : CustomForm new EventHandler(async (sender, e) => { if (!Program.IsProgramRunningDialog(this, selection)) return; - - byte[] cApiIni = null; - byte[] properApi = null; - byte[] properApi64 = null; - - byte[] sApiJson = null; - byte[] properSdk = null; - byte[] properSdk64 = null; - + byte[] creamConfig = null; + byte[] steamOriginalSdk32 = null; + byte[] steamOriginalSdk64 = null; + byte[] screamConfig = null; + byte[] epicOriginalSdk32 = null; + byte[] epicOriginalSdk64 = null; foreach (string directory in selection.DllDirectories) { - directory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi); - if (cApiIni is null && File.Exists(cApi)) - cApiIni = File.ReadAllBytes(cApi); + directory.GetCreamApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config); + if (creamConfig is null && File.Exists(config)) + creamConfig = File.ReadAllBytes(config); await InstallForm.UninstallCreamAPI(directory); - if (properApi is null && File.Exists(api) && !Properties.Resources.API.EqualsFile(api)) - properApi = File.ReadAllBytes(api); - if (properApi64 is null && File.Exists(api64) && !Properties.Resources.API64.EqualsFile(api64)) - properApi64 = File.ReadAllBytes(api64); - - directory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); - if (sApiJson is null && File.Exists(sApi)) - sApiJson = File.ReadAllBytes(sApi); + if (steamOriginalSdk32 is null && File.Exists(sdk32) && !Properties.Resources.Steamworks32.EqualsFile(sdk32)) + steamOriginalSdk32 = File.ReadAllBytes(sdk32); + if (steamOriginalSdk64 is null && File.Exists(sdk64) && !Properties.Resources.Steamworks64.EqualsFile(sdk64)) + steamOriginalSdk64 = File.ReadAllBytes(sdk64); + directory.GetScreamApiComponents(out sdk32, out string _, out sdk64, out string _, out config); + if (screamConfig is null && File.Exists(config)) + screamConfig = File.ReadAllBytes(config); await InstallForm.UninstallScreamAPI(directory); - if (properSdk is null && File.Exists(sdk) && !Properties.Resources.SDK.EqualsFile(sdk)) - properSdk = File.ReadAllBytes(sdk); - if (properSdk64 is null && File.Exists(sdk64) && !Properties.Resources.SDK64.EqualsFile(sdk64)) - properSdk64 = File.ReadAllBytes(sdk64); + if (epicOriginalSdk32 is null && File.Exists(sdk32) && !Properties.Resources.EpicOnlineServices32.EqualsFile(sdk32)) + epicOriginalSdk32 = File.ReadAllBytes(sdk32); + if (epicOriginalSdk64 is null && File.Exists(sdk64) && !Properties.Resources.EpicOnlineServices64.EqualsFile(sdk64)) + epicOriginalSdk64 = File.ReadAllBytes(sdk64); } - if (properApi is not null || properApi64 is not null || properSdk is not null || properSdk64 is not null) + if (steamOriginalSdk32 is not null || steamOriginalSdk64 is not null || epicOriginalSdk32 is not null || epicOriginalSdk64 is not null) { bool neededRepair = false; foreach (string directory in selection.DllDirectories) { - directory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi); - if (properApi is not null && Properties.Resources.API.EqualsFile(api)) + directory.GetCreamApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config); + if (steamOriginalSdk32 is not null && Properties.Resources.Steamworks32.EqualsFile(sdk32)) { - properApi.Write(api); + steamOriginalSdk32.Write(sdk32); neededRepair = true; } - if (properApi64 is not null && Properties.Resources.API64.EqualsFile(api64)) + if (steamOriginalSdk64 is not null && Properties.Resources.Steamworks64.EqualsFile(sdk64)) { - properApi64.Write(api64); + steamOriginalSdk64.Write(sdk64); neededRepair = true; } - if (cApiIni is not null) + if (creamConfig is not null) { await InstallForm.InstallCreamAPI(directory, selection); - cApiIni.Write(cApi); + creamConfig.Write(config); } - directory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); - if (properSdk is not null && Properties.Resources.SDK.EqualsFile(sdk)) + directory.GetScreamApiComponents(out sdk32, out string _, out sdk64, out string _, out config); + if (epicOriginalSdk32 is not null && Properties.Resources.EpicOnlineServices32.EqualsFile(sdk32)) { - properSdk.Write(sdk); + epicOriginalSdk32.Write(sdk32); neededRepair = true; } - if (properSdk64 is not null && Properties.Resources.SDK64.EqualsFile(sdk64)) + if (epicOriginalSdk64 is not null && Properties.Resources.EpicOnlineServices64.EqualsFile(sdk64)) { - properSdk64.Write(sdk64); + epicOriginalSdk64.Write(sdk64); neededRepair = true; } - if (sApiJson is not null) + if (screamConfig is not null) { await InstallForm.InstallScreamAPI(directory, selection); - sApiJson.Write(sApi); + screamConfig.Write(config); } } if (neededRepair) diff --git a/CreamInstaller/Utility/HttpClientManager.cs b/CreamInstaller/Utility/HttpClientManager.cs index 91e1824..6fb769d 100644 --- a/CreamInstaller/Utility/HttpClientManager.cs +++ b/CreamInstaller/Utility/HttpClientManager.cs @@ -41,6 +41,8 @@ internal static class HttpClientManager internal static async Task GetDocumentNodes(string url, string xpath) => (await EnsureGet(url))?.ToHtmlDocument()?.DocumentNode?.SelectNodes(xpath); + internal static HtmlNodeCollection GetDocumentNodes(this HtmlAgilityPack.HtmlDocument htmlDocument, string xpath) => htmlDocument.DocumentNode?.SelectNodes(xpath); + internal static async Task GetImageFromUrl(string url) { try