def __init__(self,typ='ERF'): '''Create an empty erf file. @param typ: one of "ERF" (the default), "MOD", "SAV", "HAK" depending on the type of erf to be created. ''' NeverFile.__init__(self) self.filename = "" self.readFileHandle = None self.writeFileHandle = None self.languageCount = 0 self.localizedStringSize = 0 self.entryCount = 0 self.offsetToLocalizedString = ERFFile.HEADERSIZE self.offsetToKeyList = ERFFile.HEADERSIZE self.offsetToResourceList = ERFFile.HEADERSIZE self.buildYear = time.localtime().tm_year - 1900 self.buildDay = time.localtime().tm_yday self.descriptionRef = "" self.localizedStrings = {} self.entriesByType = {} self.entriesByNameAndType = {} self.version = 'V1.0' typ = typ.upper() if typ not in ["ERF","MOD","SAV","HAK"]: raise ValueError,'invalid erf type ' + typ self.type = typ + ' '
def __init__(self): NeverFile.__init__(self) self.variableResourceCount = 0 self.fixedResourceCount = 0 self.variableTableOffset = 0 self.variableResources = [] self.fixedResources = []
def headerFromFile(self, f): f.seek(0) NeverFile.headerFromFile(self, f) self.variableResourceCount = self.dataHandler.readUIntFile(f) self.fixedResourceCount = self.dataHandler.readUIntFile(f) if self.fixedResourceCount != 0: print 'error, fixed resources in BIF files not implemented' return self.variableTableOffset = self.dataHandler.readUIntFile(f)
def headerFromFile(self, f): f.seek(0) NeverFile.headerFromFile(self, f) self.bifCount = self.dataHandler.readUIntFile(f) self.keyCount = self.dataHandler.readUIntFile(f) self.offsetToFileTable = self.dataHandler.readUIntFile(f) self.offsetToKeyTable = self.dataHandler.readUIntFile(f) self.buildYear = self.dataHandler.readUIntFile(f) self.buildDay = self.dataHandler.readUIntFile(f) f.seek(32, 1) #skip empty space
def __init__(self): NeverFile.__init__(self) self.clearHeaderData() self.clearFlats() self.rootStructure = None self.offset = 0 self.fieldData = ''
def __init__(self): NeverFile.__init__(self) self.languageID = 0 self.stringCount = 0 self.stringDataOffset = 0 self.stringSpecOffset = 20 self.stringSpecs = [] self.tlkFile = None self.version = '' self.stringSpecSize = 40
def headerFromFile(self, f): f.seek(0) NeverFile.headerFromFile(self, f) if self.version != 'V3.0': self.stringSpecSize = 36 else: self.stringSpecSize = 40 #sound length got added self.languageID = self.dataHandler.readUIntFile(f) self.stringCount = self.dataHandler.readUIntFile(f) self.stringDataOffset = self.dataHandler.readUIntFile(f) self.stringSpecs = self.stringCount * [None]
def headerFromFile(self,f): NeverFile.headerFromFile(self,f) self.languageCount = self.dataHandler.readIntFile(f) self.localizedStringSize = self.dataHandler.readIntFile(f) self.entryCount = self.dataHandler.readIntFile(f) self.offsetToLocalizedString = self.dataHandler.readIntFile(f) self.offsetToKeyList = self.dataHandler.readIntFile(f) self.offsetToResourceList = self.dataHandler.readIntFile(f) self.buildYear = self.dataHandler.readIntFile(f) self.buildDay = self.dataHandler.readIntFile(f) self.descriptionRef = f.read(4) f.seek(116,1) #skip header padding
def __init__(self, dir): NeverFile.__init__(self) self.bifCount = 0 self.keyCount = 0 self.offsetToFileTable = 0 self.offsetToKeyTable = 0 self.buildYear = 0 self.buildDay = 0 self.files = [] self.keys = {} self.appDir = dir
def headerFromFile(self, f, offset=-1): if offset >= 0: f.seek(offset) NeverFile.headerFromFile(self, f) self.structOffset = self.dataHandler.readUIntFile(f) self.structCount = self.dataHandler.readUIntFile(f) self.fieldOffset = self.dataHandler.readUIntFile(f) self.fieldCount = self.dataHandler.readUIntFile(f) self.labelOffset = self.dataHandler.readUIntFile(f) self.labelCount = self.dataHandler.readUIntFile(f) self.fieldDataOffset = self.dataHandler.readUIntFile(f) self.fieldDataCount = self.dataHandler.readUIntFile(f) self.fieldIndicesOffset = self.dataHandler.readUIntFile(f) self.fieldIndicesCount = self.dataHandler.readUIntFile(f) / 4 self.listIndicesOffset = self.dataHandler.readUIntFile(f) self.listIndicesCount = self.dataHandler.readUIntFile(f) / 4
def fromFile(self,fname): """initialize an ERF file from a file (does not initialize the files contained in this ERF file).""" logger.debug('fromFile("' + fname + '")') self.filename = fname self.readFileHandle = NeverFile.fromFile(self,fname) self.readLocalizedStrings() self.readKeysAndResourceList()
def fromFile(self, fname): self.file = NeverFile.fromFile(self, fname) self.variableResourcesFromFile(self.file) self.fixedResourcesFromFile(self.file)
def __init__(self): NeverFile.__init__(self) self.SSFFile = None self.dataCache = {}
def headerFromFile(self, f): f.seek(0) NeverFile.headerFromFile(self, f) self.EntryCount = self.dataHandler.readUIntFile(f) self.TableOffset = self.dataHandler.readUIntFile(f)
def fromFile(self, fname): f = NeverFile.fromFile(self, fname) self.fileTableFromFile(f) self.keyTableFromFile(f)
def __init__(self): NeverFile.__init__(self) self.rawDataOffset = 0 self.rawDataSize = 0 self.totalSize = 0 self.model = Model()
def fromFile(self, fname): f = NeverFile.fromFile(self, fname) self.tlkFile = f