PyNeoFile 0.28.2__tar.gz → 0.28.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyNeoFile
3
- Version: 0.28.2
3
+ Version: 0.28.4
4
4
  Summary: A tar like file format name NeoFile.
5
5
  Home-page: https://github.com/GameMaker2k/PyNeoFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyNeoFile/archive/master.tar.gz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyNeoFile
3
- Version: 0.28.2
3
+ Version: 0.28.4
4
4
  Summary: A tar like file format name NeoFile.
5
5
  Home-page: https://github.com/GameMaker2k/PyNeoFile
6
6
  Download-URL: https://github.com/GameMaker2k/PyNeoFile/archive/master.tar.gz
@@ -14,7 +14,7 @@
14
14
  Copyright 2018-2026 Game Maker 2k - http://intdb.sourceforge.net/
15
15
  Copyright 2018-2026 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
16
16
 
17
- $FileInfo: neofile.py - Last Update: 2/4/2026 Ver. 0.28.2 RC 1 - Author: cooldude2k $
17
+ $FileInfo: neofile.py - Last Update: 2/6/2026 Ver. 0.28.4 RC 1 - Author: cooldude2k $
18
18
  '''
19
19
 
20
20
  from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
@@ -13,7 +13,7 @@
13
13
  Copyright 2018-2026 Game Maker 2k - http://intdb.sourceforge.net/
14
14
  Copyright 2018-2026 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
15
15
 
16
- $FileInfo: neofile_py3.py - Last Update: 2/4/2026 Ver. 0.28.2 RC 1 - Author: cooldude2k $
16
+ $FileInfo: neofile_py3.py - Last Update: 2/6/2026 Ver. 0.28.4 RC 1 - Author: cooldude2k $
17
17
  '''
18
18
 
19
19
  from __future__ import annotations
@@ -14,7 +14,7 @@
14
14
  Copyright 2018-2026 Game Maker 2k - http://intdb.sourceforge.net/
15
15
  Copyright 2018-2026 Kazuki Przyborowski - https://github.com/KazukiPrzyborowski
16
16
 
