MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / GetLocsFromFolder

Method GetLocsFromFolder

localization/Program.cs:11–29  ·  view source on GitHub ↗
(string path)

Source from the content-addressed store, hash-verified

9 static string GetCurPath([CallerFilePath] string path = "") => Path.GetDirectoryName(path);
10
11 public static HashSet<string> GetLocsFromFolder(string path) {
12 var foundStrings = new HashSet<string>();
13 string pattern = @"LOC\(""([^""]*)""\)";
14
15 // Собираем все .cpp и .h файлы во всех подпапках
16 var files = Directory.EnumerateFiles(path, "*.*", SearchOption.AllDirectories)
17 .Where(f => f.EndsWith(".cpp") || f.EndsWith(".h"));
18
19 foreach (var file in files) {
20 string content = File.ReadAllText(file);
21 var matches = Regex.Matches(content, pattern);
22
23 foreach (Match match in matches) {
24 foundStrings.Add(match.Groups[1].Value);
25 }
26 }
27
28 return foundStrings;
29 }
30 class Info {
31 public Dictionary<string, string> complete = new();
32 }

Callers

nothing calls this directly

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected