Skip to content

Commit

Permalink
misc: chore: Collapse HLE swkbd character validation utils into a sin…
Browse files Browse the repository at this point in the history
…gle class
  • Loading branch information
GreemDev committed Feb 1, 2025
1 parent 38ef65a commit ad9d658
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
{
public static class NumericCharacterValidation
public static class CharacterValidation
{
public static bool IsNumeric(char value) => Patterns.Numeric.IsMatch(value.ToString());
public static bool IsCJK(char value) => Patterns.CJK.IsMatch(value.ToString());
}
}
4 changes: 2 additions & 2 deletions src/Ryujinx/UI/Applet/SwkbdAppletDialog.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,12 @@ private void SetInputValidation(KeyboardMode mode)
case KeyboardMode.Numeric:
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeNumeric);
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
_checkInput = text => text.All(NumericCharacterValidation.IsNumeric);
_checkInput = text => text.All(CharacterValidation.IsNumeric);
break;
case KeyboardMode.Alphabet:
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeAlphabet);
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
_checkInput = text => text.All(value => !CJKCharacterValidation.IsCJK(value));
_checkInput = text => text.All(value => !CharacterValidation.IsCJK(value));
break;
case KeyboardMode.ASCII:
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeASCII);
Expand Down

0 comments on commit ad9d658

Please sign in to comment.