Skip to content

Commit ffee092

Browse files
committed
Adjust Hi3Helper.Win32 changes
1 parent 5cbe8c9 commit ffee092

File tree

13 files changed

+32
-32
lines changed

13 files changed

+32
-32
lines changed

CollapseLauncher/Classes/FileMigrationProcess/FileMigrationProcess.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using Hi3Helper;
55
using Hi3Helper.Shared.Region;
66
using Hi3Helper.Win32.ManagedTools;
7-
using Hi3Helper.Win32.Native.ManagedTools;
87
using Microsoft.UI.Dispatching;
98
using System;
109
using System.Collections.Generic;

CollapseLauncher/Classes/GamePresetProperty.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
using CollapseLauncher.InstallManager.Zenless;
1212
using CollapseLauncher.Interfaces;
1313
using Hi3Helper.SentryHelper;
14+
using Hi3Helper.Win32.ManagedTools;
1415
using Hi3Helper.Win32.Native.Enums;
15-
using Hi3Helper.Win32.Native.ManagedTools;
16-
using Hi3Helper;
1716
using Microsoft.Extensions.Logging;
1817
using Microsoft.UI.Xaml;
1918
using System;

CollapseLauncher/Classes/Helper/WindowUtility.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
using Hi3Helper.SentryHelper;
66
using Hi3Helper.Shared.Region;
77
using Hi3Helper.Win32.FileDialogCOM;
8+
using Hi3Helper.Win32.ManagedTools;
89
using Hi3Helper.Win32.Native.Enums;
910
using Hi3Helper.Win32.Native.LibraryImport;
10-
using Hi3Helper.Win32.Native.ManagedTools;
1111
using Hi3Helper.Win32.Native.Structs;
1212
using Hi3Helper.Win32.Screen;
1313
using Hi3Helper.Win32.TaskbarListCOM;

CollapseLauncher/Classes/RepairManagement/Genshin/Check.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Hi3Helper.Data;
44
using Hi3Helper.EncTool.Parser.AssetIndex;
55
using Hi3Helper.SentryHelper;
6-
using Hi3Helper.Win32.Native.ManagedTools;
6+
using Hi3Helper.Win32.ManagedTools;
77
using System;
88
using System.Buffers;
99
using System.Collections.Generic;

