v4.8.1
- Removed unused HttpAgilityPack reference - Minor update functionality improvements - Removed revision from version numbers - Fixed HttpClient UserAgent header - Added HttpClient AcceptLanguage header with the current culture (should fix random incorrect language) - Fixed Koaloader DLL text not showing ".dll" for custom selections - Another conversion to LibraryImport from DllImport
This commit is contained in:
parent
96a6af3c18
commit
98748a4b4c
7 changed files with 26 additions and 28 deletions
|
@ -2,22 +2,14 @@
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CreamInstaller.Forms;
|
using CreamInstaller.Forms;
|
||||||
|
using CreamInstaller.Utility;
|
||||||
|
|
||||||
namespace CreamInstaller.Components;
|
namespace CreamInstaller.Components;
|
||||||
|
|
||||||
internal class CustomForm : Form
|
internal class CustomForm : Form
|
||||||
{
|
{
|
||||||
internal const short SWP_NOACTIVATE = 0x0010;
|
|
||||||
internal const short SWP_SHOWWINDOW = 0x0040;
|
|
||||||
internal const short SWP_NOMOVE = 0x0002;
|
|
||||||
internal const short SWP_NOSIZE = 0x0001;
|
|
||||||
|
|
||||||
internal static readonly nint HWND_NOTOPMOST = new(-2);
|
|
||||||
internal static readonly nint HWND_TOPMOST = new(-1);
|
|
||||||
|
|
||||||
internal CustomForm()
|
internal CustomForm()
|
||||||
{
|
{
|
||||||
Icon = Properties.Resources.Icon;
|
Icon = Properties.Resources.Icon;
|
||||||
|
@ -54,7 +46,7 @@ internal class CustomForm : Form
|
||||||
{
|
{
|
||||||
using DialogForm helpDialog = new(this);
|
using DialogForm helpDialog = new(this);
|
||||||
helpDialog.HelpButton = false;
|
helpDialog.HelpButton = false;
|
||||||
string acidicoala = "https://github.com/acidicoala";
|
const string acidicoala = "https://github.com/acidicoala";
|
||||||
string repository = $"https://github.com/{Program.RepositoryOwner}/{Program.RepositoryName}";
|
string repository = $"https://github.com/{Program.RepositoryOwner}/{Program.RepositoryName}";
|
||||||
_ = helpDialog.Show(SystemIcons.Information,
|
_ = helpDialog.Show(SystemIcons.Information,
|
||||||
"Automatically finds all installed Steam, Epic and Ubisoft games with their respective DLC-related DLL locations on the user's computer,\n"
|
"Automatically finds all installed Steam, Epic and Ubisoft games with their respective DLC-related DLL locations on the user's computer,\n"
|
||||||
|
@ -86,15 +78,14 @@ internal class CustomForm : Form
|
||||||
|
|
||||||
private void OnActivation(object sender, EventArgs args) => Activate();
|
private void OnActivation(object sender, EventArgs args) => Activate();
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Unicode), DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
|
||||||
private static extern void SetWindowPos(nint hWnd, nint hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
|
|
||||||
|
|
||||||
internal void BringToFrontWithoutActivation()
|
internal void BringToFrontWithoutActivation()
|
||||||
{
|
{
|
||||||
bool topMost = TopMost;
|
bool topMost = TopMost;
|
||||||
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
NativeImports.SetWindowPos(Handle, NativeImports.HWND_TOPMOST, 0, 0, 0, 0,
|
||||||
|
NativeImports.SWP_NOACTIVATE | NativeImports.SWP_SHOWWINDOW | NativeImports.SWP_NOMOVE | NativeImports.SWP_NOSIZE);
|
||||||
if (!topMost)
|
if (!topMost)
|
||||||
SetWindowPos(Handle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE);
|
NativeImports.SetWindowPos(Handle, NativeImports.HWND_NOTOPMOST, 0, 0, 0, 0,
|
||||||
|
NativeImports.SWP_NOACTIVATE | NativeImports.SWP_SHOWWINDOW | NativeImports.SWP_NOMOVE | NativeImports.SWP_NOSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void InheritLocation(Form fromForm)
|
internal void InheritLocation(Form fromForm)
|
||||||
|
|
|
@ -145,7 +145,7 @@ internal sealed class CustomTreeView : TreeView
|
||||||
{
|
{
|
||||||
comboBoxFont ??= new(font.FontFamily, 6, font.Style, font.Unit, font.GdiCharSet, font.GdiVerticalFont);
|
comboBoxFont ??= new(font.FontFamily, 6, font.Style, font.Unit, font.GdiCharSet, font.GdiVerticalFont);
|
||||||
ComboBoxState comboBoxState = Enabled ? ComboBoxState.Normal : ComboBoxState.Disabled;
|
ComboBoxState comboBoxState = Enabled ? ComboBoxState.Normal : ComboBoxState.Disabled;
|
||||||
text = selection.KoaloaderProxy ?? ProgramSelection.DefaultKoaloaderProxy + ".dll";
|
text = (selection.KoaloaderProxy ?? ProgramSelection.DefaultKoaloaderProxy) + ".dll";
|
||||||
size = TextRenderer.MeasureText(graphics, text, comboBoxFont) + new Size(6, 0);
|
size = TextRenderer.MeasureText(graphics, text, comboBoxFont) + new Size(6, 0);
|
||||||
const int padding = 2;
|
const int padding = 2;
|
||||||
bounds = new(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds.Height - padding);
|
bounds = new(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds.Height - padding);
|
||||||
|
|
|
@ -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.8.1.0</Version>
|
<Version>4.8.1</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>
|
||||||
|
@ -145,8 +145,8 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Gameloop.Vdf" Version="0.6.2" />
|
<PackageReference Include="Gameloop.Vdf" Version="0.6.2" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="System.ServiceModel.Primitives" Version="4.10.0" />
|
<PackageReference Include="System.ServiceModel.Primitives" Version="4.10.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Forms\SelectDialogForm.cs">
|
<Compile Update="Forms\SelectDialogForm.cs">
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CreamInstaller.Utility;
|
using CreamInstaller.Utility;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using static CreamInstaller.Resources.Resources;
|
using static CreamInstaller.Resources.Resources;
|
||||||
|
|
||||||
namespace CreamInstaller.Platforms.Epic;
|
namespace CreamInstaller.Platforms.Epic;
|
||||||
|
@ -44,7 +44,7 @@ internal static class EpicLibrary
|
||||||
string json = file.ReadFile();
|
string json = file.ReadFile();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Manifest manifest = JsonSerializer.Deserialize<Manifest>(json);
|
Manifest manifest = JsonConvert.DeserializeObject<Manifest>(json);
|
||||||
if (manifest is not null && manifest.CatalogItemId == manifest.MainGameCatalogItemId && !games.Any(g
|
if (manifest is not null && manifest.CatalogItemId == manifest.MainGameCatalogItemId && !games.Any(g
|
||||||
=> g.CatalogItemId == manifest.CatalogItemId && g.InstallLocation == manifest.InstallLocation))
|
=> g.CatalogItemId == manifest.CatalogItemId && g.InstallLocation == manifest.InstallLocation))
|
||||||
games.Add(manifest);
|
games.Add(manifest);
|
||||||
|
|
|
@ -298,10 +298,4 @@ internal static class SteamCMD
|
||||||
foreach (Task task in tasks)
|
foreach (Task task in tasks)
|
||||||
await task;
|
await task;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void Dispose()
|
|
||||||
{
|
|
||||||
Kill().Wait();
|
|
||||||
DirectoryPath.DeleteDirectory();
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Globalization;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -19,7 +20,8 @@ internal static class HttpClientManager
|
||||||
internal static void Setup()
|
internal static void Setup()
|
||||||
{
|
{
|
||||||
HttpClient = new();
|
HttpClient = new();
|
||||||
HttpClient.DefaultRequestHeaders.Add("User-Agent", $"CI{Program.Version.Replace(".", "")}");
|
HttpClient.DefaultRequestHeaders.UserAgent.Add(new(Program.Name, Program.Version));
|
||||||
|
HttpClient.DefaultRequestHeaders.AcceptLanguage.Add(new(CultureInfo.CurrentCulture.ToString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static async Task<string> EnsureGet(string url)
|
internal static async Task<string> EnsureGet(string url)
|
||||||
|
|
|
@ -5,7 +5,18 @@ namespace CreamInstaller.Utility;
|
||||||
|
|
||||||
internal static partial class NativeImports
|
internal static partial class NativeImports
|
||||||
{
|
{
|
||||||
|
internal const short SWP_NOACTIVATE = 0x0010;
|
||||||
|
internal const short SWP_SHOWWINDOW = 0x0040;
|
||||||
|
internal const short SWP_NOMOVE = 0x0002;
|
||||||
|
internal const short SWP_NOSIZE = 0x0001;
|
||||||
|
|
||||||
|
internal static readonly nint HWND_NOTOPMOST = new(-2);
|
||||||
|
internal static readonly nint HWND_TOPMOST = new(-1);
|
||||||
|
|
||||||
[LibraryImport("kernel32.dll", SetLastError = true), DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
[LibraryImport("kernel32.dll", SetLastError = true), DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
internal static partial bool GetBinaryType([MarshalAs(UnmanagedType.LPStr)] string lpApplicationName, out BinaryType lpBinaryType);
|
internal static partial bool GetBinaryType([MarshalAs(UnmanagedType.LPStr)] string lpApplicationName, out BinaryType lpBinaryType);
|
||||||
|
|
||||||
|
[LibraryImport("user32.dll", SetLastError = true), DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||||
|
internal static partial void SetWindowPos(nint hWnd, nint hWndInsertAfter, int x, int y, int cx, int cy, uint uFlags);
|
||||||
}
|
}
|
Loading…
Reference in a new issue