From ccd3ce71470daffdc2fcfe6f345c05368c30291e Mon Sep 17 00:00:00 2001 From: Jeremy Sinclair <4016293+snickler@users.noreply.github.com> Date: Wed, 30 Jul 2025 22:13:54 -0400 Subject: [PATCH] [Build][CmdPal] Use GeneratedRegexAttribute for InternetShortcutURLPrefix --- .../ext/Microsoft.CmdPal.Ext.Apps/Programs/Win32Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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; }