diff --git a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/Win32Program.cs b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/Win32Program.cs index d8bebcd9a4..f044c235ce 100644 --- a/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/Win32Program.cs +++ b/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Programs/Win32Program.cs @@ -29,7 +29,7 @@ using Windows.System; namespace Microsoft.CmdPal.Ext.Apps.Programs; [Serializable] -public class Win32Program : IProgram +public partial class Win32Program : IProgram { public static readonly Win32Program InvalidProgram = new Win32Program { Valid = false, Enabled = false }; @@ -278,7 +278,8 @@ public class Win32Program : IProgram } } - private static readonly Regex InternetShortcutURLPrefixes = new Regex(@"^steam:\/\/(rungameid|run|open)\/|^com\.epicgames\.launcher:\/\/apps\/", RegexOptions.Compiled); + [GeneratedRegex(@"^steam:\/\/(rungameid|run|open)\/|^com\.epicgames\.launcher:\/\/apps\/", RegexOptions.Compiled)] + private static partial Regex InternetShortcutURLPrefixes(); // This function filters Internet Shortcut programs private static Win32Program InternetShortcutProgram(string path) @@ -307,7 +308,7 @@ public class Win32Program : IProgram } // To filter out only those steam shortcuts which have 'run' or 'rungameid' as the hostname - if (InternetShortcutURLPrefixes.Match(urlPath).Success) + if (InternetShortcutURLPrefixes().IsMatch(urlPath)) { validApp = true; }