17
- $FileInfo: pyneofile.py - Last Update: 2/4/2026 Ver. 0.28.2 RC 1 - Author: cooldude2k $
17
+ $FileInfo: pyneofile.py - Last Update: 2/6/2026 Ver. 0.28.4 RC 1 - Author: cooldude2k $
18
18
  '''
19
19
 
20
20
  from __future__ import absolute_import, division, print_function, unicode_literals, generators, with_statement, nested_scopes
@@ -655,12 +655,12 @@ __project__ = __program_name__
655
655
  __program_alt_name__ = __program_name__
656
656
  __project_url__ = "https://github.com/GameMaker2k/PyNeoFile"
657
657
  __project_release_url__ = __project_url__+"/releases/latest"
658
- __version_info__ = (0, 28, 2, "RC 1", 1)
659
- __version_date_info__ = (2026, 2, 4, "RC 1", 1)
658
+ __version_info__ = (0, 28, 4, "RC 1", 1)
659
+ __version_date_info__ = (2026, 2, 6, "RC 1", 1)
660
660
  __version_date__ = str(__version_date_info__[0]) + "." + str(
661
661
  __version_date_info__[1]).zfill(2) + "." + str(__version_date_info__[2]).zfill(2)
662
662
  __revision__ = __version_info__[3]
663
- __revision_id__ = "$Id: ade78c8a3402f6aa7f3d29fd1be34be26380a839 $"
663
+ __revision_id__ = "$Id: f7060f6c8266a0c5bd803507bfd3e8f289b91a6d $"
664
664
  if(__version_info__[4] is not None):
665
665
  __version_date_plusrc__ = __version_date__ + \
666
666
  "-" + str(__version_date_info__[4])
@@ -4640,7 +4640,7 @@ def ReadFileHeaderDataWoSize(fp, delimiter=_default_delim(None)):
4640
4640
  return first_two + headerdata
4641
4641
 
4642
4642
 
4643
- def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipchecksum=False, formatspecs=__file_format_dict__, saltkey=None):
4643
+ def ReadFileHeaderDataWithContent(fp, listonly=False, contentasfile=False, uncompress=True, skipchecksum=False, formatspecs=__file_format_dict__, saltkey=None):
4644
4644
  if(not hasattr(fp, "read")):
4645
4645
  return False
4646
4646
  delimiter = formatspecs['format_delimiter']
@@ -4657,15 +4657,41 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
4657
4657
  fcs = HeaderOut[-2].lower()
4658
4658
  fccs = HeaderOut[-1].lower()
4659
4659
  fsize = int(HeaderOut[7], 16)
4660
- fcompression = HeaderOut[14]
4661
- fcsize = int(HeaderOut[15], 16)
4662
- fseeknextfile = HeaderOut[26]
4663
- fjsontype = HeaderOut[27]
4664
- fjsonlen = int(HeaderOut[28], 16)
4665
- fjsonsize = int(HeaderOut[29], 16)
4666
- fjsonchecksumtype = HeaderOut[30]
4667
- fjsonchecksum = HeaderOut[31]
4668
- fjsoncontent = {}
4660
+ fcompression = HeaderOut[17]
4661
+ fcsize = int(HeaderOut[18], 16)
4662
+ fseeknextfile = HeaderOut[28]
4663
+ fjsontype = HeaderOut[29]
4664
+ fjsonlen = int(HeaderOut[30], 16)
4665
+ fjsonsize = int(HeaderOut[31], 16)
4666
+ fjsonchecksumtype = HeaderOut[32]
4667
+ fjsonchecksum = HeaderOut[33]
4668
+ fextrasize = int(HeaderOut[34], 16)
4669
+ fextrafields = int(HeaderOut[35], 16)
4670
+ fextrafieldslist = []
4671
+ extrastart = 36
4672
+ extraend = extrastart + fextrafields
4673
+ while(extrastart < extraend):
4674
+ fextrafieldslist.append(HeaderOut[extrastart])
4675
+ extrastart = extrastart + 1
4676
+ fvendorfieldslist = []
4677
+ fvendorfields = 0;
4678
+ if((len(HeaderOut) - 4)>extraend):
4679
+ extrastart = extraend
4680
+ extraend = len(HeaderOut) - 4
4681
+ while(extrastart < extraend):
4682
+ fvendorfieldslist.append(HeaderOut[extrastart])
4683
+ extrastart = extrastart + 1
4684
+ fvendorfields = fvendorfields + 1
4685
+ if(fextrafields==1):
4686
+ try:
4687
+ fextrafieldslist = json.loads(base64.b64decode(fextrafieldslist[0]).decode("UTF-8"))
4688
+ fextrafields = len(fextrafieldslist)
4689
+ except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
4690
+ try:
4691
+ fextrafieldslist = json.loads(fextrafieldslist[0])
4692
+ except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
4693
+ pass
4694
+ fjstart = fp.tell()
4669
4695
  if(fjsontype=="json"):
4670
4696
  fjsoncontent = {}
4671
4697
  fprejsoncontent = fp.read(fjsonsize).decode("UTF-8")
@@ -4732,31 +4758,37 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
4732
4758
  except (binascii.Error, json.decoder.JSONDecodeError, UnicodeDecodeError):
4733
4759
  pass
4734
4760
  fp.seek(len(delimiter), 1)
4761
+ fjend = fp.tell() - 1
4735
4762
  jsonfcs = GetFileChecksum(fprejsoncontent, fjsonchecksumtype, True, formatspecs, saltkey)
4736
4763
  if(not CheckChecksums(fjsonchecksum, jsonfcs) and not skipchecksum):
4737
4764
  VerbosePrintOut("File JSON Data Checksum Error with file " +
4738
4765
  fname + " at offset " + str(fheaderstart))
4739
4766
  VerbosePrintOut("'" + fjsonchecksum + "' != " + "'" + jsonfcs + "'")
4740
4767
  return False
4741
- fp.seek(len(delimiter), 1)
4768
+ fcs = HeaderOut[-2].lower()
4769
+ fccs = HeaderOut[-1].lower()
4742
4770
  newfcs = GetHeaderChecksum(HeaderOut[:-2], HeaderOut[-4].lower(), True, formatspecs, saltkey)
4743
- HeaderOut.append(fjsoncontent)
4744
4771
  if(fcs != newfcs and not skipchecksum):
4745
4772
  VerbosePrintOut("File Header Checksum Error with file " +
4746
4773
  fname + " at offset " + str(fheaderstart))
4747
4774
  VerbosePrintOut("'" + fcs + "' != " + "'" + newfcs + "'")
4748
4775
  return False
4776
+ fhend = fp.tell() - 1
4777
+ fcontentstart = fp.tell()
4749
4778
  fcontents = MkTempFile()
4779
+ pyhascontents = False
4750
4780
  if(fsize > 0 and not listonly):
4751
4781
  if(fcompression == "none" or fcompression == "" or fcompression == "auto"):
4752
4782
  fcontents.write(fp.read(fsize))
4753
4783
  else:
4754
4784
  fcontents.write(fp.read(fcsize))
4785
+ pyhascontents = True
4755
4786
  elif(fsize > 0 and listonly):
4756
4787
  if(fcompression == "none" or fcompression == "" or fcompression == "auto"):
4757
4788
  fp.seek(fsize, 1)
4758
4789
  else:
4759
4790
  fp.seek(fcsize, 1)
4791
+ pyhascontents = False
4760
4792
  fcontents.seek(0, 0)
4761
4793
  newfccs = GetFileChecksum(fcontents, HeaderOut[-3].lower(), False, formatspecs, saltkey)
4762
4794
  fcontents.seek(0, 0)
@@ -4770,12 +4802,15 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
4770
4802
  else:
4771
4803
  fcontents.seek(0, 0)
4772
4804
  if(uncompress):
4773
- cfcontents = UncompressFileAlt(fcontents, formatspecs)
4805
+ cfcontents = UncompressFileAlt(
4806
+ fcontents, formatspecs)
4774
4807
  cfcontents.seek(0, 0)
4775
4808
  fcontents = MkTempFile()
4776
4809
  shutil.copyfileobj(cfcontents, fcontents, length=__filebuff_size__)
4777
4810
  cfcontents.close()
4778
4811
  fcontents.seek(0, 0)
4812
+ fccs = GetFileChecksum(fcontents, HeaderOut[-3].lower(), False, formatspecs, saltkey)
4813
+ fcontentend = fp.tell()
4779
4814
  if(re.findall("^\\+([0-9]+)", fseeknextfile)):
4780
4815
  fseeknextasnum = int(fseeknextfile.replace("+", ""))
4781
4816
  if(abs(fseeknextasnum) == 0):
@@ -4793,6 +4828,9 @@ def ReadFileHeaderDataWithContent(fp, listonly=False, uncompress=True, skipcheck
4793
4828
  fp.seek(fseeknextasnum, 0)
4794
4829
  else:
4795
4830
  return False
4831
+ fcontents.seek(0, 0)
4832
+ if(not contentasfile):
4833
+ fcontents = fcontents.read()
4796
4834
  HeaderOut.append(fcontents)
4797
4835
  return HeaderOut
4798
4836
 
@@ -5241,7 +5279,7 @@ def ReadFileHeaderDataWithContentToList(fp, listonly=False, contentasfile=False,
5241
5279
  return outlist
5242
5280
 
5243
5281
 
5244
- def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, skipchecksum=False, formatspecs=__file_format_dict__, saltkey=None):
5282
+ def ReadFileDataWithContent(fp, filestart=0, listonly=False, contentasfile=False, uncompress=True, skipchecksum=False, formatspecs=__file_format_dict__, saltkey=None):
5245
5283
  if(not hasattr(fp, "read")):
5246
5284
  return False
5247
5285
  delimiter = formatspecs['format_delimiter']
@@ -5279,8 +5317,8 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
5279
5317
  "'" + newfcs + "'")
5280
5318
  return False
5281
5319
  fnumfiles = int(inheader[8], 16)
5282
- outfseeknextfile = inheaderdata[9]
5283
- fjsonsize = int(inheaderdata[12], 16)
5320
+ outfseeknextfile = inheader[9]
5321
+ fjsonsize = int(inheader[12], 16)
5284
5322
  fjsonchecksumtype = inheader[13]
5285
5323
  fjsonchecksum = inheader[14]
5286
5324
  fp.read(fjsonsize)
@@ -5305,7 +5343,7 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
5305
5343
  countnum = 0
5306
5344
  flist = []
5307
5345
  while(countnum < fnumfiles):
5308
- HeaderOut = ReadFileHeaderDataWithContent(fp, listonly, uncompress, skipchecksum, formatspecs, saltkey)
5346
+ HeaderOut = ReadFileHeaderDataWithContent(fp, listonly, contentasfile, uncompress, skipchecksum, formatspecs, saltkey)
5309
5347
  if(len(HeaderOut) == 0):
5310
5348
  break
5311
5349
  flist.append(HeaderOut)