Skip to content

Commit 9265bf1

Browse files
committed
fix unescaped semicolon, fix addressable name having non alphanumeric characters
1 parent 15e8278 commit 9265bf1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

patch1337tocpp/Program.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.IO;
5+
using System.Linq;
56
using System.Text;
7+
using System.Text.RegularExpressions;
68
using CommandLine;
79

810
namespace patch1337tocpp {
@@ -49,11 +51,11 @@ static void Main(string[] args) {
4951
w.WriteLine("};");
5052
w.Write("struct Patch { ");
5153
w.Write("char* ModuleName; ");
52-
w.Write("std::vector<PatchAddress> Patches ");
54+
w.Write("std::vector<PatchAddress> Patches;");
5355
w.WriteLine("};");
5456

5557
foreach (var patch in patches) {
56-
var addressableName = patch.ModuleName.Replace(" ", "_");
58+
var addressableName = Regex.Replace(patch.ModuleName, "([^A-Za-z0-9])+", "_");
5759
w.WriteLine($"Patch {addressableName};");
5860
w.WriteLine($"{addressableName}.ModuleName = \"{patch.ModuleName}\";");
5961
w.WriteLine($"{addressableName}.Patches = {{");

0 commit comments

Comments
 (0)