Exemple #1
0
 def writeMapToFile(f, m):
     # Size of the map, 4 bytes
     buf = pack('<i', len(m))
     f.write(buf)
     for item in m.items():
         info = item[1]
         NameHelper.writeProtoToFile(f, info)
Exemple #2
0
    def writeToFile(self, fileName):
        f = open(fileName, 'w')
        # Global infomation 4 * 3 = 12 bytes
        NameHelper.writeProtoToFile(f, self.globalInfo)

        # Write Map
        Result.writeMapToFile(f, self.xingCharMap)
        Result.writeMapToFile(f, self.xingMap)
        Result.writeMapToFile(f, self.mingCharMap)
        Result.writeMapToFile(f, self.mingMap)
        Result.writeMapToFile(f, self.xingMingMap)

        # Write array
        Result.writeArrayToFile(f, self.xingCharSortedArray)
        Result.writeArrayToFile(f, self.xingSortedArray)
        Result.writeArrayToFile(f, self.mingCharSortedArray)
        Result.writeArrayToFile(f, self.mingSortedArray)
        Result.writeArrayToFile(f, self.xingMingSortedArray)
        f.close()