# -*- coding:utf-8 -*- from V1 import Json_Util import os import shutil from V1.PrintLog import printlog def ReplaceGameResource(apk_decompile_tmp_dir,resourcepaths): for resourcepath in resourcepaths: # PrintLog("resourcepaths:%s"%resourcepaths) resource = resourcepath[0] path = resourcepath[1] if resource != None and resource != "" and path != None and path != "": # PrintLog("game resource: %s"%resource) if not os.path.exists(path): printlog("game resource is not exists in:%s" % path) return False, "game resource is not exists in:%s"%resource apkrespath = "%s/%s"%(apk_decompile_tmp_dir, resource) # PrintLog("game apkrespath: %s"%apkrespath) # dislogopath = "%s/assets/shansu/%s"%(decompilepath, QuickPackContants.getQuickPackLogoName()) if not os.path.exists(os.path.dirname(apkrespath)): os.makedirs(os.path.dirname(apkrespath)) shutil.copy(path, apkrespath) pass def replaceAdGameResource(apk_decompile_tmp_dir,resourcepaths,resourceconfigs): pathkeys = Json_Util.getJsonKeys(resourcepaths) for key in pathkeys: path = resourcepaths[key] printlog("GameResourcePath:%s" % path) if path != None and path != "": print(resourceconfigs[key]["default"]) apkrespath = "%s/%s"%(apk_decompile_tmp_dir,resourceconfigs[key]["default"]) if not os.path.exists(os.path.dirname(apkrespath)): os.makedirs(os.path.dirname(apkrespath)) shutil.copy(path, apkrespath) pass