Panda3D
|
Public Member Functions | |
def | __init__ |
def | checkHash |
def | fromFile |
def | fullVerify |
def | loadXml |
def | quickVerify |
def | readHash |
def | storeMiniXml |
def | storeXml |
Public Attributes | |
actualFile | |
basename | |
filename | |
hash | |
size | |
timestamp |
This class represents a disk file whose hash and size etc. were read from an xml file. This class provides methods to verify whether the file on disk matches the version demanded by the xml.
def __init__ | ( | self | ) |
def checkHash | ( | self, | |
packageDir, | |||
pathname, | |||
st | |||
) |
Returns true if the file has the expected md5 hash, false otherwise. As a side effect, stores a FileSpec corresponding to the on-disk file in self.actualFile.
def fromFile | ( | self, | |
packageDir, | |||
filename, | |||
pathname = None , |
|||
st = None |
|||
) |
Reads the file information from the indicated file. If st is supplied, it is the result of os.stat on the filename.
def fullVerify | ( | self, | |
packageDir = None , |
|||
pathname = None , |
|||
notify = None |
|||
) |
Performs a more thorough test to ensure the file has not been modified. This test is less vulnerable to malicious attacks, since it reads and verifies the entire file. Returns true if it is intact, false if it needs to be redownloaded.
def loadXml | ( | self, | |
xelement | |||
) |
Reads the file information from the indicated XML element.
def quickVerify | ( | self, | |
packageDir = None , |
|||
pathname = None , |
|||
notify = None |
|||
) |
Performs a quick test to ensure the file has not been modified. This test is vulnerable to people maliciously attempting to fool the program (by setting datestamps etc.). Returns true if it is intact, false if it needs to be redownloaded.
def readHash | ( | self, | |
pathname | |||
) |
Reads the hash only from the indicated pathname.
def storeMiniXml | ( | self, | |
xelement | |||
) |
Adds the just the "mini" file information--size and hash--to the indicated XML element.
def storeXml | ( | self, | |
xelement | |||
) |
Adds the file information to the indicated XML element.