Refactor Lua string escaping to a new utility class

This commit is contained in:
Thorsten Sommer 2025-04-26 18:16:28 +02:00
parent 3e31d0a6d1
commit eba3e7a9fe
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 10 additions and 6 deletions

View File

@ -69,12 +69,6 @@ public sealed partial class CollectI18NKeysCommand
Console.WriteLine(" done.");
}
private static string EscapeLuaString(string value)
{
// Ersetze Backslash und Doppel-Anführungszeichen
return value.Replace("\\", @"\\").Replace("\"", "\\\"");
}
private string ExportToLuaAssignments(Dictionary<string, string> keyValuePairs)
{

View File

@ -0,0 +1,10 @@
namespace SharedTools;
public static class LuaTools
{
public static string EscapeLuaString(string value)
{
// Replace backslashes with double backslashes and escape double quotes:
return value.Replace("\\", @"\\").Replace("\"", "\\\"");
}
}