CollapseLauncher/Program.cs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using Hi3Helper.Http.Legacy;
77
using Hi3Helper.SentryHelper;
88
using Hi3Helper.Shared.ClassStruct;
9+
using Hi3Helper.Win32.ManagedTools;
910
using Hi3Helper.Win32.Native.LibraryImport;
10-
using Hi3Helper.Win32.Native.ManagedTools;
1111
using InnoSetupHelper;
1212
using Microsoft.UI.Dispatching;
1313
using Microsoft.UI.Xaml;
@@ -69,12 +69,14 @@ public static void Main(params string[] args)
6969
{
7070
// Extract icons from the executable file
7171
string mainModulePath = AppExecutablePath;
72-
var iconCount = PInvoke.ExtractIconEx(mainModulePath, -1, null, null, 0);
72+
uint iconCount = PInvoke.ExtractIconEx(mainModulePath, -1, nint.Zero, nint.Zero, 0);
7373
if (iconCount > 0)
7474
{
75-
var largeIcons = new IntPtr[1];
76-
var smallIcons = new IntPtr[1];
77-
PInvoke.ExtractIconEx(mainModulePath, 0, largeIcons, smallIcons, 1);
75+
IntPtr[] largeIcons = new IntPtr[1];
76+
IntPtr[] smallIcons = new IntPtr[1];
77+
nint largeIconsArrayP = Marshal.UnsafeAddrOfPinnedArrayElement(largeIcons, 0);
78+
nint smallIconsArrayP = Marshal.UnsafeAddrOfPinnedArrayElement(smallIcons, 0);
79+
PInvoke.ExtractIconEx(mainModulePath, 0, largeIconsArrayP, smallIconsArrayP, 1);
7880
AppIconLarge = largeIcons[0];
7981
AppIconSmall = smallIcons[0];
8082
}
@@ -83,7 +85,7 @@ public static void Main(params string[] args)
8385
VelopackLocatorExtension.StartUpdaterHook(AppAumid);
8486

8587
InitAppPreset();
86-
var logPath = AppGameLogsFolder;
88+
string logPath = AppGameLogsFolder;
8789
CurrentLogger = IsConsoleEnabled
8890
? new LoggerConsole(logPath, Encoding.UTF8)
8991
: new LoggerNull(logPath, Encoding.UTF8);
@@ -292,7 +294,7 @@ private static void StartMainApplication()
292294
{
293295
DispatcherQueue dispatcherQueue = DispatcherQueue.GetForCurrentThread();
294296

295-
var context = new DispatcherQueueSynchronizationContext(dispatcherQueue);
297+
DispatcherQueueSynchronizationContext context = new DispatcherQueueSynchronizationContext(dispatcherQueue);
296298
SynchronizationContext.SetSynchronizationContext(context);
297299

298300
// ReSharper disable once ObjectCreationAsStatement
@@ -305,12 +307,12 @@ private static void StartMainApplication()
305307

306308
private static void HttpClientLogWatcher(object sender, DownloadLogEvent e)
307309
{
308-
var severity = e.Severity switch
309-
{
310-
DownloadLogSeverity.Warning => LogType.Warning,
311-
DownloadLogSeverity.Error => LogType.Error,
312-
_ => LogType.Default
313-
};
310+
LogType severity = e.Severity switch
311+
{
312+
DownloadLogSeverity.Warning => LogType.Warning,
313+
DownloadLogSeverity.Error => LogType.Error,
314+
_ => LogType.Default
315+
};
314316

315317
LogWriteLine(e.Message, severity, true);
316318
}
@@ -360,7 +362,7 @@ private static void InitializeAppSettings()
360362
LoadLocale(GetAppConfigValue("AppLanguage").ToString());
361363
}
362364

363-
var themeValue = GetAppConfigValue("ThemeMode").ToString();
365+
string themeValue = GetAppConfigValue("ThemeMode").ToString();
364366
if (Enum.TryParse(themeValue, true, out CurrentAppTheme))
365367
{
366368
return;
@@ -373,7 +375,7 @@ private static void InitializeAppSettings()
373375

374376
private static void RunElevateUpdate()
375377
{
376-
var elevatedProc = new Process
378+
Process elevatedProc = new Process
377379
{
378380
StartInfo = new ProcessStartInfo
379381
{
@@ -390,7 +392,7 @@ private static void RunElevateUpdate()
390392

391393
public static string GetVersionString()
392394
{
393-
var version = Environment.OSVersion.Version;
395+
Version version = Environment.OSVersion.Version;
394396
m_isWindows11 = version.Build >= 22000;
395397
return m_isWindows11 ? $"Windows 11 (build: {version.Build}.{version.Revision})" : $"Windows {version.Major} (build: {version.Build}.{version.Revision})";
396398
}
@@ -403,7 +405,7 @@ public static string MD5Hash(string path)
403405
}
404406

405407
FileStream stream = File.OpenRead(path);
406-
var hash = Hash.GetCryptoHash<MD5>(stream);
408+
byte[] hash = Hash.GetCryptoHash<MD5>(stream);
407409
stream.Close();
408410
return Convert.ToHexStringLower(hash);
409411
}

CollapseLauncher/XAMLs/MainApp/Pages/CachesPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using CollapseLauncher.Statics;
77
using Hi3Helper;
88
using Hi3Helper.Shared.ClassStruct;
9-
using Hi3Helper.Win32.Native.ManagedTools;
9+
using Hi3Helper.Win32.ManagedTools;
1010
using Microsoft.UI.Xaml;
1111
using Microsoft.UI.Xaml.Controls;
1212
using Microsoft.UI.Xaml.Controls.Primitives;

CollapseLauncher/XAMLs/MainApp/Pages/Dialogs/SimpleDialogs.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using CommunityToolkit.WinUI;
1010
using Hi3Helper;
1111
using Hi3Helper.SentryHelper;
12-
using Hi3Helper.Win32.Native.ManagedTools;
12+
using Hi3Helper.Win32.ManagedTools;
1313
using Microsoft.UI.Dispatching;
1414
using Microsoft.UI.Input;
1515
using Microsoft.UI.Text;

CollapseLauncher/XAMLs/MainApp/Pages/FileCleanupPage.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using Hi3Helper;
1010
using Hi3Helper.Data;
1111
using Hi3Helper.SentryHelper;
12-
using Hi3Helper.Win32.Native.ManagedTools;
12+
using Hi3Helper.Win32.ManagedTools;
1313
using Microsoft.UI.Text;
1414
using Microsoft.UI.Xaml;
1515
using Microsoft.UI.Xaml.Controls;

CollapseLauncher/XAMLs/MainApp/Pages/HomePage.GameLauncher.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
using Hi3Helper;
1010
using Hi3Helper.EncTool.WindowTool;
1111
using Hi3Helper.SentryHelper;
12-
using Hi3Helper.Win32.Native.ManagedTools;
12+
using Hi3Helper.Win32.ManagedTools;
1313
using Hi3Helper.Win32.Screen;
1414
using Microsoft.UI.Xaml;
1515
using Microsoft.UI.Xaml.Controls;

CollapseLauncher/XAMLs/MainApp/Pages/HomePage.GameManagement.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using Hi3Helper.SentryHelper;
1313
using Hi3Helper.Shared.ClassStruct;
1414
using Hi3Helper.Win32.FileDialogCOM;
15-
using Hi3Helper.Win32.Native.ManagedTools;
15+
using Hi3Helper.Win32.ManagedTools;
1616
using Microsoft.UI.Composition;
1717
using Microsoft.UI.Text;
1818
using Microsoft.UI.Xaml;

0 commit comments

Comments
 (0)