From af84f2cf8ca47d18baab17627990ab1e534fb89a Mon Sep 17 00:00:00 2001 From: jp64k <122999544+jp64k@users.noreply.github.com> Date: Fri, 30 Jan 2026 04:40:59 +0100 Subject: [PATCH] Improvd base game name derivation for grouped tiles Refactored the logic to strip parentheses from all version names before selecting the shortest, instead of selecting the shortest name first and then stripping --- GalleryView.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/GalleryView.cs b/GalleryView.cs index a4fbd40..424c847 100644 --- a/GalleryView.cs +++ b/GalleryView.cs @@ -225,13 +225,16 @@ public class FastGalleryPanel : Control // If only one version, use actual name if (versions.Count == 1) return versions[0].Text; - // Get base name without (...) - except (MR-Fix) - string name = versions.OrderBy(v => v.Text.Length).First().Text; - bool hasMrFix = name.IndexOf("(MR-Fix)", StringComparison.OrdinalIgnoreCase) >= 0; + // Strip parentheses (...) from all names - except (MR-Fix), then use the shortest result + var strippedNames = versions.Select(v => + { + string name = v.Text; + bool hasMrFix = name.IndexOf("(MR-Fix)", StringComparison.OrdinalIgnoreCase) >= 0; + name = System.Text.RegularExpressions.Regex.Replace(name, @"\s*\([^)]*\)", "").Trim(); + return hasMrFix ? name + " (MR-Fix)" : name; + }); - name = System.Text.RegularExpressions.Regex.Replace(name, @"\s*\([^)]*\)", "").Trim(); - - return hasMrFix ? name + " (MR-Fix)" : name; + return strippedNames.OrderBy(n => n.Length).First(); } private void BuildGroupedTiles()