@@ -2332,7 +2332,7 @@ def ReadFileDataBySizeWithContentToArray(fp, seekstart=0, seekend=0, listonly=Fa
23322332 fnumfiles = int (fprenumfiles , 16 )
23332333 fprechecksumtype = catheader [2 ]
23342334 fprechecksum = catheader [3 ]
2335- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
2335+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : "" , ' fversion' : catversions [1 ], 'fostype' : fostype ,
23362336 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [catstring ] + catheader , 'ffilelist' : []}
23372337 if (seekstart < 0 and seekstart > fnumfiles ):
23382338 seekstart = 0
@@ -5496,13 +5496,13 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
54965496 checkcompressfile = CheckCompressionSubType (catfp , formatspecs , True )
54975497 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
54985498 return TarFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5499- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
5499+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
55005500 return ZipFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5501- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
5501+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
55025502 return RarFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5503- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
5503+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
55045504 return SevenZipFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5505- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
5505+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
55065506 return False
55075507 if (not catfp ):
55085508 return False
@@ -5538,13 +5538,13 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
55385538 checkcompressfile = CheckCompressionSubType (infile , formatspecs , True )
55395539 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
55405540 return TarFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5541- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
5541+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
55425542 return ZipFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5543- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
5543+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
55445544 return RarFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5545- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
5545+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
55465546 return SevenZipFileToArray (infile , seekto , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5547- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
5547+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
55485548 return False
55495549 compresscheck = CheckCompressionType (infile , formatspecs , True )
55505550 if (not compresscheck ):
@@ -5623,7 +5623,10 @@ def ArchiveFileSeekToFileNum(infile, seekto=0, listonly=False, contentasfile=Tru
56235623 "'" + str (catfileheadercshex ) + "'" )
56245624 return False
56255625 catversions = re .search ('(.*?)(\\ d+)' , catstring ).groups ()
5626- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
5626+ fcompresstype = compresscheck
5627+ if (fcompresstype == "catfile" or fcompresstype == formatspecs ['format_lower' ]):
5628+ fcompresstype = ""
5629+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : fcompresstype , 'fversion' : catversions [1 ], 'fostype' : fostype ,
56275630 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [catstring ] + catheader , 'ffilelist' : {}}
56285631 if (seekto >= fnumfiles ):
56295632 seekto = fnumfiles - 1
@@ -5763,13 +5766,13 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
57635766 checkcompressfile = CheckCompressionSubType (catfp , formatspecs , True )
57645767 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
57655768 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5766- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
5769+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
57675770 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5768- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
5771+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
57695772 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5770- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
5773+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
57715774 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5772- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
5775+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
57735776 return False
57745777 if (not catfp ):
57755778 return False
@@ -5805,13 +5808,13 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
58055808 checkcompressfile = CheckCompressionSubType (infile , formatspecs , True )
58065809 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
58075810 return TarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5808- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
5811+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
58095812 return ZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5810- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
5813+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
58115814 return RarFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5812- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
5815+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
58135816 return SevenZipFileToArray (infile , 0 , 0 , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
5814- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
5817+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
58155818 return False
58165819 compresscheck = CheckCompressionType (infile , formatspecs , True )
58175820 if (not compresscheck ):
@@ -5890,7 +5893,10 @@ def ArchiveFileSeekToFileName(infile, seekfile=None, listonly=False, contentasfi
58905893 "'" + str (catfileheadercshex ) + "'" )
58915894 return False
58925895 catversions = re .search ('(.*?)(\\ d+)' , catstring ).groups ()
5893- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
5896+ fcompresstype = compresscheck
5897+ if (fcompresstype == "catfile" or fcompresstype == formatspecs ['format_lower' ]):
5898+ fcompresstype = ""
5899+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : fcompresstype , 'fversion' : catversions [1 ], 'fostype' : fostype ,
58945900 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [catstring ] + catheader , 'ffilelist' : {}}
58955901 seekto = fnumfiles - 1
58965902 filefound = False
@@ -6043,13 +6049,13 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
60436049 checkcompressfile = CheckCompressionSubType (catfp , formatspecs , True )
60446050 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
60456051 return TarFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6046- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
6052+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
60476053 return ZipFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6048- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
6054+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
60496055 return RarFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6050- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
6056+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
60516057 return SevenZipFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6052- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
6058+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
60536059 return False
60546060 if (not catfp ):
60556061 return False
@@ -6085,13 +6091,13 @@ def ArchiveFileValidate(infile, formatspecs=__file_format_dict__, verbose=False,
60856091 checkcompressfile = CheckCompressionSubType (infile , formatspecs , True )
60866092 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
60876093 return TarFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6088- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
6094+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
60896095 return ZipFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6090- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
6096+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
60916097 return RarFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6092- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
6098+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
60936099 return SevenZipFileToArray (infile , 0 , 0 , False , True , False , formatspecs , returnfp )
6094- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
6100+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
60956101 return False
60966102 compresscheck = CheckCompressionType (infile , formatspecs , True )
60976103 if (not compresscheck ):
@@ -6330,13 +6336,13 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
63306336 checkcompressfile = CheckCompressionSubType (catfp , formatspecs , True )
63316337 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
63326338 return TarFileToArray (infile , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
6333- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
6339+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
63346340 return ZipFileToArray (infile , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
6335- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
6341+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
63366342 return RarFileToArray (infile , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
6337- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
6343+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
63386344 return SevenZipFileToArray (infile , seekstart , seekend , listonly , contentasfile , skipchecksum , formatspecs , returnfp )
6339- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
6345+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
63406346 return False
63416347 if (not catfp ):
63426348 return False
@@ -6372,13 +6378,13 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
63726378 checkcompressfile = CheckCompressionSubType (infile , formatspecs , True )
63736379 if (checkcompressfile == "tarfile" and TarFileCheck (infile )):
63746380 return TarFileToArray (infile , seekstart , seekend , listonly , skipchecksum , formatspecs , returnfp )
6375- if (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
6381+ elif (checkcompressfile == "zipfile" and zipfile .is_zipfile (infile )):
63766382 return ZipFileToArray (infile , seekstart , seekend , listonly , skipchecksum , formatspecs , returnfp )
6377- if (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
6383+ elif (rarfile_support and checkcompressfile == "rarfile" and (rarfile .is_rarfile (infile ) or rarfile .is_rarfile_sfx (infile ))):
63786384 return RarFileToArray (infile , seekstart , seekend , listonly , skipchecksum , formatspecs , returnfp )
6379- if (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
6385+ elif (py7zr_support and checkcompressfile == "7zipfile" and py7zr .is_7zfile (infile )):
63806386 return SevenZipFileToArray (infile , seekstart , seekend , listonly , skipchecksum , formatspecs , returnfp )
6381- if (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
6387+ elif (checkcompressfile != "catfile" and checkcompressfile != formatspecs ['format_lower' ]):
63826388 return False
63836389 compresscheck = CheckCompressionType (infile , formatspecs , True )
63846390 if (not compresscheck ):
@@ -6457,7 +6463,10 @@ def ArchiveFileToArray(infile, seekstart=0, seekend=0, listonly=False, contentas
64576463 "'" + str (catfileheadercshex ) + "'" )
64586464 return False
64596465 catversions = re .search ('(.*?)(\\ d+)' , catstring ).groups ()
6460- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
6466+ fcompresstype = compresscheck
6467+ if (fcompresstype == "catfile" or fcompresstype == formatspecs ['format_lower' ]):
6468+ fcompresstype = ""
6469+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : fcompresstype , 'fversion' : catversions [1 ], 'fostype' : fostype ,
64616470 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [catstring ] + catheader , 'ffilelist' : []}
64626471 if (seekstart < 0 and seekstart > fnumfiles ):
64636472 seekstart = 0
@@ -6818,7 +6827,7 @@ def ListDirToArrayAlt(infiles, dirlistfromtxt=False, followlink=False, listonly=
68186827 AppendNullByte (catfileheadercshex , formatspecs ['format_delimiter' ])
68196828 fheadtell = len (fileheader )
68206829 catheader = [fostype , fnumfileshex , checksumtype , catfileheadercshex ]
6821- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
6830+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : "" , ' fversion' : catversions [1 ], 'fostype' : fostype ,
68226831 'fformatspecs' : formatspecs , 'fchecksumtype' : checksumtype , 'fheaderchecksum' : catfileheadercshex , 'frawheader' : [formatspecs ['format_magic' ] + fileheaderver ] + catheader , 'ffilelist' : []}
68236832 FullSizeFilesAlt = 0
68246833 for curfname in GetDirList :
@@ -7093,7 +7102,7 @@ def TarFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
70937102 AppendNullByte (catfileheadercshex , formatspecs ['format_delimiter' ])
70947103 fheadtell = len (fileheader )
70957104 catheader = [fostype , fnumfileshex , checksumtype , catfileheadercshex ]
7096- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
7105+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : "" , ' fversion' : catversions [1 ], 'fostype' : fostype ,
70977106 'fformatspecs' : formatspecs , 'fchecksumtype' : checksumtype , 'fheaderchecksum' : catfileheadercshex , 'frawheader' : [formatspecs ['format_magic' ] + fileheaderver ] + catheader , 'ffilelist' : []}
70987107 for member in sorted (tarfp .getmembers (), key = lambda x : x .name ):
70997108 catfhstart = fheadtell
@@ -7307,7 +7316,7 @@ def ZipFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
73077316 AppendNullByte (catfileheadercshex , formatspecs ['format_delimiter' ])
73087317 fheadtell = len (fileheader )
73097318 catheader = [fostype , fnumfileshex , checksumtype , catfileheadercshex ]
7310- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
7319+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : "" , ' fversion' : catversions [1 ], 'fostype' : fostype ,
73117320 'fformatspecs' : formatspecs , 'fchecksumtype' : checksumtype , 'fheaderchecksum' : catfileheadercshex , 'frawheader' : [formatspecs ['format_magic' ] + fileheaderver ] + catheader , 'ffilelist' : []}
73127321 for member in sorted (zipfp .infolist (), key = lambda x : x .filename ):
73137322 catfhstart = fheadtell
@@ -7530,7 +7539,7 @@ def RarFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumtype="
75307539 AppendNullByte (catfileheadercshex , formatspecs ['format_delimiter' ])
75317540 fheadtell = len (fileheader )
75327541 catheader = [fostype , fnumfileshex , checksumtype , catfileheadercshex ]
7533- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
7542+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : "" , ' fversion' : catversions [1 ], 'fostype' : fostype ,
75347543 'fformatspecs' : formatspecs , 'fchecksumtype' : checksumtype , 'fheaderchecksum' : catfileheadercshex , 'frawheader' : [formatspecs ['format_magic' ] + fileheaderver ] + catheader , 'ffilelist' : []}
75357544 for member in sorted (rarfp .infolist (), key = lambda x : x .filename ):
75367545 catfhstart = fheadtell
@@ -7777,7 +7786,7 @@ def SevenZipFileToArrayAlt(infile, listonly=False, contentasfile=True, checksumt
77777786 AppendNullByte (catfileheadercshex , formatspecs ['format_delimiter' ])
77787787 fheadtell = len (fileheader )
77797788 catheader = [fostype , fnumfileshex , checksumtype , catfileheadercshex ]
7780- catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fversion' : catversions [1 ], 'fostype' : fostype ,
7789+ catlist = {'fnumfiles' : fnumfiles , 'fformat' : catversions [0 ], 'fcompression' : "" , ' fversion' : catversions [1 ], 'fostype' : fostype ,
77817790 'fformatspecs' : formatspecs , 'fchecksumtype' : checksumtype , 'fheaderchecksum' : catfileheadercshex , 'frawheader' : [formatspecs ['format_magic' ] + fileheaderver ] + catheader , 'ffilelist' : []}
77827791 for member in sorted (szpfp .list (), key = lambda x : x .filename ):
77837792 catfhstart = fheadtell
0 commit comments