This commit is contained in:
Евгений Храмов 2023-05-14 16:22:39 +03:00
parent 9c861b2e13
commit 71c377ccb9

@ -24,9 +24,11 @@ logging.basicConfig(stream=sys.stderr, level=logging.CRITICAL)
class UnpackException(Exception):
pass
class SignatureUnpackException(UnpackException):
pass
class CorruptUnpackException(UnpackException):
pass
@ -62,7 +64,7 @@ def path_server():
def hlna():
pass
def arkit(src, dst):
def unpack(src, dst):
with open(src, 'rb') as f:
sigver = struct.unpack('q', f.read(8))[0]
unpacked_chunk = f.read(8)
@ -489,12 +491,12 @@ def modextract(id_mod, id_game_workshop):
src = os.path.join(curdir, file)
dst = os.path.join(curdir, name)
uncompressed = os.path.join(curdir, file + ".uncompressed_size")
arkit.unpack(src, dst)
unpack(src, dst)
#print("[+] Extracted " + file)
os.remove(src)
if os.path.isfile(uncompressed):
os.remove(uncompressed)
except (arkit.UnpackException, arkit.SignatureUnpackException, arkit.CorruptUnpackException) as e:
except (UnpackException, SignatureUnpackException, CorruptUnpackException) as e:
print("[x] Unpacking .z files failed, aborting mod install")
return False