@@ -2784,6 +2784,7 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
27842784 break
27852785 flist .append (HeaderOut )
27862786 countnum = countnum + 1
2787+ outlist .update ({'fp' : fp })
27872788 return flist
27882789
27892790
@@ -3293,6 +3294,33 @@ def ReadInMultipleFilesWithContentToArray(infile, fmttype="auto", filestart=0, s
32933294 return ReadInMultipleFileWithContentToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
32943295
32953296
3297+ def ReadInStackedFileWithContentToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
3298+ outretval = []
3299+ outstartfile = filestart
3300+ while True :
3301+ outarray = ReadInFileWithContentToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
3302+ if outarray is False : # stop when function signals False
3303+ break
3304+ infile = outarray ['fp' ]
3305+ print (infile .tell ())
3306+ outretval .append (outarray )
3307+ return outretval
3308+
3309+
3310+ def ReadInMultipleStackedFileWithContentToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
3311+ if (isinstance (infile , (list , tuple , ))):
3312+ pass
3313+ else :
3314+ infile = [infile ]
3315+ outretval = {}
3316+ for curfname in infile :
3317+ curretfile [curfname ] = ReadInStackedFileWithContentToArray (curfname , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
3318+ return outretval
3319+
3320+ def ReadInMultipleStackedFilesWithContentToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
3321+ return ReadInMultipleStackedFileWithContentToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
3322+
3323+
32963324def ReadInFileWithContentToList (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
32973325 if (IsNestedDict (formatspecs ) and fmttype != "auto" and fmttype in formatspecs ):
32983326 formatspecs = formatspecs [fmttype ]
@@ -4043,12 +4071,6 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
40434071 fcsize , fuid , funame , fgid , fgname , fcurfid , fcurinode , flinkcount , fdev , fdev_minor , fdev_major , "+" + str (len (formatspecs ['format_delimiter' ]))]
40444072 AppendFileHeaderWithContent (
40454073 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
4046- if (numfiles > 0 ):
4047- try :
4048- fp .write (AppendNullBytes (
4049- ["0" , "0" ], formatspecs ['format_delimiter' ]))
4050- except OSError :
4051- return False
40524074 fp .seek (0 , 0 )
40534075 return fp
40544076
@@ -4112,12 +4134,6 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
41124134 fcontents .seek (0 , 0 )
41134135 AppendFileHeaderWithContent (
41144136 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
4115- if (numfiles > 0 ):
4116- try :
4117- fp .write (AppendNullBytes (
4118- ["0" , "0" ], formatspecs ['format_delimiter' ]))
4119- except OSError :
4120- return False
41214137 return fp
41224138
41234139
@@ -5510,12 +5526,6 @@ def PackFoxFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", compress
55105526 AppendFileHeaderWithContent (
55115527 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
55125528 fcontents .close ()
5513- if (numfiles > 0 ):
5514- try :
5515- fp .write (AppendNullBytes (
5516- ["0" , "0" ], formatspecs ['format_delimiter' ]))
5517- except OSError :
5518- return False
55195529 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
55205530 fp = CompressOpenFileAlt (
55215531 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -5811,12 +5821,6 @@ def PackFoxFileFromTarFile(infile, outfile, fmttype="auto", compression="auto",
58115821 AppendFileHeaderWithContent (
58125822 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
58135823 fcontents .close ()
5814- if (numfiles > 0 ):
5815- try :
5816- fp .write (AppendNullBytes (
5817- ["0" , "0" ], formatspecs ['format_delimiter' ]))
5818- except OSError :
5819- return False
58205824 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
58215825 fp = CompressOpenFileAlt (
58225826 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -6105,12 +6109,6 @@ def PackFoxFileFromZipFile(infile, outfile, fmttype="auto", compression="auto",
61056109 AppendFileHeaderWithContent (
61066110 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
61076111 fcontents .close ()
6108- if (numfiles > 0 ):
6109- try :
6110- fp .write (AppendNullBytes (
6111- ["0" , "0" ], formatspecs ['format_delimiter' ]))
6112- except OSError :
6113- return False
61146112 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
61156113 fp = CompressOpenFileAlt (
61166114 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -6425,12 +6423,6 @@ def PackFoxFileFromRarFile(infile, outfile, fmttype="auto", compression="auto",
64256423 AppendFileHeaderWithContent (
64266424 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
64276425 fcontents .close ()
6428- if (numfiles > 0 ):
6429- try :
6430- fp .write (AppendNullBytes (
6431- ["0" , "0" ], formatspecs ['format_delimiter' ]))
6432- except OSError :
6433- return False
64346426 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
64356427 fp = CompressOpenFileAlt (
64366428 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -6679,12 +6671,6 @@ def PackFoxFileFromSevenZipFile(infile, outfile, fmttype="auto", compression="au
66796671 AppendFileHeaderWithContent (
66806672 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
66816673 fcontents .close ()
6682- if (numfiles > 0 ):
6683- try :
6684- fp .write (AppendNullBytes (
6685- ["0" , "0" ], formatspecs ['format_delimiter' ]))
6686- except OSError :
6687- return False
66886674 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
66896675 fp = CompressOpenFileAlt (
66906676 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -7568,6 +7554,33 @@ def MultipleFoxFilesToArray(infile, fmttype="auto", filestart=0, seekstart=0, se
75687554 return MultipleFoxFileToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , returnfp )
75697555
75707556
7557+ def StackedFoxFileToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
7558+ outretval = []
7559+ outstartfile = filestart
7560+ while True :
7561+ outarray = FoxFileToArray (infile , fmttype , outstartfile , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , True )
7562+ if outarray is False : # stop when function signals False
7563+ break
7564+ infile = outarray ['fp' ]
7565+ print (infile .tell ())
7566+ outretval .append (outarray )
7567+ return outretval
7568+
7569+
7570+ def MultipleStackedFoxFileToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
7571+ if (isinstance (infile , (list , tuple , ))):
7572+ pass
7573+ else :
7574+ infile = [infile ]
7575+ outretval = {}
7576+ for curfname in infile :
7577+ curretfile [curfname ] = StackedFoxFileToArray (curfname , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , returnfp )
7578+ return outretval
7579+
7580+ def MultipleStackedFoxFilesToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
7581+ return MultipleStackedFoxFileToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , returnfp )
7582+
7583+
75717584def FoxFileStringToArray (instr , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
75727585 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
75737586 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
@@ -7960,12 +7973,6 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
79607973 fcontents .close ()
79617974 lcfi = lcfi + 1
79627975 reallcfi = reallcfi + 1
7963- if (lcfx > 0 ):
7964- try :
7965- fp .write (AppendNullBytes (
7966- ["0" , "0" ], formatspecs ['format_delimiter' ]))
7967- except OSError :
7968- return False
79697976 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
79707977 fp = CompressOpenFileAlt (
79717978 fp , compression , compressionlevel , compressionuselist , formatspecs )
0 commit comments