26 lines
1.3 KiB
Python
26 lines
1.3 KiB
Python
import zipfile, os, subprocess
|
|
|
|
jar = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\sa_essentials-forge-1.20.1-1.0.0.jar'
|
|
out = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\_tmp\classes'
|
|
|
|
targets = [
|
|
'com/ogaba/sa_survival/item/tooltip/BackpackContentsTooltip.class',
|
|
'com/ogaba/sa_survival/event/ExternalEquipmentStorageTooltipEvents.class',
|
|
'com/ogaba/sa_combat/event/SACombatForgeEvents.class',
|
|
]
|
|
|
|
javap = r'D:\我的世界\bin\javap.EXE'
|
|
for t in targets:
|
|
p = os.path.join(out, t.replace('/', os.sep))
|
|
os.makedirs(os.path.dirname(p), exist_ok=True)
|
|
with zipfile.ZipFile(jar) as z:
|
|
with open(p, 'wb') as f:
|
|
f.write(z.read(t))
|
|
cname = t[:-6].replace('/', '.')
|
|
r = subprocess.run([javap, '-c', '-p', '-classpath', out, cname], capture_output=True, text=True, encoding='utf-8', errors='replace')
|
|
text = r.stdout if r.returncode == 0 else r.stderr
|
|
fn = r'e:\MCStudioDownload\work\3027246179@qq.com\Cpp\AddOn\309c2d420bc84ee986db9cdd070ff02a\_sa_hanhua_out\_tmp\javap_%s.txt' % cname.rsplit('.',1)[-1]
|
|
with open(fn, 'w', encoding='utf-8') as f:
|
|
f.write(text)
|
|
print('==', cname, 'written:', fn)
|