optimize resources

This commit is contained in:
pointfeev 2022-03-07 14:40:48 -05:00
parent 303778a6fd
commit 2dd4c482ef
14 changed files with 138 additions and 152 deletions

View file

@ -5,7 +5,7 @@
<UseWindowsForms>True</UseWindowsForms> <UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon> <ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract> <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<Version>3.2.0.4</Version> <Version>3.2.0.5</Version>
<PackageIcon>Resources\ini.ico</PackageIcon> <PackageIcon>Resources\ini.ico</PackageIcon>
<PackageIconUrl /> <PackageIconUrl />
<Description /> <Description />
@ -31,16 +31,6 @@
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="Resources\ini.ico" />
<None Remove="Resources\steam_api.dll" />
<None Remove="Resources\steam_api64.dll" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\ini.ico" />
<EmbeddedResource Include="Resources\steam_api.dll" />
<EmbeddedResource Include="Resources\steam_api64.dll" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Gameloop.Vdf" Version="0.6.1" /> <PackageReference Include="Gameloop.Vdf" Version="0.6.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.42" /> <PackageReference Include="HtmlAgilityPack" Version="1.11.42" />

View file

@ -50,12 +50,12 @@ internal static class EpicLibrary
{ {
List<string> dllDirectories = new(); List<string> dllDirectories = new();
if (Program.Canceled || !Directory.Exists(gameDirectory)) return null; 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); gameDirectory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
if (File.Exists(sdk) if (File.Exists(sdk32)
|| File.Exists(sdk_o) || File.Exists(sdk32_o)
|| File.Exists(sdk64) || File.Exists(sdk64)
|| File.Exists(sdk64_o) || File.Exists(sdk64_o)
|| File.Exists(sApi)) || File.Exists(config))
dllDirectories.Add(gameDirectory); dllDirectories.Add(gameDirectory);
string[] directories = Directory.GetDirectories(gameDirectory); string[] directories = Directory.GetDirectories(gameDirectory);
foreach (string _directory in directories) foreach (string _directory in directories)

View file

@ -74,70 +74,70 @@ internal partial class InstallForm : CustomForm
internal static async Task UninstallCreamAPI(string directory, InstallForm installForm = null) => await Task.Run(() => 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); directory.GetCreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
if (File.Exists(api_o)) if (File.Exists(sdk32_o))
{ {
if (File.Exists(api)) if (File.Exists(sdk32))
{ {
File.Delete(api); File.Delete(sdk32);
if (installForm is not null) 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) 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) 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) 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) 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(() => 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); directory.GetCreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
if (File.Exists(api) && !File.Exists(api_o)) if (File.Exists(sdk32) && !File.Exists(sdk32_o))
{ {
File.Move(api, api_o); File.Move(sdk32, sdk32_o);
if (installForm is not null) 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) 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) 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) 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) if (installForm is not null)
installForm.UpdateUser("Generating CreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation); installForm.UpdateUser("Generating CreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
File.Create(cApi).Close(); File.Create(config).Close();
StreamWriter writer = new(cApi, true, Encoding.UTF8); StreamWriter writer = new(config, true, Encoding.UTF8);
if (selection.Id != "ParadoxLauncher") if (selection.Id != "ParadoxLauncher")
WriteCreamConfiguration(writer, selection.Id, selection.Name, selection.SelectedDlc, installForm); WriteCreamConfiguration(writer, selection.Id, selection.Name, selection.SelectedDlc, installForm);
foreach (Tuple<string, string, SortedList<string, (DlcType type, string name, string icon)>> extraAppDlc in selection.ExtraDlc) foreach (Tuple<string, string, SortedList<string, (DlcType type, string name, string icon)>> 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(() => 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); directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
if (File.Exists(sdk_o)) if (File.Exists(sdk32_o))
{ {
if (File.Exists(sdk)) if (File.Exists(sdk32))
{ {
File.Delete(sdk); File.Delete(sdk32);
if (installForm is not null) 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) 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)) if (File.Exists(sdk64_o))
{ {
@ -231,28 +231,28 @@ internal partial class InstallForm : CustomForm
if (installForm is not null) if (installForm is not null)
installForm.UpdateUser($"Renamed file: {Path.GetFileName(sdk64_o)} -> {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); 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) 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(() => 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); directory.GetScreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
if (File.Exists(sdk) && !File.Exists(sdk_o)) if (File.Exists(sdk32) && !File.Exists(sdk32_o))
{ {
File.Move(sdk, sdk_o); File.Move(sdk32, sdk32_o);
if (installForm is not null) 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) 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)) if (File.Exists(sdk64) && !File.Exists(sdk64_o))
{ {
@ -262,14 +262,14 @@ internal partial class InstallForm : CustomForm
} }
if (File.Exists(sdk64_o)) if (File.Exists(sdk64_o))
{ {
Properties.Resources.SDK64.Write(sdk64); Properties.Resources.EpicOnlineServices64.Write(sdk64);
if (installForm is not null) if (installForm is not null)
installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false); installForm.UpdateUser($"Wrote resource to file: {Path.GetFileName(sdk64)}", InstallationLog.Resource, info: false);
} }
if (installForm is not null) if (installForm is not null)
installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation); installForm.UpdateUser("Generating ScreamAPI configuration for " + selection.Name + $" in directory \"{directory}\" . . . ", InstallationLog.Operation);
File.Create(sApi).Close(); File.Create(config).Close();
StreamWriter writer = new(sApi, true, Encoding.UTF8); StreamWriter writer = new(config, true, Encoding.UTF8);
if (selection.Id != "ParadoxLauncher") if (selection.Id != "ParadoxLauncher")
WriteScreamConfiguration(writer, selection.SelectedDlc, installForm); WriteScreamConfiguration(writer, selection.SelectedDlc, installForm);
foreach (Tuple<string, string, SortedList<string, (DlcType type, string name, string icon)>> extraAppDlc in selection.ExtraDlc) foreach (Tuple<string, string, SortedList<string, (DlcType type, string name, string icon)>> extraAppDlc in selection.ExtraDlc)

View file

@ -60,7 +60,6 @@ internal partial class MainForm : CustomForm
GithubPackageResolver resolver = new("pointfeev", "CreamInstaller", "CreamInstaller.zip"); GithubPackageResolver resolver = new("pointfeev", "CreamInstaller", "CreamInstaller.zip");
ZipPackageExtractor extractor = new(); ZipPackageExtractor extractor = new();
updateManager = new(AssemblyMetadata.FromAssembly(Program.EntryAssembly, Program.CurrentProcessFilePath), resolver, extractor); updateManager = new(AssemblyMetadata.FromAssembly(Program.EntryAssembly, Program.CurrentProcessFilePath), resolver, extractor);
if (latestVersion is null) if (latestVersion is null)
{ {
CheckForUpdatesResult checkForUpdatesResult = null; CheckForUpdatesResult checkForUpdatesResult = null;
@ -78,13 +77,7 @@ internal partial class MainForm : CustomForm
} }
catch { } catch { }
} }
if (latestVersion is not null)
if (latestVersion is null)
{
updateManager.Dispose();
StartProgram();
}
else
{ {
Size = new(420, 300); Size = new(420, 300);
label1.Text = $"An update is available: v{latestVersion}"; 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 _) private void OnLoad(object sender, EventArgs _)

View file

@ -58,22 +58,22 @@ internal static class Program
return false; 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"; sdk32 = directory + @"\steam_api.dll";
api_o = directory + @"\steam_api_o.dll"; sdk32_o = directory + @"\steam_api_o.dll";
api64 = directory + @"\steam_api64.dll"; sdk64 = directory + @"\steam_api64.dll";
api64_o = directory + @"\steam_api64_o.dll"; sdk64_o = directory + @"\steam_api64_o.dll";
cApi = directory + @"\cream_api.ini"; 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"; sdk32 = directory + @"\EOSSDK-Win32-Shipping.dll";
sdk_o = directory + @"\EOSSDK-Win32-Shipping_o.dll"; sdk32_o = directory + @"\EOSSDK-Win32-Shipping_o.dll";
sdk64 = directory + @"\EOSSDK-Win64-Shipping.dll"; sdk64 = directory + @"\EOSSDK-Win64-Shipping.dll";
sdk64_o = directory + @"\EOSSDK-Win64-Shipping_o.dll"; sdk64_o = directory + @"\EOSSDK-Win64-Shipping_o.dll";
sApi = directory + @"\ScreamAPI.json"; config = directory + @"\ScreamAPI.json";
} }
[STAThread] [STAThread]

