35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Read-only: instance element state attrs (suspend/record/runMode/...) across files."""
|
|
import io
|
|
import os
|
|
import re
|
|
|
|
d = open(r"C:\sanguo_bigqmt\qmt_install_dir.txt", encoding="utf-8").read().strip()
|
|
root = os.path.dirname(d)
|
|
|
|
WATCH = ("startupAutorun", "suspend", "record", "runMode", "id", "period",
|
|
"autoCancel", "end_restore", "is_main", "specialType", "runname")
|
|
|
|
files = [
|
|
("d0907", os.path.join(root, "config", "Temp", "indexUserConfig.xml_20260907")),
|
|
("d0908", os.path.join(root, "config", "Temp", "indexUserConfig.xml_20260908")),
|
|
("d0909", os.path.join(root, "config", "Temp", "indexUserConfig.xml_20260909")),
|
|
("now", os.path.join(root, "config", "indexUserConfig.xml")),
|
|
]
|
|
for tag, p in files:
|
|
t = io.open(p, encoding="utf-8", errors="replace").read()
|
|
i = t.find("startupAutorun")
|
|
if i < 0:
|
|
print(tag, "NO startupAutorun")
|
|
continue
|
|
start = t.rfind("<", 0, i)
|
|
end = t.find(">", i)
|
|
elem = t[start:end + 1]
|
|
pairs = []
|
|
for k, v in re.findall(r'(\w+)="([^"]*)"', elem):
|
|
if k in WATCH and k != "startupAutorun":
|
|
pairs.append("%s=%s" % (k, v.encode("unicode_escape").decode("ascii")[:40]))
|
|
sa = re.search(r'startupAutorun="([^"]*)"', elem)
|
|
print("%-6s startupAutorun=%s %s" % (tag, sa.group(1), " ".join(pairs)))
|
|
print("DONE7")
|