def recordFile(self): comFun.RecordToJsonFile(comFun.JSONHAVARES, self.json_res) comFun.RecordToJsonFile(comFun.COLLATINGJSON, self.collatingJson) comFun.RecordToJsonFile(comFun.REFERENCEFILE, self.referenceCount) comFun.RecordToJsonFile(comFun.NOTFOUND, self.notFountFile)
def recordData(self): # comFun.RecordToJsonFile(comFun.PLISTINFO , self.plistInfo) # comFun.RecordToJsonFile(comFun.PLISTMD5, self.plistMd5) comFun.RecordToJsonFile(comFun.TYPEPATHS, self.newResPath) # 新路径新增到文件信息记录中 self.FileData.refreshTypeDataToFile(self.newResPath)
def refreshTypeDataToFile(self , data): for filetype , resList in data.iteritems(): for fileDict in resList: if fileDict["md5"] in self.data: self.data[fileDict["md5"]]["tPath"] = fileDict["path"] else: print fileDict["path"] assert(False) # print json.dumps(self.data, ensure_ascii=False, encoding="utf-8", indent=4) comFun.RecordToJsonFile(comFun.MD5OLD_NEW, self.data)
def replaceFile(self): jsonPaths = [] comFun.initPathFiles(comFun.SEARCHJSONPATH , jsonPaths) # jsonPaths = ["D:\Svn_2d\UI_Shu\Json\obtain_prop_dialog.json","D:\Svn_2d\UI_Shu\Json\hall.json"] if not os.path.exists(comFun.OUTPUTPATH): os.mkdir(comFun.OUTPUTPATH , 0o777) # 创建输出路径 for jsonPath in jsonPaths: if not re.search(r".json" , jsonPath): continue jsonPath = comFun.turnBias(jsonPath) _ , filename = os.path.split(jsonPath) newFilePath = comFun.turnBias(comFun.OUTPUTPATH + filename) if cmp(newFilePath , jsonPath) != 0: shutil.copyfile(jsonPath , newFilePath) print("\n==========>>>>" + newFilePath) self.streamDispose(newFilePath) # 对数据进行记录处理 comFun.RecordToJsonFile(comFun.CHANGERESULT, self.changeRecord)
def moveCodeRes(self): CodeChange = comFun.GetDataByFile(comFun.CODERESMESSAGE) LuaValidResList = [] for luaPath, ChangeInfos in CodeChange.iteritems( ): # 代码中对每个json文件中使用的资源有过一个去重处理 dict key if not "ValidChange" in ChangeInfos: continue for md5code, ChangeInfo in ChangeInfos["ValidChange"].iteritems(): if not ChangeInfo["new"] in LuaValidResList: LuaValidResList.append("Channel/" + ChangeInfo["new"]) self.copyFileToPath(comFun.OUTPUTTARGET + ChangeInfo["new"], comFun.REALPATH + ChangeInfo["new"]) # if not "PlistList" in ChangeInfos: # continue # for md5code , PListPath in ChangeInfos["PlistList"].iteritems(): # self.copyFileToPath(PListPath, self.PackagePath + "/" + os.path.basename(PListPath)) self.tidyInfo["CodeChange"] = LuaValidResList print( json.dumps(LuaValidResList, ensure_ascii=False, encoding="utf -8", indent=4)) comFun.RecordToJsonFile(comFun.TIDYRECORD, self.tidyInfo)