代码库初始化
This commit is contained in:
1 parent
07786ab323
commit
4334694551
851 files changed
+42626
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import zipfile, re
|
||||
|
||||
base = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out'
|
||||
jar = base + r'\sa_essentials-forge-1.20.1-1.0.0.jar'
|
||||
|
||||
# 从 class 字节中提取含空格的英文短语(连续 ASCII 段内,含空格、多为字符串字面量而非标识符)
|
||||
pat = re.compile(rb'[A-Za-z][A-Za-z ]{7,}')
|
||||
results = {}
|
||||
with zipfile.ZipFile(jar) as z:
|
||||
for n in z.namelist():
|
||||
if not n.endswith('.class'):
|
||||
continue
|
||||
try:
|
||||
b = z.read(n)
|
||||
except Exception:
|
||||
continue
|
||||
# 只取 ASCII 区段(去掉高位字节,避免误连)
|
||||
ascii_blob = bytes(c if 32 <= c < 127 else 0x20 for c in b)
|
||||
for m in pat.finditer(ascii_blob):
|
||||
s = m.group().decode('ascii')
|
||||
if ' ' not in s:
|
||||
continue
|
||||
s = s.strip()
|
||||
if len(s) < 8:
|
||||
continue
|
||||
results.setdefault(s, []).append(n)
|
||||
|
||||
print('找到含空格的英文短语 %d 个(去重):' % len(results))
|
||||
for s in sorted(results):
|
||||
print(' %-50s %s' % (s, results[s][0]))
|
||||
Reference in new issue
Block a user