Skip to content

Commit 4f2a951

Browse files
committed
Small code style changes in keyboard change logic
1 parent d827d0a commit 4f2a951

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

Flow.Launcher.Infrastructure/Win32Helper.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -464,19 +464,18 @@ private static string GetLanguageTag(uint langId)
464464
// https://github.com/dotnet/winforms/pull/8573#issuecomment-1542600949
465465
//
466466
// NOTE: this logic may break in future versions of Windows since it is not documented.
467-
if (langId is (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD1
468-
or (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD2
469-
or (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD3
470-
or (int)PInvoke.LOCALE_TRANSIENT_KEYBOARD4)
467+
if (langId is PInvoke.LOCALE_TRANSIENT_KEYBOARD1
468+
or PInvoke.LOCALE_TRANSIENT_KEYBOARD2
469+
or PInvoke.LOCALE_TRANSIENT_KEYBOARD3
470+
or PInvoke.LOCALE_TRANSIENT_KEYBOARD4)
471471
{
472-
using RegistryKey key = Registry.CurrentUser.OpenSubKey(UserProfileRegistryPath);
473-
if (key is not null && key.GetValue("Languages") is string[] languages)
472+
using var key = Registry.CurrentUser.OpenSubKey(UserProfileRegistryPath);
473+
if (key?.GetValue("Languages") is string[] languages)
474474
{
475475
foreach (string language in languages)
476476
{
477-
using RegistryKey subKey = key.OpenSubKey(language);
478-
if (subKey is not null
479-
&& subKey.GetValue("TransientLangId") is int transientLangId
477+
using var subKey = key.OpenSubKey(language);
478+
if (subKey?.GetValue("TransientLangId") is int transientLangId
480479
&& transientLangId == langId)
481480
{
482481
return language;

0 commit comments

Comments
 (0)