From 6c0acbd886e2d52879db14306ae1915d1b70e22d Mon Sep 17 00:00:00 2001 From: NathanW Date: Thu, 17 Sep 2026 14:51:40 +0200 Subject: [PATCH] fix: improved regex that doesn't exclude other windows languages --- Services/PowerPlanService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Services/PowerPlanService.cs b/Services/PowerPlanService.cs index ebecf8c..bb5c071 100644 --- a/Services/PowerPlanService.cs +++ b/Services/PowerPlanService.cs @@ -16,7 +16,7 @@ public class PowerPlanService : IPowerPlanService private static readonly Lazy powerPlansPath = new(GetPowerPlansPath); private static readonly string powerCfgExecutablePath = Path.Combine(Environment.SystemDirectory, "powercfg.exe"); private static readonly TimeSpan powerCfgTimeout = TimeSpan.FromSeconds(20); - private static readonly Regex powerSchemeRegex = new(@"^Power Scheme GUID:\s*([0-9a-fA-F-]+)[ \t]+\((.*)\)[ \t]*(\*)?[ \t]*\r?$", RegexOptions.Multiline | RegexOptions.Compiled); + private static readonly Regex powerSchemeRegex = new(@"^.*?\b([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})[ \t]+\((.*)\)[ \t]*(\*)?[ \t]*\r?$", RegexOptions.Multiline | RegexOptions.Compiled); private static readonly Regex pathTraversalRegex = new(@"(^|[\\/])\.\.([\\/]|$)", RegexOptions.Compiled); private static string PowerPlansPath => powerPlansPath.Value;