Pkg.ACE — API for parsing ACE archives¶
Parsing an ACE Archive¶
The following code example demonstrates how to parse an ACE archive:
from Pro.Core import *
from Pkg.ACE import *
def parseACEArchive(fname):
c = createContainerFromFile(fname)
if c.isNull():
return
obj = ACEObject()
if not obj.Load(c) or not obj.ParseArchive():
return
for i in range(obj.GetEntryCount()):
entry = obj.GetEntry(i)
if entry == None:
continue
# skip directories
if obj.IsDirectory(entry):
continue
print("file name:", entry.filename, "file size:", str(entry.size))
# retrieves the file data as NTContainer
fc = obj.GetEntryData(entry)
Module API¶
Pkg.ACE module API.
Classes:
This class represents an ACE archive.
- class ACEObject¶
Bases:
Pro.Core.CFFObjectThis class represents an ACE archive.
Methods:
DumpEntry(i, out)Dumps information about an entry to a text stream.
GetEntry(i)Retrieves an entry by its index.
Returns the number of entries present in the archive.
GetEntryData(i)Retrieves the data of an entry.
IsDirectory(i)Checks whether an entry is a directory.
Parses the archive.
- DumpEntry(i: int, out: Pro.Core.NTTextStream) → None¶
Dumps information about an entry to a text stream.
- Parameters
i (int) – The entry index.
out (NTTextStream) – The output text stream.
- GetEntry(i: int) → Any¶
Retrieves an entry by its index.
- Parameters
i (int) – The entry index.
- Returns
Returns the requested entry if successful; otherwise returns
None.- Return type
Any
See also
GetEntryCount().
- GetEntryCount() → int¶
- Returns
Returns the number of entries present in the archive.
- Return type
int
See also
GetEntry().
- GetEntryData(i: int) → Pro.Core.NTContainer¶
Retrieves the data of an entry.
- Parameters
i (int) – The entry index.
- Returns
Returns the data if successful; otherwise returns an invalid container.
- Return type
See also
GetEntryCount().
- IsDirectory(i: int) → bool¶
Checks whether an entry is a directory.
- Parameters
i (int) – The entry index.
- Returns
Returns
Trueif the entry is a directory; otherwise returnsFalse.- Return type
bool
- ParseArchive() → bool¶
Parses the archive.
- Returns
Returns
Trueif successful; otherwise returnsFalse.- Return type
bool