66using Hi3Helper . Http . Legacy ;
77using Hi3Helper . SentryHelper ;
88using Hi3Helper . Shared . ClassStruct ;
9+ using Hi3Helper . Win32 . ManagedTools ;
910using Hi3Helper . Win32 . Native . LibraryImport ;
10- using Hi3Helper . Win32 . Native . ManagedTools ;
1111using InnoSetupHelper ;
1212using Microsoft . UI . Dispatching ;
1313using 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 }
0 commit comments