- 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:
pointfeev 2023-04-06 21:40:10 -04:00
parent 96a6af3c18
commit 98748a4b4c
7 changed files with 26 additions and 28 deletions

View file

@ -2,22 +2,14 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using CreamInstaller.Forms;
using CreamInstaller.Utility;
namespace CreamInstaller.Components;
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()
{
Icon = Properties.Resources.Icon;
@ -54,7 +46,7 @@ internal class CustomForm : Form
{
using DialogForm helpDialog = new(this);
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}";
_ = 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"
@ -86,15 +78,14 @@ internal class CustomForm : Form
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()
{
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)
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)

View file

@ -145,7 +145,7 @@ internal sealed class CustomTreeView : TreeView
{
comboBoxFont ??= new(font.FontFamily, 6, font.Style, font.Unit, font.GdiCharSet, font.GdiVerticalFont);
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);
const int padding = 2;
bounds = new(bounds.X + bounds.Width, bounds.Y + padding / 2, size.Width, bounds.Height - padding);

View file

@ -4,7 +4,7 @@
<TargetFramework>net7.0-windows</TargetFramework>
<UseWindowsForms>True</UseWindowsForms>
<ApplicationIcon>Resources\ini.ico</ApplicationIcon>
<Version>4.8.1.0</Version>
<Version>4.8.1</Version>
<Copyright>2021, pointfeev (https://github.com/pointfeev)</Copyright>
<Company>CreamInstaller</Company>
<Product>Automatic DLC Unlocker Installer &amp; Configuration Generator</Product>
@ -145,8 +145,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Gameloop.Vdf" Version="0.6.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.10.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ServiceModel.Primitives" Version="4.10.2" />
</ItemGroup>
<ItemGroup>
<Compile Update="Forms\SelectDialogForm.cs">

View file

@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using System.Threading.Tasks;
using CreamInstaller.Utility;
using Microsoft.Win32;
using Newtonsoft.Json;
using static CreamInstaller.Resources.Resources;
namespace CreamInstaller.Platforms.Epic;
@ -44,7 +44,7 @@ internal static class EpicLibrary
string json = file.ReadFile();
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
=> g.CatalogItemId == manifest.CatalogItemId && g.InstallLocation == manifest.InstallLocation))
games.Add(manifest);

View file

@ -298,10 +298,4 @@ internal static class SteamCMD
foreach (Task task in tasks)
await task;
}
internal static void Dispose()
{
Kill().Wait();
DirectoryPath.DeleteDirectory();
}
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
@ -19,7 +20,8 @@ internal static class HttpClientManager
internal static void Setup()
{
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)

View file

@ -5,7 +5,18 @@ namespace CreamInstaller.Utility;
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)]
[return: MarshalAs(UnmanagedType.Bool)]
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);
}