def classifyRes(self): resList = [] comFun.initPathFiles(comFun.RESPATH, resList) for resPath in resList: _, filetype = os.path.splitext(resPath) if filetype and cmp(filetype, ".png") != 0: self.handleOtherRes(resPath)
def moveCsb(): jsonPaths = [] comFun.initPathFiles("D:\\Svn_2d\\CoCoStuio\\vertical\\hall\\Json", jsonPaths) for jsonPath in jsonPaths: if not re.search(r".json", jsonPath): continue print "<string>" + os.path.basename(jsonPath) + "</string>"
def moveCsb(self): jsonPaths = [] comFun.initPathFiles(comFun.SEARCHJSONPATH, jsonPaths) for jsonPath in jsonPaths: if not re.search(r".json", jsonPath): continue print "<string>" + os.path.basename(jsonPath) + "</string>" comFun.moveTypeFileToTarget(comFun.UIPROJECT + r"/Export", ".csb", comFun.REALPATH)
def iniJsonFileList(self): folderFiles = [] # 存储所有的json文件 comFun.initPathFiles(comFun.SEARCHJSONPATH, folderFiles) for jsonpath in folderFiles: _, fileType = os.path.splitext(jsonpath) if cmp(fileType, ".json") != 0: continue if not os.path.isabs(jsonpath): jsonpath = os.path.abspath(jsonpath) jsonpath = comFun.turnBias(jsonpath) if not os.path.isfile(jsonpath): assert (False) self.json_res[jsonpath] = [] # print("Json has res : " + jsonpath) self.cmpJsonResType(jsonpath)
def initNewImageInfo(self): folderFiles = [] # 存储所有的json文件 comFun.initPathFiles(comFun.PACKAGEOUTPUT, folderFiles) for plistPath in folderFiles: if not os.path.isabs(plistPath): plistPath = os.path.abspath(plistPath) plistPath = comFun.turnBias(plistPath) if not os.path.isfile(plistPath): print(" not found file " + plistPath) assert(False) _,filetype = os.path.splitext(plistPath) if cmp(filetype , r".plist") != 0: continue tree = ET.parse(plistPath) root = tree.getroot() elements = self.getListElement(root) self.initPlistInfo(elements , plistPath)
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 judgeResNum(self , modulePath): SourcePath = comFun.PACKAGESOURCE + "common" if not os.path.isdir(SourcePath): os.mkdir(SourcePath, 0o777) folderFiles = [] # 存储所有的json文件 comFun.initPathFiles(modulePath, folderFiles) if not len(folderFiles): return False if len(folderFiles) < comFun.UNPACKAGENUM: # 不要每次都移动图片,判断使用的图片是否满足条件后再做图片的移动处理 for resPath in folderFiles: resPath = comFun.turnBias(resPath) md5code = self.moveRecord[resPath]["md5"] if md5code in self.unPackRepeat: # 已经被移动过一次,则移动回原来的位置去,避免图片重复出现 print "repeat :" + resPath self.moveResToPath(resPath, comFun.RESPATH, True) else: self.moveResToPath(resPath, SourcePath, True) # 达不到打包条件的图片会统一存放到这个位置,没有进行进一步的处理 self.unPackRepeat[self.moveRecord[resPath]["md5"]] = SourcePath + "/" + os.path.basename(resPath) # 要做进一步的处理,出现的一个情况是一个文件可能被多个(具体为2个,2个以上会另外打包)json使用 1000497.png 就是其中的情况之一 return False return True