View file

@ -43,19 +43,19 @@ internal class ProgramSelection
{ {
foreach (string directory in DllDirectories) foreach (string directory in DllDirectories)
{ {
directory.GetCreamApiComponents(out string api, out string api_o, out string api64, out string api64_o, out string cApi); directory.GetCreamApiComponents(out string sdk32, out string sdk32_o, out string sdk64, out string sdk64_o, out string config);
if (api.IsFilePathLocked() if (sdk32.IsFilePathLocked()
|| api_o.IsFilePathLocked() || sdk32_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()
|| sdk64.IsFilePathLocked() || sdk64.IsFilePathLocked()
|| sdk64_o.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 true;
} }
return false; return false;

View file

@ -63,9 +63,9 @@ namespace CreamInstaller.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Byte[]. /// Looks up a localized resource of type System.Byte[].
/// </summary> /// </summary>
internal static byte[] API { internal static byte[] EpicOnlineServices32 {
get { get {
object obj = ResourceManager.GetObject("API", resourceCulture); object obj = ResourceManager.GetObject("EpicOnlineServices32", resourceCulture);
return ((byte[])(obj)); return ((byte[])(obj));
} }
} }
@ -73,9 +73,9 @@ namespace CreamInstaller.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Byte[]. /// Looks up a localized resource of type System.Byte[].
/// </summary> /// </summary>
internal static byte[] API64 { internal static byte[] EpicOnlineServices64 {
get { get {
object obj = ResourceManager.GetObject("API64", resourceCulture); object obj = ResourceManager.GetObject("EpicOnlineServices64", resourceCulture);
return ((byte[])(obj)); return ((byte[])(obj));
} }
} }
@ -93,9 +93,9 @@ namespace CreamInstaller.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Byte[]. /// Looks up a localized resource of type System.Byte[].
/// </summary> /// </summary>
internal static byte[] SDK { internal static byte[] Steamworks32 {
get { get {
object obj = ResourceManager.GetObject("SDK", resourceCulture); object obj = ResourceManager.GetObject("Steamworks32", resourceCulture);
return ((byte[])(obj)); return ((byte[])(obj));
} }
} }
@ -103,9 +103,9 @@ namespace CreamInstaller.Properties {
/// <summary> /// <summary>
/// Looks up a localized resource of type System.Byte[]. /// Looks up a localized resource of type System.Byte[].
/// </summary> /// </summary>
internal static byte[] SDK64 { internal static byte[] Steamworks64 {
get { get {
object obj = ResourceManager.GetObject("SDK64", resourceCulture); object obj = ResourceManager.GetObject("Steamworks64", resourceCulture);
return ((byte[])(obj)); return ((byte[])(obj));
} }
} }

View file

@ -118,19 +118,19 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="API" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="API64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\ini.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value> <value>..\resources\ini.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="SDK" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Steamworks32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\EOSSDK-Win32-Shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\resources\creamapi\steam_api.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
<data name="SDK64" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Steamworks64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\EOSSDK-Win64-Shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>..\resources\creamapi\steam_api64.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="EpicOnlineServices32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\screamapi\eossdk-win32-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="EpicOnlineServices64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\screamapi\eossdk-win64-shipping.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data> </data>
</root> </root>

View file

@ -635,72 +635,68 @@ internal partial class SelectForm : CustomForm
new EventHandler(async (sender, e) => new EventHandler(async (sender, e) =>
{ {
if (!Program.IsProgramRunningDialog(this, selection)) return; if (!Program.IsProgramRunningDialog(this, selection)) return;
byte[] creamConfig = null;
byte[] cApiIni = null; byte[] steamOriginalSdk32 = null;
byte[] properApi = null; byte[] steamOriginalSdk64 = null;
byte[] properApi64 = null; byte[] screamConfig = null;
byte[] epicOriginalSdk32 = null;
byte[] sApiJson = null; byte[] epicOriginalSdk64 = null;
byte[] properSdk = null;
byte[] properSdk64 = null;
foreach (string directory in selection.DllDirectories) 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); directory.GetCreamApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config);
if (cApiIni is null && File.Exists(cApi)) if (creamConfig is null && File.Exists(config))
cApiIni = File.ReadAllBytes(cApi); creamConfig = File.ReadAllBytes(config);
await InstallForm.UninstallCreamAPI(directory); await InstallForm.UninstallCreamAPI(directory);
if (properApi is null && File.Exists(api) && !Properties.Resources.API.EqualsFile(api)) if (steamOriginalSdk32 is null && File.Exists(sdk32) && !Properties.Resources.Steamworks32.EqualsFile(sdk32))
properApi = File.ReadAllBytes(api); steamOriginalSdk32 = File.ReadAllBytes(sdk32);
if (properApi64 is null && File.Exists(api64) && !Properties.Resources.API64.EqualsFile(api64)) if (steamOriginalSdk64 is null && File.Exists(sdk64) && !Properties.Resources.Steamworks64.EqualsFile(sdk64))
properApi64 = File.ReadAllBytes(api64); steamOriginalSdk64 = File.ReadAllBytes(sdk64);
directory.GetScreamApiComponents(out sdk32, out string _, out sdk64, out string _, out config);
directory.GetScreamApiComponents(out string sdk, out string sdk_o, out string sdk64, out string sdk64_o, out string sApi); if (screamConfig is null && File.Exists(config))
if (sApiJson is null && File.Exists(sApi)) screamConfig = File.ReadAllBytes(config);
sApiJson = File.ReadAllBytes(sApi);
await InstallForm.UninstallScreamAPI(directory); await InstallForm.UninstallScreamAPI(directory);
if (properSdk is null && File.Exists(sdk) && !Properties.Resources.SDK.EqualsFile(sdk)) if (epicOriginalSdk32 is null && File.Exists(sdk32) && !Properties.Resources.EpicOnlineServices32.EqualsFile(sdk32))
properSdk = File.ReadAllBytes(sdk); epicOriginalSdk32 = File.ReadAllBytes(sdk32);
if (properSdk64 is null && File.Exists(sdk64) && !Properties.Resources.SDK64.EqualsFile(sdk64)) if (epicOriginalSdk64 is null && File.Exists(sdk64) && !Properties.Resources.EpicOnlineServices64.EqualsFile(sdk64))
properSdk64 = File.ReadAllBytes(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; bool neededRepair = false;
foreach (string directory in selection.DllDirectories) 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); directory.GetCreamApiComponents(out string sdk32, out string _, out string sdk64, out string _, out string config);
if (properApi is not null && Properties.Resources.API.EqualsFile(api)) if (steamOriginalSdk32 is not null && Properties.Resources.Steamworks32.EqualsFile(sdk32))
{ {
properApi.Write(api); steamOriginalSdk32.Write(sdk32);
neededRepair = true; 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; neededRepair = true;
} }
if (cApiIni is not null) if (creamConfig is not null)
{ {
await InstallForm.InstallCreamAPI(directory, selection); 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); directory.GetScreamApiComponents(out sdk32, out string _, out sdk64, out string _, out config);
if (properSdk is not null && Properties.Resources.SDK.EqualsFile(sdk)) if (epicOriginalSdk32 is not null && Properties.Resources.EpicOnlineServices32.EqualsFile(sdk32))
{ {
properSdk.Write(sdk); epicOriginalSdk32.Write(sdk32);
neededRepair = true; 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; neededRepair = true;
} }
if (sApiJson is not null) if (screamConfig is not null)
{ {
await InstallForm.InstallScreamAPI(directory, selection); await InstallForm.InstallScreamAPI(directory, selection);
sApiJson.Write(sApi); screamConfig.Write(config);
} }
} }
if (neededRepair) if (neededRepair)

View file

@ -41,6 +41,8 @@ internal static class HttpClientManager
internal static async Task<HtmlNodeCollection> GetDocumentNodes(string url, string xpath) => (await EnsureGet(url))?.ToHtmlDocument()?.DocumentNode?.SelectNodes(xpath); internal static async Task<HtmlNodeCollection> 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<Image> GetImageFromUrl(string url) internal static async Task<Image> GetImageFromUrl(string url)
{ {
try try