23 lines
573 B
Python
23 lines
573 B
Python
import re, shutil, sys
|
|
|
|
GAME = r"F:\steam\steamapps\common\The I of the Dragon"
|
|
BK = r"C:\Users\29452\AppData\Local\Temp\opencode\backup\Strings.dat"
|
|
p = GAME + r"\Data\Misc\Strings.dat"
|
|
|
|
shutil.copyfile(BK, p)
|
|
enc = open(p, "rb").read()
|
|
test = b"\xc1\xfa"
|
|
pat = re.compile(rb'(Id\s*=\s*"([^"]*)"\s*[\r\n]+\s*English\s*=\s*")[^"]*(")')
|
|
|
|
|
|
def repl(m):
|
|
sid = m.group(2)
|
|
if b"Filename" in sid or b"Path" in sid:
|
|
return m.group(0)
|
|
return m.group(1) + test + m.group(3)
|
|
|
|
|
|
enc2, n = pat.subn(repl, enc)
|
|
open(p, "wb").write(enc2)
|
|
print("strings replaced:", n)
|