@@ -2220,7 +2220,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
22202220 return catlist
22212221
22222222
2223- def ReadFileHeaderDataWithContentToList (fp , listonly = False , uncompress = True , skipchecksum = False , formatspecs = __file_format_dict__ ):
2223+ def ReadFileHeaderDataWithContentToList (fp , listonly = False , contentasfile = False , uncompress = True , skipchecksum = False , formatspecs = __file_format_dict__ ):
22242224 if (not hasattr (fp , "read" )):
22252225 return False
22262226 delimiter = formatspecs ['format_delimiter' ]
@@ -2338,7 +2338,8 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, uncompress=True, ski
23382338 else :
23392339 return False
23402340 fcontents .seek (0 , 0 )
2341- fcontents = fcontents .read ()
2341+ if (not contentasfile ):
2342+ fcontents = fcontents .read ()
23422343 catlist = [ftype , fencoding , fname , flinkname , fsize , fatime , fmtime , fctime , fbtime , fmode , fwinattributes , fcompression , fcsize , fuid , funame , fgid , fgname , fid ,
23432344 finode , flinkcount , fdev , fdev_minor , fdev_major , fseeknextfile , extrafieldslist , HeaderOut [- 4 ], HeaderOut [- 3 ], fcontents ]
23442345 return catlist
@@ -2535,7 +2536,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
25352536 return catlist
25362537
25372538
2538- def ReadFileDataWithContentToList (fp , seekstart = 0 , seekend = 0 , listonly = False , uncompress = True , skipchecksum = False , formatspecs = __file_format_dict__ ):
2539+ def ReadFileDataWithContentToList (fp , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = False , uncompress = True , skipchecksum = False , formatspecs = __file_format_dict__ ):
25392540 if (not hasattr (fp , "read" )):
25402541 return False
25412542 delimiter = formatspecs ['format_delimiter' ]
@@ -2668,7 +2669,7 @@ def ReadFileDataWithContentToList(fp, seekstart=0, seekend=0, listonly=False, un
26682669 countnum = seekstart
26692670 while (countnum < seekend ):
26702671 HeaderOut = ReadFileHeaderDataWithContentToList (
2671- fp , listonly , uncompress , skipchecksum , formatspecs )
2672+ fp , listonly , contentasfile , uncompress , skipchecksum , formatspecs )
26722673 if (len (HeaderOut ) == 0 ):
26732674 break
26742675 catlist .append (HeaderOut )
@@ -2851,7 +2852,21 @@ def ReadInFileWithContentToArray(infile, fmttype="auto", seekstart=0, seekend=0,
28512852 return ReadFileDataWithContentToArray (fp , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs )
28522853
28532854
2854- def ReadInFileWithContentToList (infile , fmttype = "auto" , seekstart = 0 , seekend = 0 , listonly = False , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ ):
2855+ def ReadInMultipleFileWithContentToArray (infile , fmttype = "auto" , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ ):
2856+ if (isinstance (infile , (list , tuple , ))):
2857+ pass
2858+ else :
2859+ infile = [infile ]
2860+ outretval = {}
2861+ for curfname in infile :
2862+ curretfile = outretval .update ({curfname : ArchiveFileToArray (curfname , fmttype , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs )})
2863+ return outretval
2864+
2865+ def ReadInMultipleFilesWithContentToArray (infile , fmttype = "auto" , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ ):
2866+ return ReadInMultipleFileWithContentToArray (infile , fmttype , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs )
2867+
2868+
2869+ def ReadInFileWithContentToList (infile , fmttype = "auto" , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ ):
28552870 if (IsNestedDict (formatspecs ) and fmttype != "auto" and fmttype in formatspecs ):
28562871 formatspecs = formatspecs [fmttype ]
28572872 elif (IsNestedDict (formatspecs ) and fmttype != "auto" and fmttype not in formatspecs ):
@@ -3022,7 +3037,21 @@ def ReadInFileWithContentToList(infile, fmttype="auto", seekstart=0, seekend=0,
30223037 if (not compresscheck ):
30233038 return False
30243039 fp = UncompressFile (infile , formatspecs , "rb" )
3025- return ReadFileDataWithContentToList (fp , seekstart , seekend , listonly , uncompress , skipchecksum , formatspecs )
3040+ return ReadFileDataWithContentToList (fp , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs )
3041+
3042+
3043+ def ReadInMultipleFileWithContentToList (infile , fmttype = "auto" , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ ):
3044+ if (isinstance (infile , (list , tuple , ))):
3045+ pass
3046+ else :
3047+ infile = [infile ]
3048+ outretval = {}
3049+ for curfname in infile :
3050+ curretfile = outretval .update ({curfname : ArchiveFileToList (curfname , fmttype , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs )})
3051+ return outretval
3052+
3053+ def ReadInMultipleFilesWithContentToList (infile , fmttype = "auto" , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ ):
3054+ return ReadInMultipleFileWithContentToList (infile , fmttype , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs )
30263055
30273056
30283057def AppendNullByte (indata , delimiter = __file_format_dict__ ['format_delimiter' ]):
@@ -3625,7 +3654,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
36253654
36263655
36273656def AppendInFileWithContent (infile , fp , dirlistfromtxt = False , filevalues = [], extradata = [], followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False ):
3628- inlist = ReadInFileWithContentToList (infile , "auto" , 0 , 0 , False , True , False , formatspecs )
3657+ inlist = ReadInFileWithContentToList (infile , "auto" , 0 , 0 , False , False , True , False , formatspecs )
36293658 return AppendListsWithContent (inlist , fp , dirlistfromtxt , filevalues , extradata , followlink , checksumtype , formatspecs , verbose )
36303659
36313660
@@ -3784,7 +3813,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
37843813
37853814
37863815def AppendInFileWithContentToOutFile (infile , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , filevalues = [], extradata = [], followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
3787- inlist = ReadInFileWithContentToList (infile , "auto" , 0 , 0 , False , True , False , formatspecs )
3816+ inlist = ReadInFileWithContentToList (infile , "auto" , 0 , 0 , False , False , True , False , formatspecs )
37883817 return AppendListsWithContentToOutFile (inlist , outfile , dirlistfromtxt , fmttype , compression , compresswholefile , compressionlevel , filevalues , extradata , followlink , checksumtype , formatspecs , verbose , returnfp )
37893818
37903819
0 commit comments