1414 Copyright 2018-2024 Game Maker 2k - http://intdb.sourceforge.net/
1515 Copyright 2018-2024 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
1616
17- $FileInfo: archivefile.py - Last Update: 11/6 /2025 Ver. 0.25.2 RC 1 - Author: cooldude2k $
17+ $FileInfo: archivefile.py - Last Update: 11/12 /2025 Ver. 0.26.0 RC 1 - Author: cooldude2k $
1818'''
1919
2020from __future__ import absolute_import , division , print_function , unicode_literals , generators , with_statement , nested_scopes
2121import os
2222import sys
23+ import logging
2324import argparse
2425import pyarchivefile
2526import binascii
2627
28+ # Text streams (as provided by Python)
29+ PY_STDIN_TEXT = sys .stdin
30+ PY_STDOUT_TEXT = sys .stdout
31+ PY_STDERR_TEXT = sys .stderr
32+
33+ # Binary-friendly streams (use .buffer on Py3, fall back on Py2)
34+ PY_STDIN_BUF = getattr (sys .stdin , "buffer" , sys .stdin )
35+ PY_STDOUT_BUF = getattr (sys .stdout , "buffer" , sys .stdout )
36+ PY_STDERR_BUF = getattr (sys .stderr , "buffer" , sys .stderr )
37+ logging .basicConfig (format = "%(message)s" , stream = PY_STDOUT_TEXT , level = logging .DEBUG )
38+
2739# Conditional import and signal handling for Unix-like systems
2840if os .name != 'nt' : # Not Windows
2941 import signal
@@ -155,7 +167,7 @@ def handler(signum, frame):
155167 checkcompressfile = pyarchivefile .CheckCompressionSubType (
156168 input_file , fnamedict , 0 , True )
157169 if ((pyarchivefile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pyarchivefile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
158- tmpout = pyarchivefile .RePackArchiveFile (input_file , getargs .output , "auto" , getargs .compression , getargs .wholefile , getargs .level , pyarchivefile .compressionlistalt , False , 0 , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .insecretkey , getargs .outsecretkey , getargs .verbose , False )
170+ tmpout = pyarchivefile .RePackArchiveFile (input_file , getargs .output , "auto" , getargs .compression , getargs .wholefile , getargs .level , pyarchivefile .compressionlistalt , False , 0 , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .insecretkey , getargs .outsecretkey , False , getargs .verbose , False )
159171 else :
160172 tmpout = pyarchivefile .PackArchiveFileFromInFile (
161173 input_file , getargs .output , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pyarchivefile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .insecretkey , getargs .verbose , False )
@@ -169,14 +181,14 @@ def handler(signum, frame):
169181 input_file , fnamedict , 0 , True )
170182 if ((pyarchivefile .IsNestedDict (fnamedict ) and checkcompressfile in fnamedict ) or (pyarchivefile .IsSingleDict (fnamedict ) and checkcompressfile == fnamedict ['format_magic' ])):
171183 pyarchivefile .RePackArchiveFile (input_file , getargs .output , "auto" , getargs .compression , getargs .wholefile , getargs .level , pyarchivefile .compressionlistalt ,
172- False , 0 , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .insecretkey , getargs .outsecretkey , getargs .verbose , False )
184+ False , 0 , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .insecretkey , getargs .outsecretkey , False , getargs .verbose , False )
173185 else :
174186 pyarchivefile .PackArchiveFileFromInFile (input_file , getargs .output , __file_format_default__ , getargs .compression , getargs .wholefile , getargs .level , pyarchivefile .compressionlistalt , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], [], {}, fnamedict , getargs .insecretkey , getargs .verbose , False )
175187 if (not tmpout ):
176188 sys .exit (1 )
177189 else :
178190 pyarchivefile .RePackArchiveFile (input_file , getargs .output , "auto" , getargs .compression , getargs .wholefile , getargs .level , pyarchivefile .compressionlistalt ,
179- False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .insecretkey , getargs .outsecretkey , getargs .verbose , False )
191+ False , getargs .filestart , 0 , 0 , [getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum , getargs .checksum ], getargs .skipchecksum , [], {}, fnamedict , getargs .insecretkey , getargs .outsecretkey , False , getargs .verbose , False )
180192 elif active_action == 'extract' :
181193 if getargs .convert :
182194 checkcompressfile = pyarchivefile .CheckCompressionSubType (
@@ -219,11 +231,6 @@ def handler(signum, frame):
219231 sys .exit (1 )
220232 fvalid = pyarchivefile .StackedArchiveFileValidate (
221233 input_file , "auto" , getargs .filestart , fnamedict , getargs .insecretkey , False , getargs .verbose , False )
222- if (not getargs .verbose ):
223- import sys
224- import logging
225- logging .basicConfig (format = "%(message)s" ,
226- stream = sys .stdout , level = logging .DEBUG )
227234 if (fvalid ):
228235 pyarchivefile .VerbosePrintOut ("File is valid: \n " + str (input_file ))
229236 else :
0 commit comments