diff --git a/tools/ReleaseTool/Program.cs b/tools/ReleaseTool/Program.cs index 148af35..db1cbb2 100644 --- a/tools/ReleaseTool/Program.cs +++ b/tools/ReleaseTool/Program.cs @@ -327,7 +327,12 @@ private static void TagsToSplitterRegexes(string dialogueDir, bool readOnly = fa File.WriteAllLines(dialogueFile, lines.Where(x => x.Length > 0)); } - File.WriteAllLines(Path.Combine(dialogueDir, "generated_regex.txt"), taggedLines); + File.WriteAllLines(Path.Combine(dialogueDir, "generated_regex.txt"), + // Deduplicate, then order regexes based on number of characters before first tag then by original text length for a small speedup at runtime + taggedLines.Distinct() + .GroupBy(x => x.Substring(0, x.IndexOf('='))).Select(x => x.First()) + .OrderByDescending(x => x.IndexOf('(', StringComparison.Ordinal)) + .ThenBy(x => x.IndexOf('=', StringComparison.Ordinal))); } private static readonly List _toCleanup = new List();